import React, { useMemo } from 'react'; import { Box, Flex, Link } from '@chakra-ui/react'; import { useRouter } from 'next/router'; import { useUserStore } from '@/web/support/user/useUserStore'; import { useChatStore } from '@/web/core/chat/storeChat'; import { HUMAN_ICON } from '@fastgpt/global/core/chat/constants'; import { feConfigs } from '@/web/common/system/staticData'; import NextLink from 'next/link'; import Badge from '../Badge'; import Avatar from '../Avatar'; import MyIcon from '../Icon'; import { useTranslation } from 'next-i18next'; import { useSystemStore } from '@/web/common/system/useSystemStore'; import MyTooltip from '../MyTooltip'; export enum NavbarTypeEnum { normal = 'normal', small = 'small' } const Navbar = ({ unread }: { unread: number }) => { const { t } = useTranslation(); const router = useRouter(); const { userInfo } = useUserStore(); const { gitStar } = useSystemStore(); const { lastChatAppId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: t('navbar.Chat'), icon: 'chat', activeIcon: 'chatFill', link: `/chat?appId=${lastChatAppId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { label: t('navbar.Apps'), icon: 'core/app/aiLight', activeIcon: 'core/app/aiFill', link: `/app/list`, activeLink: ['/app/list', '/app/detail'] }, { label: t('navbar.Plugin'), icon: 'common/navbar/pluginLight', activeIcon: 'common/navbar/pluginFill', link: `/plugin/list`, activeLink: ['/plugin/list', '/plugin/edit'] }, { label: t('navbar.Datasets'), icon: 'dbLight', activeIcon: 'dbFill', link: `/dataset/list`, activeLink: ['/dataset/list', '/dataset/detail'] }, ...(feConfigs?.show_appStore ? [ { label: t('navbar.Store'), icon: 'appStoreLight', activeIcon: 'appStoreFill', link: '/appStore', activeLink: ['/appStore'] } ] : []), { label: t('navbar.Account'), icon: 'meLight', activeIcon: 'meFill', link: '/account', activeLink: ['/account'] } ], [lastChatAppId, lastChatId, t] ); const itemStyles: any = { my: 3, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', w: '54px', h: '54px', borderRadius: 'md', _hover: { bg: 'myWhite.600' } }; return ( {/* logo */} router.push('/account')} > {/* 导航列表 */} {navbarList.map((item) => ( router.push(item.link) } : {})} > {item.label} ))} {unread > 0 && ( )} {feConfigs?.docUrl && ( { window.open(`${feConfigs.docUrl}/docs/intro`); }} > )} {feConfigs?.show_git && ( )} ); }; export default Navbar;