Add Select all / Clear all to the review selection panel
Select all takes only events on screen; collapsed groups stay out so a bulk action can't hit unseen events. Clear all only clears the selection.
This commit is contained in:
1 parent
35fb032445
commit
a3693e69eb
1 file changed
+11
-1
@@ -26,6 +26,11 @@
|
||||
const fresh = $derived(live.filter((e) => e.include && !e.flags.length && (e.match === 'new' || !e.match)));
|
||||
const unchanged = $derived(live.filter((e) => e.include && !e.flags.length && e.match === 'unchanged'));
|
||||
const excluded = $derived(live.filter((e) => !e.include));
|
||||
// Select all takes only events on screen: collapsed groups stay out, so a bulk delete can't hit unseen events.
|
||||
const visibleIds = $derived([
|
||||
...needs, ...updated, ...fresh, ...(open.unchanged ? unchanged : []), ...(open.excluded ? excluded : []),
|
||||
].map((e) => e.id));
|
||||
const allSelected = $derived(visibleIds.length > 0 && visibleIds.every((id) => selected.includes(id)));
|
||||
const activeBox = $derived(scan.events.find((e) => e.id === active)?.cell_bbox ?? null);
|
||||
const months = $derived(
|
||||
monthsBetween(scan.date_start ?? `${scan.hint_month}-01`, scan.date_end ?? `${scan.hint_month}-01`),
|
||||
@@ -188,7 +193,12 @@
|
||||
|
||||
{#if selecting}
|
||||
<div class="card bulk stack">
|
||||
<p class="small">{selected.length} selected</p>
|
||||
<div class="row spread">
|
||||
<p class="small">{selected.length} selected</p>
|
||||
<button class="small" disabled={!visibleIds.length} onclick={() => (selected = allSelected ? [] : [...visibleIds])}>
|
||||
{allSelected ? 'Clear all' : 'Select all'}
|
||||
</button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="small" onclick={() => bulk({ delete: true }, 'Deleted')}>Delete</button>
|
||||
<button class="small" onclick={() => bulk({ changes: { include: false } }, 'Unchecked')}>Uncheck</button>
|
||||
|
||||
Reference in new issue
Block a user