fix: History manquant sur GridCard (le VRAI composant carte grille)
Root cause: le mode grille utilise GridCard dans notes-list-views.tsx, PAS NoteCard de note-card.tsx. Toutes les fixes précédentes étaient sur le mauvais composant. Fix: - onOpenHistory ajouté à GridCardSharedProps - Badge History en haut-droite si historyEnabled=true - Bouton History dans la barre d'actions (vert si activé, gris sinon) - Prop threadé: NotesListViews → NotesMasonryGrid → GridCard
This commit is contained in:
@@ -349,6 +349,7 @@ export function NotesListViews({
|
|||||||
onDeleteNote={onDeleteNote}
|
onDeleteNote={onDeleteNote}
|
||||||
onMoveToNotebook={onMoveToNotebook}
|
onMoveToNotebook={onMoveToNotebook}
|
||||||
onNoteIllustrationGenerated={onNoteIllustrationGenerated}
|
onNoteIllustrationGenerated={onNoteIllustrationGenerated}
|
||||||
|
onOpenHistory={onOpenHistory}
|
||||||
onGridReorder={onGridReorder}
|
onGridReorder={onGridReorder}
|
||||||
pinnedLabel={t('notes.pinned')}
|
pinnedLabel={t('notes.pinned')}
|
||||||
/>
|
/>
|
||||||
@@ -505,6 +506,7 @@ type GridCardSharedProps = {
|
|||||||
onMoveToNotebook?: (note: Note, notebookId: string | null) => void | Promise<void>
|
onMoveToNotebook?: (note: Note, notebookId: string | null) => void | Promise<void>
|
||||||
onNoteIllustrationGenerated?: (noteId: string) => void | Promise<void>
|
onNoteIllustrationGenerated?: (noteId: string) => void | Promise<void>
|
||||||
onNoteIllustrationDeleted?: (noteId: string) => void | Promise<void>
|
onNoteIllustrationDeleted?: (noteId: string) => void | Promise<void>
|
||||||
|
onOpenHistory?: (note: Note) => void
|
||||||
isOverlay?: boolean
|
isOverlay?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,6 +715,7 @@ const GridCard = memo(function GridCard({
|
|||||||
onMoveToNotebook,
|
onMoveToNotebook,
|
||||||
onNoteIllustrationGenerated,
|
onNoteIllustrationGenerated,
|
||||||
onNoteIllustrationDeleted,
|
onNoteIllustrationDeleted,
|
||||||
|
onOpenHistory,
|
||||||
isOverlay = false,
|
isOverlay = false,
|
||||||
}: GridCardSharedProps) {
|
}: GridCardSharedProps) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -758,6 +761,11 @@ const GridCard = memo(function GridCard({
|
|||||||
<Pin size={11} className="fill-amber-500" />
|
<Pin size={11} className="fill-amber-500" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{note.historyEnabled && (
|
||||||
|
<div className="absolute top-3 end-3 bg-emerald-500/15 dark:bg-emerald-500/25 border border-emerald-500/20 p-1 rounded-full shadow-sm backdrop-blur-sm text-emerald-600 dark:text-emerald-400">
|
||||||
|
<History size={11} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="p-5 flex flex-col flex-1 min-h-[11.5rem]">
|
<div className="p-5 flex flex-col flex-1 min-h-[11.5rem]">
|
||||||
<div className="space-y-2.5 flex-1">
|
<div className="space-y-2.5 flex-1">
|
||||||
@@ -810,6 +818,22 @@ const GridCard = memo(function GridCard({
|
|||||||
</button>
|
</button>
|
||||||
</MoveToNotebookPicker>
|
</MoveToNotebookPicker>
|
||||||
)}
|
)}
|
||||||
|
{onOpenHistory && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={(e) => { e.stopPropagation(); onOpenHistory(note) }}
|
||||||
|
className={cn(
|
||||||
|
"p-1 px-2 rounded-full transition-all cursor-pointer",
|
||||||
|
note.historyEnabled
|
||||||
|
? "text-emerald-500 hover:bg-emerald-500/10"
|
||||||
|
: "text-muted-foreground/60 hover:bg-muted hover:text-foreground"
|
||||||
|
)}
|
||||||
|
title={note.historyEnabled ? (t('notes.history') || 'Historique') : (t('notes.enableHistory') || "Activer l'historique")}
|
||||||
|
aria-label={note.historyEnabled ? (t('notes.history') || 'Historique') : (t('notes.enableHistory') || "Activer l'historique")}
|
||||||
|
>
|
||||||
|
<History size={11} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleDeleteClick}
|
onClick={handleDeleteClick}
|
||||||
|
|||||||
Reference in New Issue
Block a user