From 5484cb7df13bc84bf3f692a47d5a8f6bde35608f Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 22 Aug 2023 14:06:13 +0800 Subject: [PATCH] fix: fix add friend button still display when disableAddFriend is open --- .../Main/Content/Personal/Friends/FriendList.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/web/src/routes/Main/Content/Personal/Friends/FriendList.tsx b/client/web/src/routes/Main/Content/Personal/Friends/FriendList.tsx index 502f60a6..3fdffda9 100644 --- a/client/web/src/routes/Main/Content/Personal/Friends/FriendList.tsx +++ b/client/web/src/routes/Main/Content/Personal/Friends/FriendList.tsx @@ -11,11 +11,12 @@ import { useAppSelector, useAsyncRequest, useEvent, + useGlobalConfigStore, userActions, } from 'tailchat-shared'; import { UserListItem } from '@/components/UserListItem'; import { IconBtn } from '@/components/IconBtn'; -import { Button, Dropdown, Menu, Tooltip } from 'antd'; +import { Button, Dropdown, Tooltip } from 'antd'; import { useNavigate } from 'react-router'; import { Problem } from '@/components/Problem'; import { closeModal, openModal } from '@/components/Modal'; @@ -30,6 +31,9 @@ export const FriendList: React.FC<{ const friends = useAppSelector((state) => state.user.friends); const navigate = useNavigate(); const dispatch = useAppDispatch(); + const disableAddFriend = useGlobalConfigStore( + (state) => state.disableAddFriend + ); const [, handleCreateConverse] = useAsyncRequest( async (targetId: string) => { @@ -73,9 +77,11 @@ export const FriendList: React.FC<{ text={

{t('暂无好友')}

- + {!disableAddFriend && ( + + )}
} />