import React, { useMemo } from 'react'; import { Box, Flex, Tooltip, Link } from '@chakra-ui/react'; import { useRouter } from 'next/router'; import MyIcon from '../Icon'; import { useUserStore } from '@/store/user'; import { useChatStore } from '@/store/chat'; import Avatar from '../Avatar'; import { HUMAN_ICON } from '@/constants/chat'; import NextLink from 'next/link'; import Badge from '../Badge'; export enum NavbarTypeEnum { normal = 'normal', small = 'small' } const Navbar = ({ unread }: { unread: number }) => { const router = useRouter(); const { userInfo, lastModelId } = useUserStore(); const { lastChatModelId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: '聊天', icon: 'chat', link: `/chat?modelId=${lastChatModelId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { label: '应用', icon: 'model', link: `/model?modelId=${lastModelId}`, activeLink: ['/model'] }, { label: '知识库', icon: 'kb', link: `/kb`, activeLink: ['/kb'] }, { label: '市场', icon: 'appStore', link: '/model/share', activeLink: ['/model/share'] }, { label: '账号', icon: 'user', link: '/number', activeLink: ['/number'] } ], [lastChatId, lastChatModelId, lastModelId] ); const itemStyles: any = { my: 3, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', w: '54px', h: '54px', borderRadius: 'md', _hover: { color: '#ffffff' } }; return ( {/* logo */} router.push('/number')} > {/* 导航列表 */} {navbarList.map((item) => ( {item.label} ))} {unread > 0 && ( )} ); }; export default Navbar;