SHA256
Ускорить публикацию блоков в Arweave
This commit is contained in:
@@ -12,13 +12,27 @@ export function escapeProfileHtml(text) {
|
||||
|
||||
const esc = escapeProfileHtml;
|
||||
|
||||
function statusChip({ kind, label, value, active }) {
|
||||
const n = Number(value || 0);
|
||||
function statusCardHtml({ kind, title, received, given }) {
|
||||
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 `
|
||||
<button type="button" class="pf-status${active ? ' is-active' : ''}" data-profile-list="${esc(kind)}"
|
||||
aria-label="${esc(label)}: подтверждений ${n}" title="Статус «${esc(label)}». Число – сколько людей его подтвердили. Нажмите, чтобы увидеть кто.">
|
||||
<span class="pf-status-dot" aria-hidden="true"></span>${esc(label)}${n > 0 ? `<b>${n}</b>` : ''}
|
||||
</button>`;
|
||||
<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>`;
|
||||
}
|
||||
|
||||
function statHtml({ kind, label, valueHtml, ariaLabel }) {
|
||||
@@ -75,19 +89,34 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
const listInner = aboutRow + contacts + pathRow;
|
||||
const listHtml = listInner.trim() ? `<div class="pf-list">${listInner}</div>` : '';
|
||||
const friends = Number(stats.friendsCount || 0);
|
||||
const statusChips = [
|
||||
(official || Number(stats.primaryReceivedCount || 0) > 0) && statusChip({ kind: 'primary_received', label: 'Официальный', value: stats.primaryReceivedCount, active: official }),
|
||||
(shining || Number(stats.shineReceivedCount || 0) > 0) && statusChip({ kind: 'shine_received', label: 'Сияющий', value: stats.shineReceivedCount, active: shining }),
|
||||
].filter(Boolean);
|
||||
const statusesHtml = statusChips.length ? `<div class="pf-statuses">${statusChips.join('')}</div>` : '';
|
||||
const closeFriends = Number(stats.closeFriendsCount || 0);
|
||||
|
||||
const officialCard = official
|
||||
? statusCardHtml({
|
||||
kind: 'primary',
|
||||
title: 'Официальный',
|
||||
received: stats.primaryReceivedCount,
|
||||
given: stats.primaryGivenCount,
|
||||
})
|
||||
: '';
|
||||
const shiningCard = shining
|
||||
? statusCardHtml({
|
||||
kind: 'shine',
|
||||
title: 'Сияющий',
|
||||
received: stats.shineReceivedCount,
|
||||
given: stats.shineGivenCount,
|
||||
})
|
||||
: '';
|
||||
|
||||
return `
|
||||
<div class="pf-hero${shining ? ' is-shining' : ''}" aria-label="Профиль ${esc(cardLogin)}">
|
||||
<div class="pf-avatar user-profile-avatar-slot"></div>
|
||||
<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>
|
||||
<h2 class="pf-name">${esc(displayName)}</h2>
|
||||
<div class="pf-login">@${esc(cardLogin)}</div>
|
||||
${statusesHtml}
|
||||
</div>
|
||||
|
||||
<div class="pf-stats">
|
||||
|
||||
Reference in New Issue
Block a user