From d2d5b4370c47eb0166a6ad0921b7ba3c2ab0e90b Mon Sep 17 00:00:00 2001 From: icarus Date: Mon, 29 Sep 2025 19:36:13 +0800 Subject: [PATCH] feat(ChatNavbar): make path info tag clickable to open file location Add onClick handler to InfoTag component to open file location when clicked --- src/renderer/src/pages/home/ChatNavbar.tsx | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/pages/home/ChatNavbar.tsx b/src/renderer/src/pages/home/ChatNavbar.tsx index 92fa43de4f..0d0dcce91d 100644 --- a/src/renderer/src/pages/home/ChatNavbar.tsx +++ b/src/renderer/src/pages/home/ChatNavbar.tsx @@ -20,7 +20,7 @@ import { Tooltip } from 'antd' import { t } from 'i18next' import { Menu, PanelLeftClose, PanelRightClose, Search } from 'lucide-react' import { AnimatePresence, motion } from 'motion/react' -import { FC, ReactNode, useCallback } from 'react' +import React, { FC, ReactNode, useCallback } from 'react' import styled from 'styled-components' import { AgentSettingsPopup } from '../settings/AgentSettings' @@ -193,13 +193,24 @@ const SessionWorkspaceMeta: FC<{ agentId: string; sessionId: string }> = ({ agen const infoItems: ReactNode[] = [] - const InfoTag: FC<{ text: string; className?: string }> = ({ text, className }) => ( + const InfoTag = ({ + text, + className, + onClick + }: { + text: string + className?: string + classNames?: {} + onClick?: (e: React.MouseEvent) => void + }) => (
+ title={text} + onClick={onClick}> {text}
) @@ -207,7 +218,14 @@ const SessionWorkspaceMeta: FC<{ agentId: string; sessionId: string }> = ({ agen // infoItems.push() if (firstAccessiblePath) { - infoItems.push() + infoItems.push( + window.api.file.openPath(firstAccessiblePath)} + /> + ) } infoItems.push()