From 509ca92f0ab5078e0fd5ecaa6fa2a2df424993ff Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Mon, 17 Jul 2023 20:52:11 +0800 Subject: [PATCH] fix: phone --- client/src/components/Icon/icons/app.svg | 1 - client/src/components/Icon/icons/fill/app.svg | 2 +- client/src/components/Icon/icons/fill/appStore.svg | 1 + client/src/components/Icon/icons/light/app.svg | 2 +- client/src/components/Icon/icons/light/appStore.svg | 1 + client/src/components/Icon/index.tsx | 7 ++++--- client/src/components/Layout/navbar.tsx | 8 ++++---- client/src/components/Layout/navbarPhone.tsx | 2 +- client/src/pages/chat/components/ToolMenu.tsx | 10 +++++----- client/src/pages/chat/share.tsx | 7 +++++-- client/src/pages/login/index.tsx | 12 +++--------- client/src/pages/tools/index.tsx | 8 ++++---- 12 files changed, 30 insertions(+), 31 deletions(-) delete mode 100644 client/src/components/Icon/icons/app.svg create mode 100644 client/src/components/Icon/icons/fill/appStore.svg create mode 100644 client/src/components/Icon/icons/light/appStore.svg diff --git a/client/src/components/Icon/icons/app.svg b/client/src/components/Icon/icons/app.svg deleted file mode 100644 index f91cc4083..000000000 --- a/client/src/components/Icon/icons/app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/components/Icon/icons/fill/app.svg b/client/src/components/Icon/icons/fill/app.svg index 4dfdd8d23..f91cc4083 100644 --- a/client/src/components/Icon/icons/fill/app.svg +++ b/client/src/components/Icon/icons/fill/app.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/client/src/components/Icon/icons/fill/appStore.svg b/client/src/components/Icon/icons/fill/appStore.svg new file mode 100644 index 000000000..f7a3fc6c3 --- /dev/null +++ b/client/src/components/Icon/icons/fill/appStore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/components/Icon/icons/light/app.svg b/client/src/components/Icon/icons/light/app.svg index 852db438a..4f4f4d354 100644 --- a/client/src/components/Icon/icons/light/app.svg +++ b/client/src/components/Icon/icons/light/app.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/client/src/components/Icon/icons/light/appStore.svg b/client/src/components/Icon/icons/light/appStore.svg new file mode 100644 index 000000000..3831177cc --- /dev/null +++ b/client/src/components/Icon/icons/light/appStore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/components/Icon/index.tsx b/client/src/components/Icon/index.tsx index 32d1b0060..de8208166 100644 --- a/client/src/components/Icon/index.tsx +++ b/client/src/components/Icon/index.tsx @@ -3,7 +3,8 @@ import type { IconProps } from '@chakra-ui/react'; import { Icon } from '@chakra-ui/react'; const map = { - app: require('./icons/app.svg').default, + appFill: require('./icons/fill/app.svg').default, + appLight: require('./icons/light/app.svg').default, copy: require('./icons/copy.svg').default, chatSend: require('./icons/chatSend.svg').default, delete: require('./icons/delete.svg').default, @@ -43,8 +44,8 @@ const map = { shareLight: require('./icons/light/share.svg').default, dbLight: require('./icons/light/db.svg').default, dbFill: require('./icons/fill/db.svg').default, - appLight: require('./icons/light/app.svg').default, - appFill: require('./icons/fill/app.svg').default, + appStoreLight: require('./icons/light/appStore.svg').default, + appStoreFill: require('./icons/fill/appStore.svg').default, meLight: require('./icons/light/me.svg').default, meFill: require('./icons/fill/me.svg').default, welcomeText: require('./icons/modules/welcomeText.svg').default, diff --git a/client/src/components/Layout/navbar.tsx b/client/src/components/Layout/navbar.tsx index ccad6dc3d..7f81a5ea9 100644 --- a/client/src/components/Layout/navbar.tsx +++ b/client/src/components/Layout/navbar.tsx @@ -29,8 +29,8 @@ const Navbar = ({ unread }: { unread: number }) => { }, { label: '应用', - icon: 'tabbarModel', - activeIcon: 'app', + icon: 'appLight', + activeIcon: 'appFill', link: `/app/list`, activeLink: ['/app/list', '/app/detail'] }, @@ -43,8 +43,8 @@ const Navbar = ({ unread }: { unread: number }) => { }, { label: '市场', - icon: 'appLight', - activeIcon: 'appFill', + icon: 'appStoreLight', + activeIcon: 'appStoreFill', link: '/appStore', activeLink: ['/appStore'] }, diff --git a/client/src/components/Layout/navbarPhone.tsx b/client/src/components/Layout/navbarPhone.tsx index de4948b55..f25bd0cbb 100644 --- a/client/src/components/Layout/navbarPhone.tsx +++ b/client/src/components/Layout/navbarPhone.tsx @@ -12,7 +12,7 @@ const NavbarPhone = ({ unread }: { unread: number }) => { () => [ { label: '聊天', - icon: 'tabbarChat', + icon: 'chatLight', link: `/chat?appId=${lastChatAppId}&historyId=${lastHistoryId}`, activeLink: ['/chat'], unread: 0 diff --git a/client/src/pages/chat/components/ToolMenu.tsx b/client/src/pages/chat/components/ToolMenu.tsx index 62ef9a0c5..b8c6fb448 100644 --- a/client/src/pages/chat/components/ToolMenu.tsx +++ b/client/src/pages/chat/components/ToolMenu.tsx @@ -7,11 +7,11 @@ import MyIcon from '@/components/Icon'; const ToolMenu = ({ history }: { history: ChatItemType[] }) => { const { onExportChat } = useChatBox(); const menuList = useRef([ - { - icon: 'shareLight', - label: '分享对话', - onClick: () => {} - }, + // { + // icon: 'shareLight', + // label: '分享对话', + // onClick: () => {} + // }, { icon: 'apiLight', label: 'HTML导出', diff --git a/client/src/pages/chat/share.tsx b/client/src/pages/chat/share.tsx index 14ccb5cf4..b56cb1b48 100644 --- a/client/src/pages/chat/share.tsx +++ b/client/src/pages/chat/share.tsx @@ -10,12 +10,15 @@ import { useShareChatStore, defaultHistory } from '@/store/shareChat'; import SideBar from '@/components/SideBar'; import { gptMessage2ChatType } from '@/utils/adapt'; import { getErrText } from '@/utils/tools'; - +import dynamic from 'next/dynamic'; import ChatBox, { type ComponentRef, type StartChatFnProps } from '@/components/ChatBox'; import PageContainer from '@/components/PageContainer'; -import ChatHistorySlider from './components/ChatHistorySlider'; import ChatHeader from './components/ChatHeader'; +const ChatHistorySlider = dynamic(() => import('./components/ChatHistorySlider'), { + ssr: false +}); + const ShareChat = ({ shareId, historyId }: { shareId: string; historyId: string }) => { const router = useRouter(); const { toast } = useToast(); diff --git a/client/src/pages/login/index.tsx b/client/src/pages/login/index.tsx index fd4db5c88..c253e1f4a 100644 --- a/client/src/pages/login/index.tsx +++ b/client/src/pages/login/index.tsx @@ -17,7 +17,7 @@ const Login = () => { const { lastRoute = '' } = router.query as { lastRoute: string }; const { isPc } = useGlobalStore(); const [pageType, setPageType] = useState<`${PageTypeEnum}`>(PageTypeEnum.login); - const { setUserInfo, loadKbList, setLastKbId } = useUserStore(); + const { setUserInfo } = useUserStore(); const { setLastHistoryId, setLastChatAppId } = useChatStore(); const loginSuccess = useCallback( @@ -25,15 +25,13 @@ const Login = () => { // init store setLastHistoryId(''); setLastChatAppId(''); - setLastKbId(''); - loadKbList(true); setUserInfo(res.user); setTimeout(() => { - router.push(lastRoute ? decodeURIComponent(lastRoute) : '/model'); + router.push(lastRoute ? decodeURIComponent(lastRoute) : '/app/list'); }, 100); }, - [lastRoute, loadKbList, router, setLastHistoryId, setLastChatAppId, setLastKbId, setUserInfo] + [lastRoute, router, setLastHistoryId, setLastChatAppId, setUserInfo] ); function DynamicComponent({ type }: { type: `${PageTypeEnum}` }) { @@ -48,10 +46,6 @@ const Login = () => { return ; } - useEffect(() => { - router.prefetch('/model'); - }, [router]); - return (