From fdb7e803622288c6a34d6e9a5542833364a2fcdb Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 22 Mar 2025 23:36:59 -0700 Subject: [PATCH] refactor block settings --- .../InputToolbar/bottom/HoverItem.tsx | 4 +- .../Lump/BlockSettingsTopToolbar.tsx | 100 +++++------------- 2 files changed, 31 insertions(+), 73 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx b/gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx index e668a69f2..4a8aefcdc 100644 --- a/gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx +++ b/gui/src/components/mainInput/InputToolbar/bottom/HoverItem.tsx @@ -1,7 +1,7 @@ import styled from "styled-components"; -const HoverItem = styled.span<{ isActive?: boolean }>` - padding: 0 4px; +const HoverItem = styled.span<{ isActive?: boolean; px?: number }>` + padding: 0 ${(props) => props.px ?? 4}px; padding-top: 2px; padding-bottom: 2px; cursor: pointer; diff --git a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx index 8d2bbcfe7..ebfec1abd 100644 --- a/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/BlockSettingsTopToolbar.tsx @@ -19,9 +19,24 @@ interface BlockSettingsToolbarIcon { isSelected?: boolean; } +interface Section { + id: string; + tooltip: string; + icon: React.ComponentType; +} + +const sections: Section[] = [ + { id: "models", tooltip: "Models", icon: CubeIcon }, + { id: "rules", tooltip: "Rules", icon: PencilIcon }, + { id: "docs", tooltip: "Docs", icon: BookOpenIcon }, + { id: "prompts", tooltip: "Prompts", icon: ChatBubbleLeftIcon }, + { id: "tools", tooltip: "Tools", icon: WrenchScrewdriverIcon }, + { id: "mcp", tooltip: "MCP", icon: Squares2X2Icon }, +]; + function BlockSettingsToolbarIcon(props: BlockSettingsToolbarIcon) { return ( - +
- - props.setSelectedSection( - props.selectedSection === "models" ? null : "models", - ) - } - /> - - props.setSelectedSection( - props.selectedSection === "rules" ? null : "rules", - ) - } - /> - - props.setSelectedSection( - props.selectedSection === "docs" ? null : "docs", - ) - } - /> - - props.setSelectedSection( - props.selectedSection === "prompts" ? null : "prompts", - ) - } - /> - {/* - props.setSelectedSection( - props.selectedSection === "context" ? null : "context", - ) - } - /> */} - - props.setSelectedSection( - props.selectedSection === "tools" ? null : "tools", - ) - } - /> - - props.setSelectedSection( - props.selectedSection === "mcp" ? null : "mcp", - ) - } - /> + {sections.map((section) => ( + + props.setSelectedSection( + props.selectedSection === section.id ? null : section.id, + ) + } + /> + ))}