fix(ui): thème, textes et lisibilité restants de la revue
Les boutons suivent la couleur d’apparence, les libellés trop petits ou trop techniques sont clarifiés, et le catalogue des fournisseurs se met à jour tout seul. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
memento-note/lib/notes/trash-toast.ts
Normal file
29
memento-note/lib/notes/trash-toast.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
'use client'
|
||||
|
||||
import { toast } from 'sonner'
|
||||
import { restoreNote } from '@/app/actions/notes'
|
||||
import { emitNoteChange } from '@/lib/note-change-sync'
|
||||
import type { Note } from '@/lib/types'
|
||||
|
||||
export function showNoteTrashedToast(
|
||||
note: Note,
|
||||
t: (key: string) => string,
|
||||
onRestored?: () => void,
|
||||
) {
|
||||
toast.success(t('notes.noteDeletedToast'), {
|
||||
action: {
|
||||
label: t('notes.undoDelete'),
|
||||
onClick: async () => {
|
||||
try {
|
||||
await restoreNote(note.id)
|
||||
const restored = { ...note, trashedAt: null }
|
||||
emitNoteChange({ type: 'created', note: restored })
|
||||
onRestored?.()
|
||||
toast.success(t('trash.noteRestored'))
|
||||
} catch {
|
||||
toast.error(t('general.error'))
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user