Исправить отображение и учёт поддержки сообщений

This commit is contained in:
AidarKC
2026-12-02 02:13:01 +03:00
parent 7cf0170de7
commit a9fa1cd2a2
11 changed files with 110 additions and 63 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
import { openShineSupportDialog } from '../components/shine-support-dialog.js';
import { hexHash32 } from '../services/shine-support-amount.js';
import { formatStars, hexHash32 } from '../services/shine-support-amount.js';
import { formatDateTime } from '../i18n/format.js';
import { t, th } from '../i18n/index.js';
import { appendShineMessageLinks } from '../services/shine-message-links.js';
@@ -803,7 +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>` : ''}
${handlers.viewerShining && Number(node?.shiningLikesCount || 0) > 0 ? `<span class="channel-action-counter">${Number(node.shiningLikesCount)}</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>
`;
@@ -922,7 +922,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
const supportBtn = document.createElement('button');
supportBtn.type = 'button';
supportBtn.className = 'ui-button channel-action-item channel-action-support';
supportBtn.textContent = '♥ SOL';
supportBtn.textContent = formatStars(node?.supportStarCents || '0');
supportBtn.title = t('screens.support_phase2.donate');
supportBtn.addEventListener('click', (event) => { event.stopPropagation(); handlers.onSupport?.(node, target); });
@@ -1170,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 = `${handlers.viewerShining ? `<span class="channel-action-counter">${Number(node?.shiningLikesCount || 0)}</span>` : ''}${iconHtml('heart', liked)}`;
like.innerHTML = `${handlers.viewerShining && Number(node?.shiningLikesCount || 0) > 0 ? `<span class="channel-action-counter">${Number(node.shiningLikesCount)}</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 () => {
@@ -1248,7 +1248,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
const supportBtn = document.createElement('button');
supportBtn.type = 'button';
supportBtn.className = 'channel-action-item thread-comment__support';
supportBtn.textContent = '♥ SOL';
supportBtn.textContent = formatStars(node?.supportStarCents || '0');
supportBtn.title = t('screens.support_phase2.donate');
supportBtn.addEventListener('click', (event) => { event.stopPropagation(); handlers.onSupport?.(node, target); });
actions.append(supportBtn);