From 897421e7c4fdcac8e4ccece10a2400449c02b8a2 Mon Sep 17 00:00:00 2001 From: h Date: Wed, 14 Oct 2026 03:28:29 +0200 Subject: [PATCH] fix(frontend): storage failures use the error colour next to the warning, shared mark on its own line in the list, trash key is visible --- .../lib/components/disk/SelectionBar.svelte | 10 ++++++++- .../lib/components/disk/StoragePanel.svelte | 22 ++++++++----------- .../src/lib/components/disk/TrashPanel.svelte | 18 ++++++++------- frontend/src/lib/styles/dark-theme.scss | 1 + frontend/src/lib/styles/variables.scss | 1 + 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/frontend/src/lib/components/disk/SelectionBar.svelte b/frontend/src/lib/components/disk/SelectionBar.svelte index ce11a2d..21b07fb 100644 --- a/frontend/src/lib/components/disk/SelectionBar.svelte +++ b/frontend/src/lib/components/disk/SelectionBar.svelte @@ -3,12 +3,13 @@ interface Props { children: Snippet; + failure?: string | null; note?: string; title: string; warn?: boolean; } - let { title, note, warn = false, children }: Props = $props(); + let { title, note, warn = false, failure, children }: Props = $props();
@@ -17,6 +18,9 @@ {#if note}
{note}
{/if} + {#if failure} +
{failure}
+ {/if}
{@render children()} @@ -63,5 +67,9 @@ &.warn { color: var(--color-storage-warning); } + + &.failed { + color: var(--color-error); + } } diff --git a/frontend/src/lib/components/disk/StoragePanel.svelte b/frontend/src/lib/components/disk/StoragePanel.svelte index 024c40e..0a82056 100644 --- a/frontend/src/lib/components/disk/StoragePanel.svelte +++ b/frontend/src/lib/components/disk/StoragePanel.svelte @@ -86,10 +86,6 @@ return chats.byId(chatId)?.title ?? `Чат ${chatId}`; } - function tail(file: StorageFile): string { - return file.refs > 1 ? messagesLabel(file.refs) : formatListDate(file.date); - } - async function loadSummary() { try { summary = await getStorageSummary(); @@ -324,6 +320,7 @@ fileName={file.file_name} kind={file.kind} mime={file.mime} + note={file.refs > 1 ? messagesLabel(file.refs) : undefined} onopen={() => open(index)} ontoggle={() => toggle(file.media_id)} refetchable={file.refetchable} @@ -331,7 +328,7 @@ size={file.file_size} src={mediaUrl(file.media_id)} sub={chatTitle(file.chat_id)} - tail={tail(file)} + tail={formatListDate(file.date)} weight={heaviest > 0 ? file.file_size / heaviest : 0} > {#snippet menu()} @@ -378,8 +375,8 @@ {#if chosen.length > 0} 0 ? `${chosenGone} не скачать заново` : undefined)} + failure={problem} + note={chosenGone > 0 ? `${chosenGone} не скачать заново` : undefined} title="{filesLabel(chosen.length)} · {formatBytes(chosenBytes)}" warn > @@ -399,10 +396,9 @@ {:else if undo} {:else if problem} - + {:else if problem && doomed === null} - +