SHA256
UI: сияние в профиле, связь без сдвига экрана, аватары каналов без кольца
- Профиль: золотая «дышащая» аура вокруг аватара сияющего, бейджи «Сияющий» / «Официальный» под именем, разделы «Сияние» и «Официальный аккаунт» со списками «кто подтвердил» и «кого подтвердил» (видны у сияющих и у всех, у кого есть подтверждения). - Кнопки подтверждения на экране связи – по тем же правилам, что проверяет сервер (голосует основной аккаунт, за сияние – основной и сияющий; цель не отказалась). - Экран связи: сохранение показывается на нажатой кнопке, без строки «Сохранение…», которая сдвигала экран; после выбора – сообщение и возврат на страницу пользователя. - В каналах и обсуждениях аватары без стеклянного кольца «Связей» (готовый avatar-plain). - Локальный сервер UI отдаёт Cache-Control: no-cache – иначе браузер брал старый router.js.
This commit is contained in:
@@ -12,29 +12,35 @@ export function escapeProfileHtml(text) {
|
||||
|
||||
const esc = escapeProfileHtml;
|
||||
|
||||
function statusCardHtml({ kind, title, received, given }) {
|
||||
// Раздел статуса («Сияние», «Официальный»): кто подтвердил этот аккаунт и кого подтвердил он сам.
|
||||
function statusSectionHtml({ kind, title, received, given, receivedLabel, givenLabel }) {
|
||||
const receivedCount = Number(received || 0);
|
||||
const givenCount = Number(given || 0);
|
||||
const isOfficial = kind === 'primary';
|
||||
const receivedKind = isOfficial ? 'primary_received' : 'shine_received';
|
||||
const givenKind = isOfficial ? 'primary_given' : 'shine_given';
|
||||
const receivedTitle = isOfficial ? 'Кто подтвердил этот официальный аккаунт' : 'Кто подтвердил, что этот аккаунт сияющий';
|
||||
const givenTitle = isOfficial ? 'Какие официальные аккаунты подтвердил этот пользователь' : 'Кого этот пользователь подтвердил как сияющего';
|
||||
|
||||
return `
|
||||
<section class="pf-status-card pf-status-card--${esc(kind)}" aria-label="${esc(title)}">
|
||||
<div class="pf-status-card-title">${esc(title)}</div>
|
||||
<button type="button" class="pf-status-card-count" data-profile-list="${receivedKind}"
|
||||
aria-label="${esc(receivedTitle)}: ${receivedCount}" title="${esc(receivedTitle)}">
|
||||
<strong>${receivedCount}</strong><span>подтвердили</span>
|
||||
</button>
|
||||
<button type="button" class="pf-status-card-count" data-profile-list="${givenKind}"
|
||||
aria-label="${esc(givenTitle)}: ${givenCount}" title="${esc(givenTitle)}">
|
||||
<strong>${givenCount}</strong><span>подтвердил</span>
|
||||
</button>
|
||||
<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>`;
|
||||
}
|
||||
|
||||
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)}">
|
||||
@@ -91,32 +97,42 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
const friends = Number(stats.friendsCount || 0);
|
||||
const closeFriends = Number(stats.closeFriendsCount || 0);
|
||||
|
||||
const officialCard = official
|
||||
? statusCardHtml({
|
||||
kind: 'primary',
|
||||
title: 'Официальный',
|
||||
received: stats.primaryReceivedCount,
|
||||
given: stats.primaryGivenCount,
|
||||
})
|
||||
: '';
|
||||
const shiningCard = shining
|
||||
? statusCardHtml({
|
||||
const shineReceived = Number(stats.shineReceivedCount || 0);
|
||||
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: stats.shineReceivedCount,
|
||||
given: stats.shineGivenCount,
|
||||
title: 'Сияние',
|
||||
received: shineReceived,
|
||||
given: shineGiven,
|
||||
receivedLabel: 'Подтвердили, что сияющий',
|
||||
givenLabel: 'Подтвердил сияющими',
|
||||
})
|
||||
: '';
|
||||
const officialSection = (official || primaryReceived || primaryGiven)
|
||||
? statusSectionHtml({
|
||||
kind: 'primary',
|
||||
title: 'Официальный аккаунт',
|
||||
received: primaryReceived,
|
||||
given: primaryGiven,
|
||||
receivedLabel: 'Подтвердили, что официальный',
|
||||
givenLabel: 'Подтвердил официальными',
|
||||
})
|
||||
: '';
|
||||
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-identity">
|
||||
<div class="pf-status-card-slot pf-status-card-slot--left">${officialCard}</div>
|
||||
<div class="pf-avatar user-profile-avatar-slot"></div>
|
||||
<div class="pf-status-card-slot pf-status-card-slot--right">${shiningCard}</div>
|
||||
</div>
|
||||
<div class="pf-avatar user-profile-avatar-slot${shining ? ' is-shining' : ''}"></div>
|
||||
<h2 class="pf-name">${esc(displayName)}</h2>
|
||||
<div class="pf-login">@${esc(cardLogin)}</div>
|
||||
${badges ? `<div class="pf-badges">${badges}</div>` : ''}
|
||||
</div>
|
||||
|
||||
<div class="pf-stats">
|
||||
@@ -131,6 +147,8 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
<div class="pf-tiles user-profile-actions">${tilesHtml}</div>
|
||||
</div>` : ''}
|
||||
|
||||
${shineSection}
|
||||
${officialSection}
|
||||
${listHtml}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user