import React, { useMemo } from 'react'; import { useRouter } from 'next/router'; import MyIcon from '../Icon'; import { Flex, Box } from '@chakra-ui/react'; import { useChatStore } from '@/store/chat'; import Badge from '../Badge'; const NavbarPhone = ({ unread }: { unread: number }) => { const router = useRouter(); const { lastChatModelId, lastChatId } = useChatStore(); const navbarList = useMemo( () => [ { label: '聊天', icon: 'tabbarChat', link: `/chat?appId=${lastChatModelId}&chatId=${lastChatId}`, activeLink: ['/chat'], unread: 0 }, { label: '应用', icon: 'tabbarModel', link: `/app/list`, activeLink: ['/app/list'], unread: 0 }, { label: '工具', icon: 'tabbarMore', link: '/tools', activeLink: ['/tools'], unread: 0 }, { label: '我的', icon: 'tabbarMe', link: '/number', activeLink: ['/number'], unread } ], [lastChatId, lastChatModelId, unread] ); return ( <> {navbarList.map((item) => ( { if (item.link === router.asPath) return; router.push(item.link); }} > {item.label} ))} ); }; export default NavbarPhone;