feat(ui): "Reject rest" per suggestion category — confirm the good, reject the rest

Each category section header gets a subtle "Reject rest" action that dismisses
every still-unhandled suggestion in it at once (store.dismissRemaining, parallel
dispatch). Canonical tags persist a rejection and stay flagged (reversible,
one-click un-reject); raw creates-new-tag rows drop client-side. Shows only when
the section has unhandled items. No confirm dialog — it's fully reversible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
2026-07-06 18:42:08 -04:00
parent 2d44a26bdf
commit 6684907577
3 changed files with 83 additions and 15 deletions
+25 -2
View File
@@ -218,6 +218,29 @@ export const useSuggestionsStore = defineStore('suggestions', () => {
}
}
// Reject every still-unhandled suggestion in a category in one go ("confirm
// the good ones, reject the rest" — operator-asked 2026-07-06). Canonical tags
// persist a rejection and STAY flagged rejected (reversible, one-click
// un-reject); raw creates-new-tag rows drop client-side. Dispatched in parallel
// so a big section clears fast.
async function dismissRemaining(category) {
const imageId = currentImageId
if (imageId == null) return
const targets = (byCategory.value[category] || []).filter((s) => !s.rejected)
if (!targets.length) return
const canon = targets.filter((s) => s.canonical_tag_id != null)
const raw = targets.filter((s) => s.canonical_tag_id == null)
await Promise.all(canon.map((s) =>
api.post(`/api/images/${imageId}/suggestions/dismiss`, {
body: { tag_id: s.canonical_tag_id },
})
))
if (currentImageId === imageId) {
canon.forEach((s) => _setRejectedEverywhere(s, true))
raw.forEach((s) => _dropEverywhere(s))
}
}
// Undo a per-image dismissal — the suggestion reverts to a live row.
async function undismiss(suggestion) {
const imageId = currentImageId
@@ -232,7 +255,7 @@ export const useSuggestionsStore = defineStore('suggestions', () => {
return {
byCategory, allByCategory, loading, error,
load, loadAll, accept, aliasAccept, removeAlias, dismiss, undismiss,
findPending
load, loadAll, accept, aliasAccept, removeAlias, dismiss, dismissRemaining,
undismiss, findPending
}
})