feat(frontend): add selected pool files to another pool
The pool view's selection bar could only remove files from the current pool. Add an "Add to pool" action beside it that opens the existing file picker with the selected files (in selection order), so a multi-select can be copied into another pool in one step. On success the picker closes and the selection clears. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import FileCard from '$lib/components/file/FileCard.svelte';
|
||||
import FileViewer from '$lib/components/file/FileViewer.svelte';
|
||||
import FilterBar from '$lib/components/file/FilterBar.svelte';
|
||||
import PoolPicker from '$lib/components/file/PoolPicker.svelte';
|
||||
import InfiniteScroll from '$lib/components/common/InfiniteScroll.svelte';
|
||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||
import { parseDslFilter } from '$lib/utils/dsl';
|
||||
@@ -48,6 +49,7 @@
|
||||
let selectionMode = $derived(selectedIds.size > 0);
|
||||
let lastSelectedIdx = $state<number | null>(null);
|
||||
let confirmRemove = $state(false);
|
||||
let poolPickerOpen = $state(false);
|
||||
|
||||
// ---- Add files mode ----
|
||||
let addMode = $state(false);
|
||||
@@ -705,12 +707,28 @@
|
||||
</svg>
|
||||
</button>
|
||||
<div class="sel-spacer"></div>
|
||||
<button class="sel-action add-action" onclick={() => (poolPickerOpen = true)}>
|
||||
Add to pool
|
||||
</button>
|
||||
<button class="sel-action remove-action" onclick={() => (confirmRemove = true)}>
|
||||
Remove from pool
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Add the selected files to another pool (reuses the file picker; the order
|
||||
follows the selection's insertion order). -->
|
||||
{#if poolPickerOpen}
|
||||
<PoolPicker
|
||||
fileIds={[...selectedIds]}
|
||||
onAdded={() => {
|
||||
selectedIds = new Set();
|
||||
lastSelectedIdx = null;
|
||||
}}
|
||||
onClose={() => (poolPickerOpen = false)}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if confirmDelete}
|
||||
<ConfirmDialog
|
||||
message={`Delete pool "${name}"? The files themselves will not be deleted.`}
|
||||
@@ -1169,6 +1187,13 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.add-action {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
.add-action:hover {
|
||||
background-color: color-mix(in srgb, var(--color-accent) 15%, transparent);
|
||||
}
|
||||
|
||||
.remove-action {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user