diff --git a/memento-note/components/brainstorm/convert-notebook-dialog.tsx b/memento-note/components/brainstorm/convert-notebook-dialog.tsx new file mode 100644 index 0000000..19211b3 --- /dev/null +++ b/memento-note/components/brainstorm/convert-notebook-dialog.tsx @@ -0,0 +1,157 @@ +'use client' + +import { useState } from 'react' +import { motion, AnimatePresence } from 'motion/react' +import { FileText, FolderOpen, ChevronDown, Loader2, X } from 'lucide-react' +import { useLanguage } from '@/lib/i18n' +import type { Notebook } from '@/lib/types' + +interface ConvertNotebookDialogProps { + open: boolean + idea: { id: string; title: string } | null + notebooks: Notebook[] + defaultNotebookId: string | null | undefined + onClose: () => void + onConfirm: (notebookId: string | null) => void +} + +export function ConvertNotebookDialog({ open, idea, notebooks, defaultNotebookId, onClose, onConfirm }: ConvertNotebookDialogProps) { + const { t } = useLanguage() + const [showNotebookSelect, setShowNotebookSelect] = useState(false) + const [selectedNotebookId, setSelectedNotebookId] = useState(defaultNotebookId ?? null) + const selectedNotebook = notebooks.find(nb => nb.id === selectedNotebookId) + const [loading, setLoading] = useState(false) + + const handleConfirm = () => { + setLoading(true) + onConfirm(selectedNotebookId) + } + + return ( + + {open && idea && ( + { if (e.target === e.currentTarget) onClose() }} + role="dialog" + aria-modal="true" + aria-label={t('brainstorm.convertTitle') || 'Create note from idea'} + > + e.stopPropagation()} + > +
+
+
+ +
+
+

+ {t('brainstorm.convertTitle') || 'Create note from idea'} +

+

+ {t('brainstorm.convertSubtitle') || 'Choose where to save this note'} +

+
+
+ +
+ +
+
+

+ {t('brainstorm.ideaLabel') || 'Idea'} +

+

+ {idea.title} +

+
+ +
+

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

+ + + {showNotebookSelect && ( + +
+ + {notebooks.map(nb => ( + + ))} +
+
+ )} +
+
+
+ +
+ + +
+
+
+ )} +
+ ) +}