Display new notification count

This commit is contained in:
AidarKC
2026-09-02 19:20:04 +04:00
parent 0c5089fa79
commit aff601f61a
22 changed files with 475 additions and 260 deletions
+33
View File
@@ -2266,9 +2266,12 @@ export function render({ navigate, route, chrome }) {
leftAction: { label: '<', onClick: () => navigate('channels-list') },
rightActions: [
{ label: 'Оглавление', className: 'channel-header-entrypoint-btn', onClick: () => {} },
{ label: '⋯', className: 'channel-header-more-btn', onClick: () => {} },
],
});
header.classList.add('channel-view-topbar');
const channelEntrypointButton = header.querySelector('.header-actions .channel-header-entrypoint-btn');
const channelMoreButton = header.querySelector('.header-actions .channel-header-more-btn');
if (channelEntrypointButton) {
channelEntrypointButton.disabled = true;
channelEntrypointButton.hidden = true;
@@ -2544,6 +2547,36 @@ export function render({ navigate, route, chrome }) {
if (aboutRoute) navigate(aboutRoute);
};
}
if (channelMoreButton) {
channelMoreButton.disabled = false;
channelMoreButton.onclick = (event) => {
event.stopPropagation();
header.querySelector('.channel-header-more-menu')?.remove();
const menu = document.createElement('div');
menu.className = 'channel-header-more-menu';
const about = document.createElement('button'); about.type='button'; about.textContent='О канале';
about.onclick = () => {
const aboutRoute = makeShineChannelAboutRoute({ ownerBlockchainName: apiData?.channel?.ownerBlockchainName || apiData?.selector?.ownerBlockchainName || '', channelRootBlockNumber: apiData?.selector?.channelRootBlockNumber ?? '', channelRootBlockHash: apiData?.selector?.channelRootBlockHash ?? '' });
menu.remove(); if (aboutRoute) navigate(aboutRoute);
};
menu.append(about);
if (apiData?.isSubscribed && !apiData?.isOwnChannel) {
const unfollow = document.createElement('button'); unfollow.type='button'; unfollow.className='is-danger'; unfollow.textContent='Отписаться от канала';
unfollow.onclick = async () => {
menu.remove();
try {
const { login, storagePwd } = requireSigningSession();
await authService.addBlockFollowChannel({ login, storagePwd, targetBlockchainName: apiData.selector.ownerBlockchainName, targetBlockNumber: apiData.selector.channelRootBlockNumber, targetBlockHashHex: apiData.selector.channelRootBlockHash, unfollow: true });
const feed = await authService.listSubscriptionsFeed(login, 200); setChannelsFeed(feed, state.channelsIndex); showToast('Вы отписались от канала'); rerender();
} catch (error) { showStatus(toUserMessage(error, 'Не удалось отписаться от канала.')); }
};
menu.append(unfollow);
}
header.append(menu);
const close = (e) => { if (!menu.contains(e.target) && e.target !== channelMoreButton) { menu.remove(); document.removeEventListener('click', close, true); } };
setTimeout(() => document.addEventListener('click', close, true), 0);
};
}
if (channelEntrypointButton) {
const canShowEntrypointButton = !apiData?.isDiary && entrypointPosts.length > 0;
channelEntrypointButton.hidden = !canShowEntrypointButton;