fix(ui): sélection groupée dans la boîte de réception
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 7m17s
CI / Deploy production (on server) (push) Successful in 24s

Permet de cocher plusieurs notes, les déplacer vers un carnet ou les envoyer à la corbeille, et rend la carte mentale plus lisible.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-09-01 19:40:10 +00:00
parent 4fc5e3ce04
commit a7b16870a4
15 changed files with 509 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
'use client'
import { toast } from 'sonner'
import { restoreNote } from '@/app/actions/notes'
import { restoreNote, restoreNotes } from '@/app/actions/notes'
import { emitNoteChange } from '@/lib/note-change-sync'
import type { Note } from '@/lib/types'
@@ -27,3 +27,31 @@ export function showNoteTrashedToast(
},
})
}
export function showNotesTrashedToast(
notes: Note[],
t: (key: string, params?: Record<string, string | number>) => string,
onRestored?: () => void,
) {
if (notes.length === 1) {
showNoteTrashedToast(notes[0], t, onRestored)
return
}
toast.success(t('notes.bulkTrashedToast', { count: notes.length }), {
action: {
label: t('notes.undoDelete'),
onClick: async () => {
try {
await restoreNotes(notes.map((note) => note.id), { skipRevalidation: true })
for (const note of notes) {
emitNoteChange({ type: 'created', note: { ...note, trashedAt: null } })
}
onRestored?.()
toast.success(t('trash.noteRestored'))
} catch {
toast.error(t('general.error'))
}
},
},
})
}