Слить main с актуальными UI-изменениями

This commit is contained in:
2026-08-22 16:36:47 +03:00
10 changed files with 306 additions and 52 deletions
+6 -19
View File
@@ -1217,7 +1217,6 @@ 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';
@@ -1228,7 +1227,10 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed
const count = document.createElement('span');
count.className = 'unread channel-row-count';
const unreadCount = Number(channel.unreadCount || 0);
count.textContent = unreadCount > 0 ? String(unreadCount) : '';
if (unreadCount > 0) {
count.textContent = unreadCount > 99 ? '99+' : String(unreadCount);
controls.append(count);
}
count.classList.toggle('is-empty', unreadCount <= 0);
if (!isGuest) {
@@ -1259,7 +1261,7 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed
});
controls.append(menuButton);
}
controls.append(time, count);
controls.append(time);
row.append(avatar, main, controls);
row.addEventListener('click', () => {
@@ -1276,14 +1278,6 @@ 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);
@@ -1397,9 +1391,6 @@ 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 = () => {
@@ -1418,19 +1409,15 @@ 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, bottomCta);
screen.append(contentEl);
if (createSuccessFlash) {
showToast(createSuccessFlash);
}
updateBottomCta({ button: bottomCta });
// Применяем корректное состояние хедера сразу на первом рендере,
// чтобы не показывать лишние кнопки до первой перерисовки.
rerenderList();