From b0213742f42412fbbad0e891cf858f52dd9e8d58 Mon Sep 17 00:00:00 2001 From: icarus Date: Sun, 28 Sep 2025 12:29:03 +0800 Subject: [PATCH] refactor(ChatNavbar): extract InfoTag component and add agent name display - Extract repeated div styling into reusable InfoTag component - Add agent name to the info items display - Replace inline styles with tailwind classes for consistency --- src/renderer/src/pages/home/ChatNavbar.tsx | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/renderer/src/pages/home/ChatNavbar.tsx b/src/renderer/src/pages/home/ChatNavbar.tsx index ff80b13e43..eb639fc867 100644 --- a/src/renderer/src/pages/home/ChatNavbar.tsx +++ b/src/renderer/src/pages/home/ChatNavbar.tsx @@ -1,3 +1,4 @@ +import { cn } from '@heroui/react' import { NavbarHeader } from '@renderer/components/app/Navbar' import { HStack } from '@renderer/components/Layout' import SearchPopup from '@renderer/components/Popups/SearchPopup' @@ -152,8 +153,9 @@ const HeaderNavbar: FC = ({ activeAssistant, setActiveAssistant, activeTo } const SessionWorkspaceMeta: FC<{ agentId: string; sessionId: string }> = ({ agentId, sessionId }) => { + const { agent } = useAgent(agentId) const { session } = useSession(agentId, sessionId) - if (!session) { + if (!session || !agent) { return null } @@ -166,28 +168,25 @@ const SessionWorkspaceMeta: FC<{ agentId: string; sessionId: string }> = ({ agen const infoItems: ReactNode[] = [] - if (firstAccessiblePath) { - infoItems.push( -
- {firstAccessiblePath} -
- ) - } - - infoItems.push( + const InfoTag: FC<{ text: string; className?: string }> = ({ text, className }) => (
- {permissionModeLabel} + className={cn( + 'rounded-medium border border-default-200 px-2 py-1 text-foreground-500 text-xs dark:text-foreground-400', + className + )} + title={text}> + {text}
) + infoItems.push() + + if (firstAccessiblePath) { + infoItems.push() + } + + infoItems.push() + if (infoItems.length === 0) { return null }