/** * "+ Add a note" affordance for the What-we-know section. * * Inline composer that posts a `user_note` fact when the engineer wants to * record something the AI didn't surface (a hunch, an observation, a piece * of customer context). Per FLOWPILOT-MIGRATION.md Section 3.1. */ import { useState } from 'react' import { Plus, Check } from 'lucide-react' interface AddNoteButtonProps { onAdd: (text: string, summary: string | null) => Promise | void } export function AddNoteButton({ onAdd }: AddNoteButtonProps) { const [open, setOpen] = useState(false) const [text, setText] = useState('') const [summary, setSummary] = useState('') const [busy, setBusy] = useState(false) const reset = () => { setText('') setSummary('') setOpen(false) } const handleSubmit = async () => { if (!text.trim()) return setBusy(true) try { await onAdd(text.trim(), summary.trim() || null) reset() } finally { setBusy(false) } } if (!open) { return ( ) } return (