From bd74ffb8dde26706fa7ab25a4e268dd281cc7726 Mon Sep 17 00:00:00 2001 From: Lay Date: Wed, 20 Mar 2024 00:56:08 +0800 Subject: [PATCH] =?UTF-8?q?fix[chat2db-client]:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E5=8D=8F=E4=BD=9C=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat2db-client/src/pages/main/index.tsx | 38 ++++++++++--------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/chat2db-client/src/pages/main/index.tsx b/chat2db-client/src/pages/main/index.tsx index c0e7853a3..b619e3ea5 100644 --- a/chat2db-client/src/pages/main/index.tsx +++ b/chat2db-client/src/pages/main/index.tsx @@ -59,6 +59,14 @@ const initNavConfig: INavItem[] = [ component: , name: i18n('connection.title'), }, + { + key: 'team', + icon: '\ue64b', + iconFontSize: 24, + isLoad: false, + component: , + name: i18n('team.title'), + }, { key: 'github', icon: '\ue885', @@ -99,7 +107,6 @@ function MainPage() { }, [mainPageActiveTab]); useEffect(() => { - handleInitPage(); getConnectionList(); getConnectionEnvList(); }, []); @@ -122,27 +129,6 @@ function MainPage() { } }, [activeNavKey]); - const handleInitPage = async () => { - const cloneNavConfig = [...navConfig]; - if (userInfo) { - const hasTeamIcon = cloneNavConfig.find((i) => i.key === 'team'); - if (userInfo.admin && !hasTeamIcon) { - cloneNavConfig.splice(3, 0, { - key: 'team', - icon: '\ue64b', - iconFontSize: 24, - isLoad: activeNavKey === 'team', // 如果当前是team,直接加载 - component: , - name: i18n('team.title'), - }); - } - if (!userInfo.admin && hasTeamIcon) { - cloneNavConfig.splice(3, 1); - } - } - setNavConfig([...cloneNavConfig]); - }; - const switchingNav = (key: string) => { if (key === 'github') { window.open('https://github.com/chat2db/Chat2DB/', '_blank'); @@ -191,6 +177,12 @@ function MainPage() { {(isMac === void 0) && }
    {navConfig.map((item) => { + if (item.key === 'team') { + if (!userInfo || !userInfo.admin) { + return; + } + } + return (