import { ClipboardPaste, FileUp } from "lucide-react"; import { useCallback, useEffect, useRef, useState } from "react"; import { Button } from "./ui/button.js"; import { Dialog, DialogHeader } from "./ui/dialog.js"; interface ImportMethodDialogProps { open: boolean; onSelectFile: () => void; onSubmitClipboard: (text: string) => void; onClose: () => void; } export function ImportMethodDialog({ open, onSelectFile, onSubmitClipboard, onClose, }: Readonly) { const textareaRef = useRef(null); const [mode, setMode] = useState<"pick" | "paste">("pick"); const [pasteText, setPasteText] = useState(""); const handleClose = useCallback(() => { setMode("pick"); setPasteText(""); onClose(); }, [onClose]); useEffect(() => { if (!open) { setMode("pick"); setPasteText(""); } }, [open]); useEffect(() => { if (mode === "paste") { textareaRef.current?.focus(); } }, [mode]); return ( {mode === "pick" && (
)} {mode === "paste" && (