feat(brainstorm): UX fixes — modal confirmation + destination carnet + race fix
UX Pro Max appliqué selon les best practices 2026 (Heptabase, Obsidian, Tana):
- confirmation-dialogs (HIGH): modal de confirmation avant brainstorm
- success-feedback (MEDIUM): toast avec destination du carnet
- nav-state-active (MEDIUM): indication claire de la session active
3 fixes:
1. Modal de confirmation (brainstorm-confirm-dialog.tsx, 181 lignes):
- Design system respecté: brand-accent, memento-paper, font-memento-serif
- Aperçu seed en card paper
- Sélecteur de carnet avec animation d'expansion
- Bouton 'Annuler' + 'Lancer le brainstorm' avec loader
- role=dialog, aria-modal, aria-label
- focus-visible, keyboard nav
- backdrop-blur-sm + click-to-close
- Lazy loaded via next/dynamic
2. Race condition fix (brainstorm-page.tsx L111):
- Auto-select session désactivé si urlSeed présent
- urlSeed + urlInviteToken court-circuitent le useEffect
3. Toast avec destination (handleConvert + noteCreatedIn key):
- message: 'Note créée dans [Nom du carnet]'
- useConvertIdea accepte notebookId optionnel
- API convert accepte notebookId via zod schema
- useConvertIdea(mutationFn) accepte string | {ideaId, notebookId}
i18n: 9 nouvelles clés brainstorm.* en EN/FR
This commit is contained in:
@@ -7,6 +7,7 @@ import { emitToSession } from '@/lib/socket-emit'
|
||||
|
||||
const convertSchema = z.object({
|
||||
ideaId: z.string().min(1),
|
||||
notebookId: z.string().min(1).nullable().optional(),
|
||||
})
|
||||
|
||||
export async function POST(
|
||||
@@ -21,7 +22,7 @@ export async function POST(
|
||||
try {
|
||||
const { sessionId } = await params
|
||||
const body = await request.json()
|
||||
const { ideaId } = convertSchema.parse(body)
|
||||
const { ideaId, notebookId: paramNotebookId } = convertSchema.parse(body)
|
||||
|
||||
const brainstormSession = await prisma.brainstormSession.findFirst({
|
||||
where: {
|
||||
@@ -51,7 +52,7 @@ export async function POST(
|
||||
}
|
||||
|
||||
let sourceSection = ''
|
||||
let targetNotebookId: string | null = null
|
||||
let targetNotebookId: string | null = paramNotebookId ?? null
|
||||
|
||||
if (brainstormSession.exportedNoteId) {
|
||||
const exportedNote = await prisma.note.findUnique({
|
||||
|
||||
Reference in New Issue
Block a user