import React, { useMemo } from 'react'; import { Box, Flex, Link } from '@chakra-ui/react'; import { useRouter } from 'next/router'; import { useUserStore } from '@/store/user'; import { useChatStore } from '@/store/chat'; import { HUMAN_ICON } from '@/constants/chat'; import { feConfigs } from '@/store/static'; import NextLink from 'next/link'; import Badge from '../Badge'; import Avatar from '../Avatar'; import MyIcon from '../Icon'; import Language from '../Language'; import { useTranslation } from 'next-i18next'; export enum NavbarTypeEnum { normal = 'normal', small = 'small' } const Navbar = ({ unread }: { unread: number }) => { const { t } = useTranslation(); const router = useRouter(); const { userInfo } = useUserStore(); const { lastChatAppId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: t('navbar.Chat'), icon: 'chatLight', activeIcon: 'chatFill', link: `/chat?appId=${lastChatAppId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { label: t('navbar.Apps'), icon: 'appLight', activeIcon: 'appFill', link: `/app/list`, activeLink: ['/app/list', '/app/detail'] }, { label: t('navbar.Datasets'), icon: 'dbLight', activeIcon: 'dbFill', link: `/kb/list`, activeLink: ['/kb/list', '/kb/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?.show_git && ( )} ); }; export default Navbar;