From 722335c923fa5de029cf5a4eb5dbd07d5fc99875 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Tue, 28 Jul 2026 00:45:55 +0200 Subject: [PATCH] contacts toolbar: consolidate views and filters into dropdowns --- .../src/components/layout/PluginToolbar.tsx | 66 ++++++++++++++++ frontend/src/pages/ContactsList.tsx | 79 ++++++------------- frontend/src/store/pluginToolbarStore.ts | 4 +- 3 files changed, 93 insertions(+), 56 deletions(-) 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 (