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} - +