fix chat quote reader (#4125)

This commit is contained in:
heheer
2025-03-12 18:09:41 +08:00
committed by archer
parent 19f0f110e2
commit 8bc29e6527
14 changed files with 167 additions and 125 deletions

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import NextHead from '@/components/common/NextHead';
import { getTeamChatInfo } from '@/web/core/chat/api';
import { useRouter } from 'next/router';
@@ -70,6 +70,14 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
const chatRecords = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
const totalRecordsCount = useContextSelector(ChatRecordContext, (v) => v.totalRecordsCount);
const [sidebarFolded, setSidebarFolded] = useState(false);
useEffect(() => {
if (quoteData) {
setSidebarFolded(true);
}
}, [quoteData]);
// get chat app info
const { loading } = useRequest2(
async () => {
@@ -166,7 +174,9 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
);
return isPc || !appId ? (
<SideBar externalTrigger={!!quoteData}>{Children}</SideBar>
<SideBar isFolded={sidebarFolded} onFoldChange={setSidebarFolded}>
{Children}
</SideBar>
) : (
<Drawer
isOpen={isOpenSlider}
@@ -179,7 +189,7 @@ const Chat = ({ myApps }: { myApps: AppListItemType[] }) => {
<DrawerContent maxWidth={'75vw'}>{Children}</DrawerContent>
</Drawer>
);
}, [appId, isOpenSlider, isPc, onCloseSlider, quoteData, t]);
}, [appId, isOpenSlider, isPc, onCloseSlider, t, sidebarFolded]);
return (
<Flex h={'100%'}>