diff --git a/shine-UI/js/pages/channels-list.js b/shine-UI/js/pages/channels-list.js index 63081b73..b2d3723f 100644 --- a/shine-UI/js/pages/channels-list.js +++ b/shine-UI/js/pages/channels-list.js @@ -1217,6 +1217,7 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed const main = renderChannelMain(channel); + const isGuest = !state.session.isAuthorized; const controls = document.createElement('div'); controls.className = 'channel-row-controls'; @@ -1227,10 +1228,7 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed const count = document.createElement('span'); count.className = 'unread channel-row-count'; const unreadCount = Number(channel.unreadCount || 0); - if (unreadCount > 0) { - count.textContent = unreadCount > 99 ? '99+' : String(unreadCount); - controls.append(count); - } + count.textContent = unreadCount > 0 ? String(unreadCount) : ''; count.classList.toggle('is-empty', unreadCount <= 0); if (!isGuest) { @@ -1261,7 +1259,7 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed }); controls.append(menuButton); } - controls.append(time); + controls.append(time, count); row.append(avatar, main, controls); row.addEventListener('click', () => { @@ -1278,6 +1276,14 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed container.append(list); } +function updateBottomCta({ button }) { + if (!button) return; + button.hidden = true; + button.textContent = ''; + button.className = 'channels-bottom-action'; + button.onclick = null; +} + async function loadFeedAndRender({ screen, listState, contentEl, navigate }) { closeChannelMenu(listState); renderSkeletonList(contentEl, 5); @@ -1391,6 +1397,9 @@ export function render({ navigate, route, chrome }) { topBarRight.append(topMenuBtn); topBarEl.append(topBarLeft, topTitle, topBarRight); + const bottomCta = document.createElement('button'); + bottomCta.type = 'button'; + const reloadFeed = async () => loadFeedAndRender({ screen, listState, contentEl, navigate }); const rerenderList = () => { @@ -1409,15 +1418,19 @@ export function render({ navigate, route, chrome }) { topTitle.textContent = channelsViewTitle(listState.viewMode); topMenuBtn.style.display = ''; if (topTitle.parentElement !== topBarEl) topBarEl.insertBefore(topTitle, topBarRight); + + updateBottomCta({ button: bottomCta }); }; chrome?.setTopbar(topBarEl); - screen.append(contentEl); + screen.append(contentEl, bottomCta); if (createSuccessFlash) { showToast(createSuccessFlash); } + updateBottomCta({ button: bottomCta }); + // Применяем корректное состояние хедера сразу на первом рендере, // чтобы не показывать лишние кнопки до первой перерисовки. rerenderList();