diff --git a/frontend/src/components/layout/PluginToolbar.tsx b/frontend/src/components/layout/PluginToolbar.tsx index 8a84eb4..204fe67 100644 --- a/frontend/src/components/layout/PluginToolbar.tsx +++ b/frontend/src/components/layout/PluginToolbar.tsx @@ -85,6 +85,71 @@ function ToolbarSearch({ item }: { item: ToolbarItem }) { ); } +function ToolbarDropdown({ item }: { item: ToolbarItem }) { + const [open, setOpen] = React.useState(false); + const ref = React.useRef(null); + + React.useEffect(() => { + if (!open) return; + const handler = (e: MouseEvent) => { + if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false); + }; + document.addEventListener('mousedown', handler); + return () => document.removeEventListener('mousedown', handler); + }, [open]); + + const activeOption = item.menuOptions?.find((o) => o.active); + + return ( +
+ + {open && ( +
+ {item.menuOptions?.map((opt) => ( + + ))} +
+ )} +
+ ); +} + function ToolbarSelect({ item }: { item: ToolbarItem }) { return (