Shorten public UI routes

This commit is contained in:
AidarKC
2026-07-22 14:12:10 +04:00
parent 93673e5786
commit d24d1c178b
9 changed files with 220 additions and 32 deletions
+1 -1
View File
@@ -878,7 +878,7 @@ export function render({ navigate, route }) {
const login = state.session.login;
const storagePwd = state.session.storagePwdInMemory;
if (!login || !storagePwd) {
state.authReturnHash = window.location.pathname || '/channels-list';
state.authReturnHash = window.location.pathname || '/channels';
navigate('login-view');
throw new Error('Для этого действия нужно войти');
}
+1 -1
View File
@@ -1200,7 +1200,7 @@ export function render({ navigate, route }) {
const login = state.session.login;
const storagePwd = state.session.storagePwdInMemory;
if (!login || !storagePwd) {
state.authReturnHash = window.location.pathname || '/channels-list';
state.authReturnHash = window.location.pathname || '/channels';
navigate('login-view');
throw new Error('Для этого действия нужно войти');
}
+1 -1
View File
@@ -1197,7 +1197,7 @@ export function render({ navigate, route }) {
const rerenderList = () => {
try {
const expectedPath = '/channels-list';
const expectedPath = '/channels';
if (window.location.pathname !== expectedPath) {
window.history.replaceState({}, '', expectedPath);
}
+1 -1
View File
@@ -185,7 +185,7 @@ function openDeveloperAvatarUploadModal({ walletLogin, storagePwd, gateway } = {
async function forceUiUpdateNow() {
try {
window.history.replaceState({}, '', '/settings-view');
window.history.replaceState({}, '', '/settings');
window.dispatchEvent(new PopStateEvent('popstate'));
} catch {}
if (!('serviceWorker' in navigator)) {
+1 -1
View File
@@ -142,7 +142,7 @@ export function render({ navigate }) {
if (previewEl) previewEl.textContent = resolveLastMessagePreview(item.lastMessage) || 'Диалог пока пуст.';
if (timeEl) timeEl.textContent = String(item.time || '');
row.prepend(avatarWrap);
row.addEventListener('click', () => navigate(`chat-view/${encodeURIComponent(normalizeDmChatId(item.id))}`));
row.addEventListener('click', () => navigate(`chat/${encodeURIComponent(normalizeDmChatId(item.id))}`));
return row;
}
+2 -2
View File
@@ -430,7 +430,7 @@ export function render({ navigate, route }) {
const act = btn.dataset.act;
if (act === 'close') hideNodeSheet();
else if (act === 'profile') { const r = profileInfoRoute(login); if (r) navigate(r); }
else if (act === 'write') navigate(`chat-view/${encodeURIComponent(login)}`);
else if (act === 'write') navigate(`chat/${encodeURIComponent(login)}`);
};
}
@@ -462,7 +462,7 @@ export function render({ navigate, route }) {
point,
actions: [
{ label: 'Профиль', onClick: () => { const r = profileInfoRoute(login); if (r) navigate(r); } },
{ label: 'Написать', onClick: () => navigate(`chat-view/${encodeURIComponent(login)}`) },
{ label: 'Написать', onClick: () => navigate(`chat/${encodeURIComponent(login)}`) },
],
});
},