import { Avatar } from '@/components/Avatar';
import { Highlight } from '@/components/Highlight';
import { Button, Divider, Empty, Typography } from 'antd';
import {
addFriendRequest,
searchUserWithUniqueName,
showErrorToasts,
showToasts,
t,
Trans,
useAppSelector,
useAsyncFn,
UserBaseInfo,
} from 'tailchat-shared';
import React, { useCallback, useState } from 'react';
import _isNil from 'lodash/isNil';
const SearchFriendResult: React.FC<{
result: UserBaseInfo | undefined | null;
}> = React.memo(({ result }) => {
const [hasSentUserId, setHasSentUserId] = useState(''); // 记录已发送的
const handleAddFriend = useCallback(async (userId: string) => {
try {
await addFriendRequest(userId);
setHasSentUserId(userId);
showToasts(t('已发送申请'), 'success');
} catch (err) {
showErrorToasts(err);
}
}, []);
if (result === undefined) {
return null;
}
if (result === null) {
return