feat(frontend): implement bulk tag editing for multi-file selection
- Add BulkTagEditor component: loads common/partial tags via POST /files/bulk/common-tags and applies changes via POST /files/bulk/tags - Common tags shown solid with × to remove from all files - Partial tags shown with dashed border and ~ indicator; clicking promotes to common (adds to files that are missing it) - Wire "Edit tags" button in SelectionBar to a bottom sheet with the editor - Add mock handlers for /files/bulk/common-tags and /files/bulk/tags Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,12 +12,16 @@
|
||||
import { fileSorting, type FileSortField } from '$lib/stores/sorting';
|
||||
import { selectionStore, selectionActive } from '$lib/stores/selection';
|
||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||
import BulkTagEditor from '$lib/components/file/BulkTagEditor.svelte';
|
||||
import { parseDslFilter } from '$lib/utils/dsl';
|
||||
import type { File, FileCursorPage, Pool, PoolOffsetPage } from '$lib/api/types';
|
||||
|
||||
let uploader = $state<{ open: () => void } | undefined>();
|
||||
let confirmDeleteFiles = $state(false);
|
||||
|
||||
// ---- Bulk tag editor ----
|
||||
let tagEditorOpen = $state(false);
|
||||
|
||||
// ---- Add to pool picker ----
|
||||
let poolPickerOpen = $state(false);
|
||||
let pools = $state<Pool[]>([]);
|
||||
@@ -268,12 +272,30 @@
|
||||
|
||||
{#if $selectionActive}
|
||||
<SelectionBar
|
||||
onEditTags={() => {/* TODO */}}
|
||||
onEditTags={() => (tagEditorOpen = true)}
|
||||
onAddToPool={openPoolPicker}
|
||||
onDelete={() => (confirmDeleteFiles = true)}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if tagEditorOpen}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<div class="picker-backdrop" role="presentation" onclick={() => (tagEditorOpen = false)}></div>
|
||||
<div class="picker-sheet tag-sheet" role="dialog" aria-label="Edit tags">
|
||||
<div class="picker-header">
|
||||
<span class="picker-title">Edit tags — {$selectionStore.ids.size} file{$selectionStore.ids.size !== 1 ? 's' : ''}</span>
|
||||
<button class="picker-close" onclick={() => (tagEditorOpen = false)} aria-label="Close">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="tag-sheet-body">
|
||||
<BulkTagEditor fileIds={[...$selectionStore.ids]} onDone={() => (tagEditorOpen = false)} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if poolPickerOpen}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<div class="picker-backdrop" role="presentation" onclick={() => (poolPickerOpen = false)}></div>
|
||||
@@ -378,6 +400,17 @@
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
/* ---- Tag editor sheet ---- */
|
||||
.tag-sheet {
|
||||
max-height: 80dvh;
|
||||
}
|
||||
|
||||
.tag-sheet-body {
|
||||
padding: 0 14px 16px;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* ---- Pool picker ---- */
|
||||
.picker-backdrop {
|
||||
position: fixed;
|
||||
|
||||
Reference in New Issue
Block a user