'use client' import { useState, memo } from 'react' import { motion, AnimatePresence } from 'motion/react' import { Wind, FolderOpen, X, Loader2, ChevronDown } from 'lucide-react' import { useLanguage } from '@/lib/i18n' import { useNotebooks } from '@/context/notebooks-context' import type { Note } from '@/lib/types' interface BrainstormConfirmDialogProps { open: boolean onClose: () => void onConfirm: (notebookId: string | null) => void note: Note | null } function BrainstormConfirmDialogInner({ open, onClose, onConfirm, note }: BrainstormConfirmDialogProps) { const { t } = useLanguage() const { notebooks } = useNotebooks() const [showNotebookSelect, setShowNotebookSelect] = useState(false) const noteNotebook = notebooks.find(nb => nb.id === note?.notebookId) const defaultNotebookName = noteNotebook?.name || t('brainstorm.defaultNotebook') || 'Brainstorm' const defaultNotebookId = note?.notebookId ?? null const [selectedNotebookId, setSelectedNotebookId] = useState(defaultNotebookId) const [selectedNotebookName, setSelectedNotebookName] = useState(defaultNotebookName) const [loading, setLoading] = useState(false) const handleConfirm = () => { setLoading(true) onConfirm(selectedNotebookId) } const handleClose = () => { setLoading(false) setSelectedNotebookId(defaultNotebookId) setSelectedNotebookName(defaultNotebookName) setShowNotebookSelect(false) onClose() } return ( {open && note && ( { if (e.target === e.currentTarget) handleClose() }} role="dialog" aria-modal="true" aria-label={t('brainstorm.confirmTitle') || 'Brainstorm this idea'} > e.stopPropagation()} > {/* Header */}

{t('brainstorm.confirmTitle') || 'Brainstorm this idea'}

{t('brainstorm.confirmSubtitle') || 'AI will expand your idea'}

{/* Body */}
{/* Seed preview */}

{t('brainstorm.seedLabel') || 'Seed idea'}

{note.title || t('notes.untitled')}

{/* Destination notebook */}

{t('brainstorm.destinationLabel') || 'Notes will be saved to'}

{showNotebookSelect && (
{notebooks.map(nb => ( ))}
)}
{/* Footer */}
)}
) } export const BrainstormConfirmDialog = memo(BrainstormConfirmDialogInner)