SHA256
Обновить учёт поддержки, лайки и профиль перед MVP
This commit is contained in:
@@ -8,6 +8,7 @@ import { openBlockchainDetailsModal } from '../components/blockchain-details-dia
|
||||
import { confirmLikeAction, showLikeStatistics } from '../components/like-action-sheet.js';
|
||||
import { publicLikeCount, hasLikeStatistics } from '../services/public-like-count.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { loadUserProfileCard } from '../services/user-connections.js';
|
||||
import { consumeReplyEditorOnOpen, rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { attachMessageMenu } from '../components/message-menu.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
@@ -802,6 +803,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
|
||||
likeButton.className = 'ui-button channel-action-item channel-action-like thread-like-btn';
|
||||
if (isLiked) likeButton.classList.add('is-liked');
|
||||
likeButton.innerHTML = `
|
||||
${handlers.viewerShining ? `<span class="channel-action-counter">${Number(node?.shiningLikesCount || 0)}</span>` : ''}
|
||||
<span class="channel-action-icon" aria-hidden="true">${iconHtml('heart', isLiked)}</span>
|
||||
<span class="channel-action-label">${isPending ? t('screens.channel_thread_view.text_062') : t('screens.channel_thread_view.text_063')}</span>
|
||||
`;
|
||||
@@ -1168,7 +1170,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
|
||||
const like = document.createElement('button');
|
||||
like.type = 'button';
|
||||
like.className = `channel-action-item thread-comment__like${liked ? ' is-liked' : ''}`;
|
||||
like.innerHTML = `${iconHtml('heart', liked)}`;
|
||||
like.innerHTML = `${handlers.viewerShining ? `<span class="channel-action-counter">${Number(node?.shiningLikesCount || 0)}</span>` : ''}${iconHtml('heart', liked)}`;
|
||||
like.setAttribute('aria-pressed', String(liked));
|
||||
like.setAttribute('aria-label', `${liked ? t('dialogs.modals.channel_thread_view.label_026') : t('screens.channel_thread_view.text_067')}, ${likes}`);
|
||||
like.addEventListener('click', async () => {
|
||||
@@ -1571,6 +1573,7 @@ export function prefetchThreadPage(path) {
|
||||
}
|
||||
|
||||
export function render({ navigate, route, chrome }) {
|
||||
let viewerShining = false;
|
||||
let selector = parseThreadSelector(route);
|
||||
const channelDisplayName = resolveChannelDisplayName(selector?.channel);
|
||||
const routeKey = selector?.publicationOrdinal
|
||||
@@ -1653,6 +1656,7 @@ export function render({ navigate, route, chrome }) {
|
||||
// Пришли по «Обсуждение» из ленты – после первой загрузки сразу открыть редактор ответа.
|
||||
let openEditorOnLoad = consumeReplyEditorOnOpen(window.location.pathname);
|
||||
const handlers = {
|
||||
get viewerShining() { return viewerShining; },
|
||||
onSupport: (node, target) => {
|
||||
const rootNumber = selector?.channel?.channelRootBlockNumber;
|
||||
const rootHash = String(selector?.channel?.channelRootBlockHash || '').trim();
|
||||
@@ -2238,5 +2242,10 @@ export function render({ navigate, route, chrome }) {
|
||||
};
|
||||
|
||||
void refresh();
|
||||
if (state.session.login) void loadUserProfileCard(state.session.login).then((profile) => {
|
||||
if (disposed) return;
|
||||
viewerShining = profile?.shineStatus === 'shining';
|
||||
if (viewerShining) void refresh();
|
||||
}).catch(() => {});
|
||||
return screen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user