From ee38b200f8afd57f2691646b74a50c13e6aade11 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 27 Jul 2026 23:46:16 +0200 Subject: [PATCH] fix: tighten folder tree spacing + collapsible search icon in toolbar --- .../components/contacts/ContactFolderTree.tsx | 2 +- .../src/components/layout/PluginToolbar.tsx | 68 ++++++++++++++++--- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/contacts/ContactFolderTree.tsx b/frontend/src/components/contacts/ContactFolderTree.tsx index 1758d86..ce2f217 100644 --- a/frontend/src/components/contacts/ContactFolderTree.tsx +++ b/frontend/src/components/contacts/ContactFolderTree.tsx @@ -165,7 +165,7 @@ function FolderTreeItem({ onDragLeave={() => onDragLeave(node.id)} onDrop={(e) => onDrop(e, node.id)} className={clsx( - 'group flex items-center gap-1.5 flex-1 px-2 py-1.5 text-sm font-medium rounded-md cursor-pointer min-h-touch', + 'group flex items-center gap-1 flex-1 px-2 py-1.5 text-sm font-medium rounded-md cursor-pointer min-h-touch', 'transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500', isDragOver ? 'bg-primary-100 ring-2 ring-primary-400' diff --git a/frontend/src/components/layout/PluginToolbar.tsx b/frontend/src/components/layout/PluginToolbar.tsx index 8ba2154..8a84eb4 100644 --- a/frontend/src/components/layout/PluginToolbar.tsx +++ b/frontend/src/components/layout/PluginToolbar.tsx @@ -21,15 +21,67 @@ function ToolbarButton({ item }: { item: ToolbarItem }) { } function ToolbarSearch({ item }: { item: ToolbarItem }) { + const [expanded, setExpanded] = React.useState(false); + const [value, setValue] = React.useState(''); + const inputRef = React.useRef(null); + + const handleToggle = () => { + if (expanded) { + // Collapse: clear and close + setValue(''); + item.onSearch?.(''); + setExpanded(false); + } else { + setExpanded(true); + setTimeout(() => inputRef.current?.focus(), 50); + } + }; + + const handleChange = (e: React.ChangeEvent) => { + setValue(e.target.value); + item.onSearch?.(e.target.value); + }; + + if (!expanded) { + return ( + + ); + } + return ( - item.onSearch?.(e.target.value)} - className="w-28 sm:w-40 px-2 py-1 text-xs border border-secondary-200 rounded - focus:outline-none focus:border-primary-400 focus:ring-1 focus:ring-primary-300 - placeholder:text-secondary-400 flex-shrink-0" - /> +
+ { if (!value) { setExpanded(false); } }} + className="w-28 sm:w-40 px-2 py-1 text-xs border border-secondary-200 rounded + focus:outline-none focus:border-primary-400 focus:ring-1 focus:ring-primary-300 + placeholder:text-secondary-400" + /> + +
); }