feat(notes): vues structurées tableau/kanban, flashcards et MCP robuste
Some checks failed
CI / Lint, Test & Build (push) Failing after 57s
CI / Deploy production (on server) (push) Has been skipped

Ajoute la base organisable par carnet (schéma, champs partagés, valeurs par note)
avec activation guidée, tableau éditable, kanban et suppression de colonnes.
Corrige le multiselect en vue tableau et enrichit sidebar, grille et i18n FR/EN.
Inclut aussi les améliorations flashcards SM-2, l'audit consentement IA et la
robustesse du serveur MCP (config, validation, rate-limit, métriques).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-05-24 23:03:16 +00:00
parent ecd7e57c2e
commit 0784c94242
63 changed files with 10133 additions and 619 deletions

View File

@@ -0,0 +1,105 @@
'use client'
import { useCallback, useRef } from 'react'
import type { Note } from '@/lib/types'
import type { NotebookSchemaPayload, NotePropertyValues, StructuredViewMode } from '@/lib/structured-views/types'
import { NotesStructuredTable } from './notes-structured-table'
import { NotesKanbanView } from './notes-kanban-view'
import { NotesGalleryView } from './notes-gallery-view'
type StructuredViewsContainerProps = {
mode: StructuredViewMode
notes: Note[]
schema: NotebookSchemaPayload
noteValues: Record<string, NotePropertyValues>
notebookColor?: string | null
onOpen: (note: Note) => void
onNoteValuesPatch: (noteId: string, patch: NotePropertyValues) => void
onCreateNote: (prefill: Record<string, unknown>) => void
onSetKanbanGroupProperty: (propertyId: string) => void
onQuickAddKanbanStatus?: () => void
onDeleteProperty?: (propertyId: string) => Promise<void>
}
export function StructuredViewsContainer({
mode,
notes,
schema,
noteValues,
notebookColor,
onOpen,
onNoteValuesPatch,
onCreateNote,
onSetKanbanGroupProperty,
onQuickAddKanbanStatus,
onDeleteProperty,
}: StructuredViewsContainerProps) {
const timersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map())
const saveProperty = useCallback(
(noteId: string, propertyId: string, value: unknown) => {
onNoteValuesPatch(noteId, { [propertyId]: value })
const key = `${noteId}:${propertyId}`
const existing = timersRef.current.get(key)
if (existing) clearTimeout(existing)
timersRef.current.set(
key,
setTimeout(async () => {
try {
await fetch(`/api/notes/${noteId}/properties`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ properties: { [propertyId]: value } }),
})
} catch (e) {
console.error(e)
}
timersRef.current.delete(key)
}, 500),
)
},
[onNoteValuesPatch],
)
if (mode === 'table') {
return (
<NotesStructuredTable
notes={notes}
schema={schema}
noteValues={noteValues}
onOpen={onOpen}
onPropertyChange={saveProperty}
onDeleteProperty={onDeleteProperty}
/>
)
}
if (mode === 'kanban') {
return (
<NotesKanbanView
notes={notes}
schema={schema}
noteValues={noteValues}
onOpen={onOpen}
onPropertyChange={saveProperty}
onCreateNote={onCreateNote}
onSetGroupProperty={onSetKanbanGroupProperty}
onQuickAddKanbanStatus={onQuickAddKanbanStatus}
/>
)
}
if (mode === 'gallery') {
return (
<NotesGalleryView
notes={notes}
schema={schema}
noteValues={noteValues}
notebookColor={notebookColor}
onOpen={onOpen}
/>
)
}
return null
}