import { useState } from 'react' import axios from 'axios' import { X, UploadCloud } from 'lucide-react' interface ImportWizardProps { isOpen: boolean onClose: () => void onSuccess: () => void apiBase: string } export function ImportWizard({ isOpen, onClose, onSuccess, apiBase }: ImportWizardProps) { const [text, setText] = useState("") const [loading, setLoading] = useState(false) if (!isOpen) return null const handleImport = async () => { const lines = text.split('\n').map(l => l.trim()).filter(l => l.length > 0) if (lines.length === 0) return setLoading(true) try { await axios.post(`${apiBase}/companies/bulk`, { names: lines }) setText("") onSuccess() onClose() } catch (e: any) { console.error(e) const msg = e.response?.data?.detail || e.message || "Unknown Error" alert(`Import failed: ${msg}`) } finally { setLoading(false) } } return (
{/* Header */}

Quick Import

{/* Body */}

Paste company names below (one per line). Duplicates in the database will be skipped automatically.