SHA256
Обновить учёт поддержки, лайки и профиль перед MVP
This commit is contained in:
@@ -9,6 +9,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 { createOverflowDots } from '../components/overflow-dots.js';
|
||||
import { rememberChannelPosition, readChannelPosition, requestReplyEditorOnOpen, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { getPreviousTrackedPath, navigateUp, parseRouteFromPath, toPrettyPath } from '../router.js';
|
||||
@@ -1784,6 +1785,7 @@ function openMessageLikesListModal({ navigate, messageRef, initialTab = 'shining
|
||||
function renderPostCard(post, {
|
||||
navigate,
|
||||
selector,
|
||||
viewerShining = false,
|
||||
onToggleLike,
|
||||
onReply,
|
||||
onRating,
|
||||
@@ -1997,6 +1999,7 @@ function renderPostCard(post, {
|
||||
const isLiked = post.reactionState === 'liked';
|
||||
if (isLiked) likeButton.classList.add('is-liked');
|
||||
likeButton.innerHTML = `
|
||||
${viewerShining ? `<span class="channel-action-counter">${Number(post.shiningLikesCount || 0)}</span>` : ''}
|
||||
<span class="channel-action-icon" aria-hidden="true">${iconHtml('heart', isLiked)}</span>
|
||||
<span class="channel-action-label">${isPending ? t('screens.channel_view.text_096') : t('screens.channel_view.text_097')}</span>
|
||||
`;
|
||||
@@ -2140,7 +2143,7 @@ function renderPostCard(post, {
|
||||
const supportButton = document.createElement('button');
|
||||
supportButton.type = 'button';
|
||||
supportButton.className = 'ui-button channel-action-item channel-action-support';
|
||||
supportButton.textContent = '♥ SOL';
|
||||
supportButton.textContent = '⭐';
|
||||
supportButton.title = t('screens.support_phase2.donate');
|
||||
// Проверенные сервером суммы; если индексатор не готов, число не показываем.
|
||||
if (post.messageRef?.blockNumber != null && post.messageRef?.blockHash) {
|
||||
@@ -2148,7 +2151,7 @@ function renderPostCard(post, {
|
||||
void loadVerifiedSupportTotals(selector).then((totals) => {
|
||||
if (!totals || !supportButton.isConnected) return;
|
||||
const formatted = formatVerifiedSupportStars(totals.messages.get(messageId));
|
||||
if (formatted) supportButton.textContent = `♥ ${formatted}`;
|
||||
if (formatted) supportButton.textContent = formatted;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2363,6 +2366,7 @@ function renderBody(screen, navigate, routeKey, channelData, handlers) {
|
||||
}
|
||||
const row = renderPostCard(item.post, {
|
||||
navigate,
|
||||
viewerShining: handlers.viewerShining,
|
||||
selector: channelData.selector,
|
||||
onToggleLike: handlers.onToggleLike,
|
||||
onReply: handlers.onReply,
|
||||
@@ -2547,6 +2551,7 @@ function renderSkeleton(screen) {
|
||||
}
|
||||
|
||||
export function render({ navigate, route, chrome }) {
|
||||
let viewerShining = false;
|
||||
const channelId = route.params.channelId || '';
|
||||
const scrollToMessageOrdinal = route.params.scrollToMessageOrdinal || '';
|
||||
const routeSelector = buildSelectorFromRoute(route, channelId);
|
||||
@@ -3068,6 +3073,7 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
clearContent();
|
||||
const stopSeenTracking = renderBody(screen, navigate, routeKey, apiData, {
|
||||
viewerShining,
|
||||
chrome,
|
||||
restorePosition,
|
||||
scrollToMessageOrdinal,
|
||||
@@ -3247,5 +3253,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