From e6e43dbccac463b1cc9a110dc25ff420beb351d8 Mon Sep 17 00:00:00 2001 From: Vaayne Date: Tue, 23 Sep 2025 23:35:41 +0800 Subject: [PATCH] feat: conditionally render settings tab based on session view --- src/renderer/src/pages/home/Tabs/index.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/pages/home/Tabs/index.tsx b/src/renderer/src/pages/home/Tabs/index.tsx index 4b59278840..c2cfc57385 100644 --- a/src/renderer/src/pages/home/Tabs/index.tsx +++ b/src/renderer/src/pages/home/Tabs/index.tsx @@ -46,6 +46,7 @@ const HomeTabs: FC = ({ const { chat } = useRuntime() const { activeTopicOrSession } = chat + const isSessionView = activeTopicOrSession === 'session' const [tab, setTab] = useState(position === 'left' ? _tab || 'assistants' : 'topic') const borderStyle = '0.5px solid var(--color-border)' @@ -59,6 +60,7 @@ const HomeTabs: FC = ({ } const showTab = position === 'left' && topicPosition === 'left' + const canShowSettingsTab = !isSessionView const onCreateAssistant = async () => { const assistant = await AddAssistantPopup.show() @@ -113,9 +115,11 @@ const HomeTabs: FC = ({ setTab('topic')}> {activeTopicOrSession === 'topic' ? t('common.topics') : t('agent.session.label_other')} - setTab('settings')}> - {t('settings.title')} - + {canShowSettingsTab && ( + setTab('settings')}> + {t('settings.title')} + + )} )} @@ -124,9 +128,11 @@ const HomeTabs: FC = ({ setTab('topic')}> {activeTopicOrSession === 'topic' ? t('common.topics') : t('agent.session.label_other')} - setTab('settings')}> - {t('settings.title')} - + {canShowSettingsTab && ( + setTab('settings')}> + {t('settings.title')} + + )} )} @@ -147,7 +153,7 @@ const HomeTabs: FC = ({ position={position} /> )} - {tab === 'settings' && } + {tab === 'settings' && canShowSettingsTab && } )