diff --git a/frontend/src/lib/components/annotations/NotesPanel.svelte b/frontend/src/lib/components/annotations/NotesPanel.svelte index e14abb8..afbada3 100644 --- a/frontend/src/lib/components/annotations/NotesPanel.svelte +++ b/frontend/src/lib/components/annotations/NotesPanel.svelte @@ -115,7 +115,7 @@ } function chatTitle(note: Note): string { - return note.chat_title ?? t("chat.title", { id: note.chat_id }); + return note.chat_title ?? t("chat.fallbackTitle", { id: note.chat_id }); } function quote(note: Note): string { diff --git a/frontend/src/lib/i18n/messages.ts b/frontend/src/lib/i18n/messages.ts index 43044df..b230dc9 100644 --- a/frontend/src/lib/i18n/messages.ts +++ b/frontend/src/lib/i18n/messages.ts @@ -11,7 +11,6 @@ import { media } from "#lib/i18n/messages/media.js"; import { menu } from "#lib/i18n/messages/menu.js"; import { notes } from "#lib/i18n/messages/notes.js"; import { policy } from "#lib/i18n/messages/policy.js"; -import { panels } from "#lib/i18n/messages/panels.js"; import { profile } from "#lib/i18n/messages/profile.js"; import { read } from "#lib/i18n/messages/read.js"; import { search } from "#lib/i18n/messages/search.js"; @@ -38,7 +37,6 @@ export const messages = { ...menu, ...notes, ...policy, - ...panels, ...profile, ...read, ...search, diff --git a/frontend/src/lib/i18n/messages/chat.ts b/frontend/src/lib/i18n/messages/chat.ts index fca505f..4b14779 100644 --- a/frontend/src/lib/i18n/messages/chat.ts +++ b/frontend/src/lib/i18n/messages/chat.ts @@ -1,20 +1,6 @@ import type { Messages } from "#lib/i18n/types.js"; export const chat = { - "chat.analytics": { en: "Analytics", ru: "Аналитика" }, - "chat.back": { en: "Back to chats", ru: "Назад к чатам" }, - "chat.backfill": { - en: "Fetch new messages", - ru: "Догрузить новые сообщения", - }, - "chat.backfillDone": { - en: "New messages are on the way", - ru: "Новые сообщения уже догружаются", - }, - "chat.backfillFailed": { - en: "Could not start fetching", - ru: "Не удалось запустить догрузку", - }, "chat.calendar": { en: "Jump to date", ru: "Перейти к дате" }, "chat.calendar.count": { en: { one: "{count} message", other: "{count} messages" }, @@ -29,29 +15,11 @@ export const chat = { "chat.calendar.nextYear": { en: "Next year", ru: "Следующий год" }, "chat.calendar.prevMonth": { en: "Previous month", ru: "Предыдущий месяц" }, "chat.calendar.prevYear": { en: "Previous year", ru: "Предыдущий год" }, - "chat.channel": { en: "channel", ru: "канал" }, - "chat.deletedAccount": { en: "Deleted account", ru: "Удалённый аккаунт" }, "chat.deletedAt": { en: "deleted {when}", ru: "удалено {when}" }, "chat.deletedPreview": { en: "Deleted", ru: "Удалено" }, "chat.edited": { en: "edited", ru: "изменено" }, "chat.editedAt": { en: "Edited {when}", ru: "Изменено {when}" }, "chat.gap": { en: "archive was off {range}", ru: "архив не писал {range}" }, - "chat.group": { en: "group", ru: "группа" }, - "chat.latest": { en: "To the latest messages", ru: "К последним сообщениям" }, - "chat.links": { - en: { one: "{count} link", other: "{count} links" }, - ru: { - few: "{count} ссылки", - many: "{count} ссылок", - one: "{count} ссылка", - other: "{count} ссылки", - }, - }, - "chat.loadFailed": { - en: "Could not load messages", - ru: "Не удалось загрузить сообщения", - }, - "chat.media": { en: "Media", ru: "Медиа" }, "chat.media.download": { en: "Download {kind}", ru: "Скачать: {kind}" }, "chat.media.downloadFailed": { en: "Could not download the file", @@ -81,36 +49,8 @@ export const chat = { }, "chat.media.versions": { en: "Media versions", ru: "Версии медиа" }, "chat.media.video": { en: "Video", ru: "Видео" }, - "chat.menu.author": { en: "Author's profile", ru: "Профиль автора" }, - "chat.menu.callbacks": { en: "Callback data", ru: "Callback-данные" }, "chat.menu.copied": { en: "Copied", ru: "Скопировано" }, - "chat.menu.copyId": { en: "Copy ID", ru: "Копировать ID" }, "chat.menu.copyLink": { en: "Copy link", ru: "Копировать ссылку" }, - "chat.menu.copyText": { en: "Copy text", ru: "Копировать текст" }, "chat.menu.linkCopied": { en: "Link copied", ru: "Ссылка скопирована" }, - "chat.menu.links": { en: "Links", ru: "Ссылки" }, - "chat.menu.notes": { en: "Notes", ru: "Заметки" }, - "chat.menu.open": { en: "Open", ru: "Открыть" }, - "chat.menu.policy": { en: "Capture policy", ru: "Политика захвата" }, - "chat.menu.profile": { en: "Profile", ru: "Профиль" }, - "chat.menu.reactions": { en: "Reactions", ru: "Реакции" }, - "chat.menu.reply": { en: "Go to reply", ru: "Перейти к ответу" }, - "chat.menu.search": { en: "Search in chat", ru: "Поиск в чате" }, - "chat.menu.stories": { en: "Stories", ru: "Сторис" }, - "chat.menu.versions": { en: "Versions", ru: "Версии" }, - "chat.messages": { - en: { one: "{count} message", other: "{count} messages" }, - ru: { - few: "{count} сообщения", - many: "{count} сообщений", - one: "{count} сообщение", - other: "{count} сообщения", - }, - }, - "chat.noText": { en: "No text", ru: "Без текста" }, "chat.note": { en: "Note", ru: "Заметка" }, - "chat.openProfile": { en: "Open profile", ru: "Открыть профиль" }, - "chat.title": { en: "Chat {id}", ru: "Чат {id}" }, - "chat.you": { en: "You", ru: "Вы" }, - "chat.youPrefix": { en: "You: ", ru: "Вы: " }, } satisfies Messages; diff --git a/frontend/src/lib/i18n/messages/panels.ts b/frontend/src/lib/i18n/messages/panels.ts deleted file mode 100644 index 237352e..0000000 --- a/frontend/src/lib/i18n/messages/panels.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Messages } from "#lib/i18n/types.js"; - -export const panels = { - "panels.callbacks": { en: "Callback data", ru: "Callback-данные" }, - "panels.links": { en: "Links", ru: "Ссылки" }, - "panels.presence": { en: "Analytics", ru: "Аналитика" }, - "panels.profile": { en: "Profile", ru: "Профиль" }, - "panels.reactions": { en: "Reactions", ru: "Реакции" }, - "panels.search": { en: "Search", ru: "Поиск" }, - "panels.storageChat": { en: "Chat files", ru: "Файлы чата" }, - "panels.stories": { en: "Stories", ru: "Сторис" }, - "panels.storiesAll": { en: "All stories", ru: "Все сторис" }, - "panels.trash": { en: "Trash", ru: "Корзина" }, -} satisfies Messages; diff --git a/frontend/src/routes/app/+layout.svelte b/frontend/src/routes/app/+layout.svelte index c205058..e305399 100644 --- a/frontend/src/routes/app/+layout.svelte +++ b/frontend/src/routes/app/+layout.svelte @@ -50,7 +50,8 @@ capture.track(auth.token === null ? null : accounts.selectedId); }); - let carrying = false; + let carrying: object | null = null; + let moving = false; let seenPanel: PanelState | null = null; $effect(() => { @@ -58,7 +59,7 @@ untrack(() => { const changed = JSON.stringify(next) !== JSON.stringify(seenPanel); seenPanel = next; - if (changed && !carrying) { + if (changed && carrying === null) { ui.restore(next); } }); @@ -68,9 +69,13 @@ if (navigation.shallow || navigation.type === "popstate") { return; } - carrying = ui.rightPanel !== null; + const token = {}; + carrying = ui.rightPanel === null ? null : token; + moving ||= navigation.to?.url.pathname !== page.url.pathname; navigation.complete.catch(() => { - carrying = false; + if (carrying === token) { + carrying = null; + } }); }); @@ -83,16 +88,19 @@ return; } ui.setChat(page.params.chatId ? Number(page.params.chatId) : null); - const from = navigation.from?.url?.pathname; - const moved = Boolean(from) && from !== navigation.to?.url?.pathname; + const moved = moving; + moving = false; if (moved) { ui.markInApp(); } - if (carrying) { + const token = carrying; + if (token !== null) { ui.record(!moved); } ui.settled().then(() => { - carrying = false; + if (carrying === token) { + carrying = null; + } }); });