SHA256
Обновить учёт поддержки, лайки и профиль перед MVP
This commit is contained in:
@@ -83,7 +83,8 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
<span class="pf-row-label">${th('screens.profile_card.text_019')}</span>
|
||||
<p class="pf-row-text">${esc(spiritualPath)}</p>
|
||||
</div>` : '';
|
||||
const listInner = aboutRow + contacts + pathRow;
|
||||
const detailButtons = (contacts || pathRow) ? `<div class="pf-detail-actions">${contacts ? `<button type="button" class="ui-button" data-profile-detail="contacts">${th('screens.profile_card.text_008')}</button>` : ''}${pathRow ? `<button type="button" class="ui-button" data-profile-detail="path">${th('screens.profile_card.text_019')}</button>` : ''}</div>` : '';
|
||||
const listInner = aboutRow + detailButtons + (contacts ? `<div class="pf-detail-panel" data-profile-panel="contacts" hidden>${contacts}</div>` : '') + (pathRow ? `<div class="pf-detail-panel" data-profile-panel="path" hidden>${pathRow}</div>` : '');
|
||||
const listHtml = listInner.trim() ? `<div class="pf-list">${listInner}</div>` : '';
|
||||
const friends = Number(stats.friendsCount || 0);
|
||||
const closeFriends = Number(stats.closeFriendsCount || 0);
|
||||
@@ -115,7 +116,7 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
<span class="pf-stat-relation"><strong class="pf-stat-value">${closeFriends}</strong><span class="pf-stat-label">${esc(t('remaining.share.close_friends'))}</span></span>
|
||||
<span class="pf-stat-relation"><strong class="pf-stat-value">${friends}</strong><span class="pf-stat-label">${esc(t('screens.profile_card.text_003'))}</span></span>
|
||||
</button>
|
||||
${statHtml({ kind: 'channels_owned', label: t('screens.profile_card.text_004'), valueHtml: String(Number(stats.ownedPublicChannelsCount || 0)), ariaLabel: t('screens.profile_card.text_015', { value1: Number(stats.ownedPublicChannelsCount || 0) }) })}
|
||||
${statHtml({ kind: 'channels_owned', label: t('screens.profile_card.text_004'), valueHtml: String(Math.max(0, Number(stats.ownedPublicChannelsCount || 0) - 1)), ariaLabel: t('screens.profile_card.text_015', { value1: Math.max(0, Number(stats.ownedPublicChannelsCount || 0) - 1) }) })}
|
||||
${statHtml({ kind: 'channels_following', label: t('screens.profile_card.text_005'), valueHtml: String(Number(stats.followingChannelsCount || 0)), ariaLabel: t('screens.profile_card.text_016', { value1: Number(stats.followingChannelsCount || 0) }) })}
|
||||
</div>
|
||||
|
||||
@@ -128,6 +129,19 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
${listHtml}`;
|
||||
}
|
||||
|
||||
export function attachProfileDetails(root) {
|
||||
root.querySelectorAll('[data-profile-detail]').forEach((button) => {
|
||||
button.addEventListener('click', async () => {
|
||||
const panel = root.querySelector(`[data-profile-panel="${button.dataset.profileDetail}"]`);
|
||||
if (!panel) return;
|
||||
const { openSheet } = await import('./sheet.js');
|
||||
const content = panel.cloneNode(true);
|
||||
content.hidden = false;
|
||||
openSheet({ title: button.textContent.trim(), content });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function profileTileHtml({ icon, label, attrs = '', iconMarkup = '' }) {
|
||||
return `<button type="button" class="pf-tile user-profile-action-btn" ${attrs}>${iconMarkup || iconHtml(icon)}<span>${esc(label)}</span></button>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user