fix(frontend): shared mark on its own line in trash rows, undo ignores the trailing click, trash segment has a key

This commit is contained in:
hh committed 2026-10-14 03:23:22 +02:00
1 parent 580927da0a
commit c9c088ed73
3 files changed
+29 -5

No files matched your search

@@ -37,6 +37,7 @@
const PAGE = 30;
const UNDO_MS = 12_000;
const UNDO_GUARD_MS = 600;
let summary = $state<StorageSummary | null>(null);
let files = $state<StorageFile[]>([]);
@@ -54,6 +55,7 @@
const selected = new SvelteSet<number>();
let token = 0;
let undoTimer: ReturnType<typeof setTimeout> | undefined;
let undoShownAt = 0;
const heaviest = $derived(files[0]?.file_size ?? 0);
const chosen = $derived(files.filter((file) => selected.has(file.media_id)));
@@ -151,6 +153,7 @@
hideUndo();
if (outcome.files > 0) {
undo = { files: trashed, outcome };
undoShownAt = Date.now();
undoTimer = setTimeout(hideUndo, UNDO_MS);
}
}
@@ -185,7 +188,7 @@
}
async function restoreLast() {
if (undo === null) {
if (undo === null || Date.now() - undoShownAt < UNDO_GUARD_MS) {
return;
}
const restored = undo;
@@ -290,9 +293,13 @@
<Icon name="delete" size="1.375rem" />
<span class="label">Корзина</span>
<span class="value">
{summary.trash_files > 0
? `${filesLabel(summary.trash_files)} · ${formatBytes(summary.trash_bytes)}`
: "пусто"}
{#if summary.trash_files > 0}
<span class="swatch"></span>
{filesLabel(summary.trash_files)}
· {formatBytes(summary.trash_bytes)}
{:else}
пусто
{/if}
</span>
<Icon name="next" size="1.125rem" />
</button>
@@ -581,10 +588,21 @@
}
.value {
display: flex;
gap: 0.375rem;
align-items: center;
font-size: 0.8125rem;
font-variant-numeric: tabular-nums;
}
.swatch {
width: 0.5rem;
height: 0.5rem;
border-radius: 50%;
background-color: rgba(var(--color-text-secondary-rgb), 0.35);
}
&:focus-visible {
outline: 2px solid var(--color-primary);
outline-offset: -2px;