Обновить кошельки и мелкие детали UI

This commit is contained in:
AidarKC
2026-11-09 09:59:11 +03:00
parent 34f7faf0a8
commit 526941eb33
29 changed files with 469 additions and 201 deletions
+22 -6
View File
@@ -1,6 +1,6 @@
import { appendShineMessageLinks } from '../services/shine-message-links.js';
import { confirmDialog } from '../components/confirm-dialog.js';
import { confirmLikeAction } from '../components/like-action-sheet.js';
import { confirmLikeAction, showLikeStatistics } from '../components/like-action-sheet.js';
import { iconHtml } from '../components/ui-icon.js';
import { consumeReplyEditorOnOpen, rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
import { attachMessageMenu } from '../components/message-menu.js';
@@ -839,7 +839,6 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
likeButton.innerHTML = `
<span class="channel-action-icon" aria-hidden="true">${iconHtml('heart', isLiked)}</span>
<span class="channel-action-label">${isPending ? 'Лайк...' : 'Лайк'}</span>
<span class="channel-action-counter">${Number(likes) > 0 ? likes : ''}</span>
`;
likeButton.setAttribute('aria-pressed', String(isLiked));
setActionTitle(likeButton, isPending ? 'Лайк…' : `${isLiked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${likes}`);
@@ -864,6 +863,16 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
}
});
const likesStatsButton = document.createElement('button');
likesStatsButton.type = 'button';
likesStatsButton.className = 'ui-button channel-action-item channel-action-like-stats';
likesStatsButton.textContent = String(Number(likes) || '');
likesStatsButton.setAttribute('aria-label', `Посмотреть статистику лайков: ${likes}`);
likesStatsButton.addEventListener('click', (event) => {
event.stopPropagation();
void showLikeStatistics({ counts: node });
});
const replyButton = document.createElement('button');
replyButton.type = 'button';
replyButton.className = 'ui-button channel-action-item thread-reply-btn';
@@ -941,8 +950,8 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
if (!REPOSTS_ENABLED) { notifyRepostSoon(); return; }
void handlers.onRepost?.(target);
});
if (threadsLayout) actions.append(likeButton, discussionButton, repostButton, shareButton);
else actions.append(likeButton, shareButton, discussionButton);
if (threadsLayout) actions.append(likeButton, ...(likes > 0 ? [likesStatsButton] : []), discussionButton, repostButton, shareButton);
else actions.append(likeButton, ...(likes > 0 ? [likesStatsButton] : []), shareButton, discussionButton);
menuItems.unshift({ label: 'Ответить', iconHtml: iconHtml('reply'), action: () => replyButton.click() });
// Те же действия, что у ответов в обсуждении.
menuItems.splice(1, 0, { label: 'Скопировать текст', iconHtml: iconHtml('copy'), action: async () => {
@@ -1171,7 +1180,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)}<span>${likes || ''}</span>`;
like.innerHTML = `${iconHtml('heart', liked)}`;
like.setAttribute('aria-pressed', String(liked));
like.setAttribute('aria-label', `${liked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${likes}`);
like.addEventListener('click', async () => {
@@ -1181,6 +1190,13 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
finally { if (like.isConnected) like.disabled = false; }
});
const commentLikeStats = document.createElement('button');
commentLikeStats.type = 'button';
commentLikeStats.className = 'channel-action-item thread-comment__like-count';
commentLikeStats.textContent = String(likes || '');
commentLikeStats.setAttribute('aria-label', `Статистика лайков: ${likes}`);
commentLikeStats.addEventListener('click', () => { void showLikeStatistics({ counts: node }); });
const replies = replyCountOf(node);
const reply = document.createElement('button');
reply.type = 'button';
@@ -1238,7 +1254,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
repost.addEventListener('click', () => (REPOSTS_ENABLED ? handlers.onRepost?.(target) : notifyRepostSoon()));
// Ряд действий как у записи канала: лайк, ответы, репост, поделиться.
actions.append(like, reply, repost, share);
actions.append(like, ...(likes > 0 ? [commentLikeStats] : []), reply, repost, share);
main.append(actions);
item.append(who, main);
// Как в Threads: нажатие на ответ открывает его обсуждение (кнопки, ссылки и вложения работают сами по себе).