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,129 @@
'use client'
import { useEffect, useState } from 'react'
import { Plus, Trash2 } from 'lucide-react'
import type { NotebookSchemaPayload, NotePropertyValues } from '@/lib/structured-views/types'
import { PropertyValueEditor, useDebouncedPropertySave } from './property-value-editor'
import { useLanguage } from '@/lib/i18n'
import { MAX_PROPERTIES_PER_NOTEBOOK } from '@/lib/structured-views/types'
type NotePropertiesSectionProps = {
noteId: string
schema: NotebookSchemaPayload
initialValues?: NotePropertyValues
onAddProperty?: () => void
onValuesChange?: (values: NotePropertyValues) => void
readOnly?: boolean
}
export function NotePropertiesSection({
noteId,
schema,
initialValues = {},
onAddProperty,
onValuesChange,
readOnly,
}: NotePropertiesSectionProps) {
const { t } = useLanguage()
const [values, setValues] = useState<NotePropertyValues>(initialValues)
useEffect(() => {
setValues(initialValues)
}, [noteId, initialValues])
const queueSave = useDebouncedPropertySave(noteId, (saved) => {
setValues((v) => ({ ...v, ...saved }))
onValuesChange?.({ ...values, ...saved })
})
const handleChange = (propertyId: string, value: unknown) => {
setValues((prev) => {
const next = { ...prev, [propertyId]: value }
onValuesChange?.(next)
return next
})
if (!readOnly) queueSave(propertyId, value)
}
if (schema.properties.length === 0) {
return (
<div className="space-y-2 pt-4 border-t border-border/30">
<p className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
{t('structuredViews.propertiesSection')}
</p>
<p className="text-[12px] text-muted-foreground">{t('structuredViews.noPropertiesYet')}</p>
{onAddProperty && !readOnly && (
<button
type="button"
onClick={onAddProperty}
className="inline-flex items-center gap-1 text-[11px] text-brand-accent hover:underline"
>
<Plus size={12} />
{t('structuredViews.addProperty')}
</button>
)}
</div>
)
}
return (
<div className="space-y-3 pt-4 border-t border-border/30">
<div className="flex items-center justify-between">
<p className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
{t('structuredViews.propertiesSection')}
</p>
{onAddProperty && !readOnly && schema.properties.length < MAX_PROPERTIES_PER_NOTEBOOK && (
<button
type="button"
onClick={onAddProperty}
className="inline-flex items-center gap-1 text-[10px] text-brand-accent hover:underline"
>
<Plus size={10} />
{t('structuredViews.addProperty')}
</button>
)}
</div>
<div className="space-y-3">
{schema.properties.map((prop) => (
<div key={prop.id} className="space-y-1">
<label className="text-[11px] font-medium text-muted-foreground">{prop.name}</label>
{readOnly ? (
<p className="text-[13px]">{String(values[prop.id] ?? '—')}</p>
) : (
<PropertyValueEditor
property={prop}
value={values[prop.id]}
onChange={(v) => handleChange(prop.id, v)}
/>
)}
</div>
))}
</div>
</div>
)
}
export function SchemaPropertyList({
schema,
onDeleteProperty,
}: {
schema: NotebookSchemaPayload
onDeleteProperty?: (id: string) => void
}) {
const { t } = useLanguage()
return (
<ul className="space-y-1">
{schema.properties.map((p) => (
<li key={p.id} className="flex items-center justify-between text-[12px] py-1">
<span>{p.name}</span>
<span className="text-muted-foreground text-[10px] uppercase">{t(`structuredViews.propertyTypes.${p.type}`)}</span>
{onDeleteProperty && (
<button type="button" onClick={() => onDeleteProperty(p.id)} className="p-1 text-muted-foreground hover:text-red-500">
<Trash2 size={12} />
</button>
)}
</li>
))}
</ul>
)
}