import { X } from 'lucide-react' import { useEffect, useRef, useState } from 'react' import { EXAMPLE_SPEC } from '../lib/spec' import { Spinner } from './ui' interface Props { open: boolean creating: boolean onClose: () => void onCreate: (name: string, description: string) => void } export function NewProjectDialog({ open, creating, onClose, onCreate }: Props) { const [name, setName] = useState('ESP32 Temperature Monitor') const [desc, setDesc] = useState(EXAMPLE_SPEC) const input = useRef(null) useEffect(() => { if (open) setTimeout(() => input.current?.select(), 30) }, [open]) if (!open) return null const valid = name.trim().length > 0 return (
e.key === 'Escape' && onClose()}>
{ e.preventDefault(); if (valid && !creating) onCreate(name.trim(), desc) }}>

New PCB project