feat(frontend): storage shows the heaviest chats, a chat opens its own files with selective cleanup and a whole-chat move to trash

This commit is contained in:
hh committed 2026-10-14 05:02:06 +02:00
1 parent 5eacabd101
commit 7f124059be
9 files changed
+671 -232

No files matched your search

+25 -1
View File
@@ -19,7 +19,9 @@
import Icon from "#lib/components/ui/Icon.svelte";
import WatchesPanel from "#lib/components/watches/WatchesPanel.svelte";
import { accounts } from "#lib/stores/accounts.svelte.js";
import { chats } from "#lib/stores/chats.svelte.js";
import { policyUi } from "#lib/stores/policy.svelte.js";
import { storageUi } from "#lib/stores/storage.svelte.js";
import { type RightPanel, ui } from "#lib/stores/ui.svelte.js";
const titles: Record<RightPanel, string> = {
@@ -36,6 +38,7 @@
search: "Поиск",
shares: "Файлы по ссылке",
storage: "Хранилище",
"storage-chat": "Файлы чата",
"storage-trash": "Корзина",
stories: "Сторис",
"stories-all": "Все сторис",
@@ -44,10 +47,21 @@
};
const parents: Partial<Record<RightPanel, RightPanel>> = {
"storage-chat": "storage",
"storage-trash": "storage",
};
const parent = $derived(ui.rightPanel ? parents[ui.rightPanel] : undefined);
const title = $derived.by(() => {
if (ui.rightPanel === null) {
return "";
}
const chat =
ui.rightPanel === "storage-chat" && storageUi.chatId !== null
? chats.byId(storageUi.chatId)
: undefined;
return chat?.title ?? titles[ui.rightPanel];
});
</script>
<header class="right-header">
@@ -72,7 +86,7 @@
<Icon name="close" />
</Button>
{/if}
<h2>{ui.rightPanel ? titles[ui.rightPanel] : ""}</h2>
<h2>{title}</h2>
</header>
<div class="right-body custom-scroll">
@@ -112,6 +126,10 @@
{#key accounts.selectedId}
<StoragePanel />
{/key}
{:else if ui.rightPanel === "storage-chat"}
{#key `${accounts.selectedId}:${storageUi.chatId}`}
<StoragePanel chatId={storageUi.chatId} />
{/key}
{:else if ui.rightPanel === "storage-trash"}
{#key accounts.selectedId}
<TrashPanel />
@@ -131,9 +149,15 @@
border-bottom: 1px solid var(--color-borders);
h2 {
overflow: hidden;
min-width: 0;
margin: 0;
font-size: 1.25rem;
font-weight: var(--font-weight-medium);
text-overflow: ellipsis;
white-space: nowrap;
}
}