import React, { useState, useEffect, useRef } from 'react'; import { Tag } from 'lucide-react'; // ── Category picker dropdown ───────────────────────────────────────────────── export function CategoryPicker({ categories, current, currentLabel, onSelect }) { const [open, setOpen] = useState(false); const ref = useRef(null); useEffect(() => { if (!open) return; const close = e => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); }; document.addEventListener('mousedown', close); return () => document.removeEventListener('mousedown', close); }, [open]); const currentCat = categories.find(c => c.id === current); return (
No spending categories. Enable some in Categories.
) : categories.map(cat => ( ))}