import React, { useState, useEffect, useRef } from 'react'; import { Settings } from 'lucide-react'; import { LAYOUT_MODES, PANEL_KEYS, PANEL_LABELS } from '../utils/settings'; const LAYOUT_OPTIONS = [ { id: LAYOUT_MODES.RANDOM, label: 'Random seed (default)', hint: 'Layout may shift on each run' }, { id: LAYOUT_MODES.FIXED_SEED, label: 'Fixed seed', hint: 'Same layout every run unless topology changes' }, { id: LAYOUT_MODES.EXPLICIT, label: 'Explicit coordinates', hint: 'Fixed positions; physics off' }, ]; export default function SettingsMenu({ settings, onChange }) { const [open, setOpen] = useState(false); const wrapRef = useRef(null); useEffect(() => { if (!open) return undefined; const onDocClick = (e) => { if (wrapRef.current && !wrapRef.current.contains(e.target)) { setOpen(false); } }; document.addEventListener('mousedown', onDocClick); return () => document.removeEventListener('mousedown', onDocClick); }, [open]); const setLayoutMode = (layoutMode) => { onChange({ ...settings, layoutMode }); }; const togglePanel = (key) => { onChange({ ...settings, panels: { ...settings.panels, [key]: !settings.panels[key] }, }); }; return (