Профиль: «Официальный» и «Сияющий» снова по бокам аватара

- Слева «Официальный», справа «Сияющий»: числа «подтвердили» и «подтвердил(а)» открывают списки.
- У активного статуса числа его цветом; на своём профиле обе стороны видны всегда, пустая – бледнее.
- Значки под именем и нижний раздел «Сияние» убраны – они повторяли эти числа.
This commit is contained in:
q
2026-10-15 23:16:35 +03:00
parent 68eec2b28b
commit bca788c5e6
4 changed files with 55 additions and 63 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
client.version=1.19.31
client.version=1.19.32
server.version=1.15.0
+1 -1
View File
@@ -39,7 +39,7 @@
}());
</script>
<script>
window.__SHINE_BUILD_HASH__ = '20261013170000';
window.__SHINE_BUILD_HASH__ = '20261015230000';
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
</script>
<script>
+24 -51
View File
@@ -13,35 +13,23 @@ export function escapeProfileHtml(text) {
const esc = escapeProfileHtml;
// Раздел статуса («Сияние», «Официальный»): кто подтвердил этот аккаунт и кого подтвердил он сам.
function statusSectionHtml({ kind, title, received, given, receivedLabel, givenLabel }) {
const receivedCount = Number(received || 0);
const givenCount = Number(given || 0);
// Карточка статуса у аватара: кто подтвердил этот аккаунт и кого подтвердил он сам.
function statusSideHtml({ kind, title, active, received, given, verb }) {
const isOfficial = kind === 'primary';
const receivedKind = isOfficial ? 'primary_received' : 'shine_received';
const givenKind = isOfficial ? 'primary_given' : 'shine_given';
return `
<section class="pf-status-section pf-status-section--${esc(kind)}" aria-label="${esc(title)}">
<h3 class="nav-list__title">${esc(title)}</h3>
<div class="nav-list">
<button type="button" class="nav-row" data-profile-list="${isOfficial ? 'primary_received' : 'shine_received'}">
<span class="nav-row__label">${esc(receivedLabel)}</span>
<span class="nav-row__hint">${esc(peopleCount(receivedCount))}</span>
</button>
<button type="button" class="nav-row" data-profile-list="${isOfficial ? 'primary_given' : 'shine_given'}">
<span class="nav-row__label">${esc(givenLabel)}</span>
<span class="nav-row__hint">${esc(peopleCount(givenCount))}</span>
</button>
</div>
<section class="pf-sc pf-sc--${esc(kind)}${active ? ' is-active' : ' is-empty'}" aria-label="${esc(title)}">
<div class="pf-sc__title">${esc(title)}</div>
<button type="button" class="pf-sc__row" data-profile-list="${receivedKind}" aria-label="${esc(title)}: подтвердили ${Number(received || 0)}">
<strong>${Number(received || 0)}</strong><span>подтвердили</span>
</button>
<button type="button" class="pf-sc__row" data-profile-list="${givenKind}" aria-label="${esc(title)}: ${esc(verb)} ${Number(given || 0)}">
<strong>${Number(given || 0)}</strong><span>${esc(verb)}</span>
</button>
</section>`;
}
function peopleCount(count) {
if (!count) return 'Пока никого';
const mod10 = count % 10;
const mod100 = count % 100;
const word = mod10 === 1 && mod100 !== 11 ? 'человек' : (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) ? 'человека' : 'человек';
return `${count} ${word}`;
}
function statHtml({ kind, label, valueHtml, ariaLabel }) {
return `
<button type="button" class="pf-stat" data-profile-list="${esc(kind)}" aria-label="${esc(ariaLabel)}">
@@ -103,39 +91,26 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
const shineGiven = Number(stats.shineGivenCount || 0);
const primaryReceived = Number(stats.primaryReceivedCount || 0);
const primaryGiven = Number(stats.primaryGivenCount || 0);
// Раздел виден у сияющих и у всех, кого уже подтверждали или кто подтверждал сам.
const shineSection = (shining || shineReceived || shineGiven)
? statusSectionHtml({
kind: 'shine',
title: 'Сияние',
received: shineReceived,
given: shineGiven,
receivedLabel: 'Подтвердили, что сияющий',
givenLabel: 'Подтвердил сияющими',
})
// Статусы по бокам аватара: слева «Официальный», справа «Сияние». На своём профиле – всегда
// (пустая сторона бледнее), на чужом – если статус есть или уже есть подтверждения.
const verb = card?.gender === 'female' ? 'подтвердила' : card?.gender === 'male' ? 'подтвердил' : 'подтвердил(а)';
const officialSide = (isSelf || official || primaryReceived || primaryGiven)
? statusSideHtml({ kind: 'primary', title: 'Официальный', active: official, received: primaryReceived, given: primaryGiven, verb })
: '';
const officialSection = (official || primaryReceived || primaryGiven)
? statusSectionHtml({
kind: 'primary',
title: 'Официальный аккаунт',
received: primaryReceived,
given: primaryGiven,
receivedLabel: 'Подтвердили, что официальный',
givenLabel: 'Подтвердил официальными',
})
const shineSide = (isSelf || shining || shineReceived || shineGiven)
? statusSideHtml({ kind: 'shine', title: 'Сияющий', active: shining, received: shineReceived, given: shineGiven, verb })
: '';
const badges = [
shining ? '<span class="pf-badge pf-badge--shine">Сияющий</span>' : '',
official ? '<span class="pf-badge pf-badge--official">Официальный</span>' : '',
].join('');
return `
<div class="pf-hero" aria-label="Профиль ${esc(cardLogin)}">
<div class="pf-avatar user-profile-avatar-slot${shining ? ' is-shining' : ''}"></div>
<div class="pf-identity">
<div class="pf-side pf-side--left">${officialSide}</div>
<div class="pf-avatar user-profile-avatar-slot${shining ? ' is-shining' : ''}"></div>
<div class="pf-side pf-side--right">${shineSide}</div>
</div>
<h2 class="pf-name">${esc(displayName)}</h2>
<div class="pf-login">@${esc(cardLogin)}</div>
${city ? `<div class="pf-city">${iconHtml('place')}<span>${esc(city)}</span></div>` : ''}
${badges ? `<div class="pf-badges">${badges}</div>` : ''}
</div>
<div class="pf-stats">
@@ -150,8 +125,6 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
<div class="pf-tiles user-profile-actions">${tilesHtml}</div>
</div>` : ''}
${shineSection}
${officialSection}
${listHtml}`;
}
+29 -10
View File
@@ -33,17 +33,36 @@
}
@media (prefers-reduced-motion: reduce) { .user-profile-screen .pf-avatar.is-shining::before { animation: none; } }
.user-profile-screen .pf-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1); margin-top: var(--space-1); }
.user-profile-screen .pf-badge {
padding: 3px 10px;
border-radius: 999px;
font-size: var(--text-xs);
line-height: var(--leading-xs);
font-weight: var(--weight-bold);
/* Статусы по бокам аватара: слева «Официальный», справа «Сияющий» (profile-card.js → statusSideHtml). */
.user-profile-screen .pf-identity {
--pf-shine: var(--warning);
--pf-official: var(--info);
width: min(100%, 440px);
display: grid;
grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
align-items: center;
gap: var(--space-3);
}
.user-profile-screen .pf-side { min-width: 0; display: grid; align-items: center; }
.user-profile-screen .pf-side--left { justify-items: end; }
.user-profile-screen .pf-side--right { justify-items: start; }
.user-profile-screen .pf-sc { --pf-c: var(--pf-shine); width: min(100%, 116px); display: grid; gap: var(--space-1); min-width: 0; }
.user-profile-screen .pf-sc--primary { --pf-c: var(--pf-official); }
.user-profile-screen .pf-sc__title { text-align: center; color: var(--pf-c); font-size: var(--text-xs); line-height: 1.2; font-weight: var(--weight-bold); }
.user-profile-screen .pf-sc__row { min-width: 0; display: grid; justify-items: center; gap: 1px; padding: 4px 2px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font: inherit; cursor: pointer; }
.user-profile-screen .pf-sc__row strong { font-size: var(--text-xl); line-height: 1.1; font-weight: var(--weight-bold); }
.user-profile-screen .pf-sc__row span { color: var(--text-secondary); font-size: 11px; line-height: 1.15; }
.user-profile-screen .pf-sc__row:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.user-profile-screen .pf-sc.is-active .pf-sc__row strong { color: var(--pf-c); }
.user-profile-screen .pf-sc.is-empty { opacity: 0.75; }
.user-profile-screen .pf-sc.is-empty .pf-sc__title { color: var(--text-secondary); }
@media (hover: hover) { .user-profile-screen .pf-sc__row:hover { background: var(--surface-selected); } }
.user-profile-screen .pf-sc__row:active { background: var(--surface-selected); }
@media (max-width: 360px) {
.user-profile-screen .pf-identity { grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr); gap: var(--space-2); }
.user-profile-screen .pf-sc__row span { font-size: 10px; }
}
.user-profile-screen .pf-badge--shine { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.user-profile-screen .pf-badge--official { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.user-profile-screen .pf-status-section .nav-list__title { margin-top: 0; }
.user-profile-screen .pf-name { margin: var(--space-2) 0 0; color: var(--text-primary); font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-bold); overflow-wrap: anywhere; }
.user-profile-screen .pf-login { color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-sm); }