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'; export enum NavbarTypeEnum { normal = 'normal', small = 'small' } const Navbar = ({ unread }: { unread: number }) => { const router = useRouter(); const { userInfo } = useUserStore(); const { lastChatAppId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: '聊天', icon: 'chatLight', activeIcon: 'chatFill', link: `/chat?appId=${lastChatAppId}&chatId=${lastChatId}`, activeLink: ['/chat'] }, { label: '应用', icon: 'appLight', activeIcon: 'appFill', link: `/app/list`, activeLink: ['/app/list', '/app/detail'] }, { label: '知识库', icon: 'dbLight', activeIcon: 'dbFill', link: `/kb/list`, activeLink: ['/kb/list', '/kb/detail'] }, ...(feConfigs.show_appStore ? [ { label: '市场', icon: 'appStoreLight', activeIcon: 'appStoreFill', link: '/appStore', activeLink: ['/appStore'] } ] : []), { label: '账号', icon: 'meLight', activeIcon: 'meFill', link: '/number', activeLink: ['/number'] } ], [lastChatId, lastChatAppId] ); 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('/number')} > {/* 导航列表 */} {navbarList.map((item) => ( router.push(item.link)} > {item.label} ))} {unread > 0 && ( )} {feConfigs.show_git && ( )} ); }; export default Navbar;