SHA256
UI/Channels: вкладки по тапу + CreateChannel fallback для legacy формата
This commit is contained in:
@@ -1089,6 +1089,26 @@ export function render({ navigate, route }) {
|
||||
const contentEl = document.createElement('div');
|
||||
contentEl.className = 'channels-list-content';
|
||||
|
||||
const tabsEl = document.createElement('div');
|
||||
tabsEl.className = 'channels-tabs';
|
||||
const tabLabels = {
|
||||
feed: 'Каналы',
|
||||
dialogs: 'Чаты',
|
||||
my: 'Мои',
|
||||
};
|
||||
TAB_ORDER.forEach((tabKey) => {
|
||||
const tabBtn = document.createElement('button');
|
||||
tabBtn.type = 'button';
|
||||
tabBtn.className = `channels-tab-btn${listState.activeTab === tabKey ? ' is-active' : ''}`;
|
||||
tabBtn.textContent = tabLabels[tabKey] || tabKey;
|
||||
tabBtn.addEventListener('click', () => {
|
||||
if (listState.activeTab === tabKey) return;
|
||||
listState.activeTab = tabKey;
|
||||
rerenderList();
|
||||
});
|
||||
tabsEl.append(tabBtn);
|
||||
});
|
||||
|
||||
const bottomCta = document.createElement('button');
|
||||
bottomCta.type = 'button';
|
||||
|
||||
@@ -1123,6 +1143,10 @@ export function render({ navigate, route }) {
|
||||
onReload: reloadFeed,
|
||||
isTabEmpty,
|
||||
});
|
||||
tabsEl.querySelectorAll('.channels-tab-btn').forEach((btn, idx) => {
|
||||
const key = TAB_ORDER[idx];
|
||||
btn.classList.toggle('is-active', key === listState.activeTab);
|
||||
});
|
||||
};
|
||||
|
||||
let touchStartX = 0;
|
||||
@@ -1146,7 +1170,7 @@ export function render({ navigate, route }) {
|
||||
rerenderList();
|
||||
}, { passive: true });
|
||||
|
||||
screen.append(contentEl, bottomCta);
|
||||
screen.append(tabsEl, contentEl, bottomCta);
|
||||
|
||||
if (createSuccessFlash) {
|
||||
showToast(createSuccessFlash);
|
||||
|
||||
Reference in New Issue
Block a user