MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / SettingsModal

Function SettingsModal

frontend/components/autofigure/SettingsModal.tsx:20–302  ·  view source on GitHub ↗
({ isOpen, onClose }: SettingsModalProps)

Source from the content-addressed store, hash-verified

18type TabType = "general" | "llm"
19
20export default function SettingsModal({ isOpen, onClose }: SettingsModalProps) {
21 const { config, updateConfig } = useAutoFigure()
22 const [activeTab, setActiveTab] = useState<TabType>("general")
23
24 // Close on Escape key
25 useEffect(() => {
26 const handleKeyDown = (e: KeyboardEvent) => {
27 if (e.key === "Escape") {
28 onClose()
29 }
30 }
31 if (isOpen) {
32 document.addEventListener("keydown", handleKeyDown)
33 return () => document.removeEventListener("keydown", handleKeyDown)
34 }
35 }, [isOpen, onClose])
36
37 // Prevent body scroll when modal is open
38 useEffect(() => {
39 if (isOpen) {
40 document.body.style.overflow = "hidden"
41 } else {
42 document.body.style.overflow = ""
43 }
44 return () => {
45 document.body.style.overflow = ""
46 }
47 }, [isOpen])
48
49 if (!isOpen) return null
50
51 const tabs = [
52 { id: "general" as const, label: "General", icon: <Lightbulb className="w-4 h-4" /> },
53 { id: "llm" as const, label: "LLM", icon: <Cpu className="w-4 h-4" /> },
54 ]
55
56 return (
57 <div className="af-modal-overlay" onClick={onClose}>
58 <div
59 className="af-modal"
60 onClick={e => e.stopPropagation()}
61 >
62 {/* Header */}
63 <div className="af-modal-header">
64 <div className="af-modal-title">
65 <div className="af-modal-icon">
66 <Settings2 className="w-5 h-5 text-white" />
67 </div>
68 <div>
69 <h2>Settings</h2>
70 <p>Configure generation parameters</p>
71 </div>
72 </div>
73 <button className="af-modal-close" onClick={onClose}>
74 <X className="w-5 h-5" />
75 </button>
76 </div>
77

Callers

nothing calls this directly

Calls 1

useAutoFigureFunction · 0.90

Tested by

no test coverage detected