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,128 @@
'use client'
import { useState } from 'react'
import { X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useLanguage } from '@/lib/i18n'
import type { PropertyType } from '@/lib/structured-views/types'
import { PROPERTY_TYPES } from '@/lib/structured-views/types'
import { cn } from '@/lib/utils'
type AddPropertyDialogProps = {
open: boolean
onClose: () => void
onSubmit: (name: string, type: PropertyType, options: string[]) => Promise<void>
}
export function AddPropertyDialog({ open, onClose, onSubmit }: AddPropertyDialogProps) {
const { t } = useLanguage()
const [name, setName] = useState('')
const [type, setType] = useState<PropertyType>('text')
const [optionsText, setOptionsText] = useState('')
const [saving, setSaving] = useState(false)
if (!open) return null
const needsOptions = type === 'select' || type === 'multiselect'
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
const trimmed = name.trim()
if (!trimmed) return
const options = needsOptions
? optionsText.split('\n').map((l) => l.trim()).filter(Boolean)
: []
if (needsOptions && options.length === 0) return
setSaving(true)
try {
await onSubmit(trimmed, type, options)
setName('')
setType('text')
setOptionsText('')
onClose()
} finally {
setSaving(false)
}
}
return (
<div className="fixed inset-0 z-[200] flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
<div
role="dialog"
aria-modal
className="w-full max-w-md rounded-2xl border border-border bg-memento-paper shadow-xl p-6 space-y-5"
>
<div className="flex items-center justify-between">
<h2 className="font-memento-serif text-lg">{t('structuredViews.addPropertyTitle')}</h2>
<button type="button" onClick={onClose} className="p-1 rounded-lg hover:bg-foreground/5">
<X size={18} />
</button>
</div>
<form onSubmit={handleSubmit} className="space-y-4">
<p className="text-[12px] leading-relaxed text-muted-foreground rounded-lg bg-foreground/[0.03] px-3 py-2">
{t('structuredViews.addPropertyHint')}
</p>
<div>
<label className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
{t('structuredViews.propertyName')}
</label>
<input
value={name}
onChange={(e) => setName(e.target.value)}
className="mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"
autoFocus
/>
</div>
<div>
<label className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
{t('structuredViews.propertyType')}
</label>
<div className="mt-2 flex flex-wrap gap-2">
{PROPERTY_TYPES.map((pt) => (
<button
key={pt}
type="button"
onClick={() => setType(pt)}
className={cn(
'px-3 py-1 rounded-full text-[10px] font-bold uppercase tracking-wider border transition-colors',
type === pt
? 'bg-foreground text-background border-foreground'
: 'border-border text-muted-foreground hover:border-foreground/30',
)}
>
{t(`structuredViews.propertyTypes.${pt}`)}
</button>
))}
</div>
</div>
{needsOptions && (
<div>
<label className="text-[10px] uppercase tracking-widest font-bold text-muted-foreground">
{t('structuredViews.selectOptions')}
</label>
<textarea
value={optionsText}
onChange={(e) => setOptionsText(e.target.value)}
placeholder={t('structuredViews.selectOptionsPlaceholder')}
rows={4}
className="mt-1 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm resize-none"
/>
</div>
)}
<div className="flex justify-end gap-2 pt-2">
<Button type="button" variant="ghost" onClick={onClose}>
{t('general.cancel')}
</Button>
<Button type="submit" disabled={saving || !name.trim()}>
{t('structuredViews.addProperty')}
</Button>
</div>
</form>
</div>
</div>
)
}