feat: add online status in user popover

pull/150/head
moonrailgun 2 years ago
parent 56c042ddd5
commit 1b813f9b82

@ -1,7 +1,7 @@
import { fetchImagePrimaryColor } from '@/utils/image-helper';
import React, { PropsWithChildren } from 'react';
import { AvatarWithPreview, getTextColorHex } from 'tailchat-design';
import { useAsync, UserBaseInfo } from 'tailchat-shared';
import { useAsync, useCachedOnlineStatus, UserBaseInfo } from 'tailchat-shared';
/**
*
@ -10,6 +10,8 @@ export const UserProfileContainer: React.FC<
PropsWithChildren<{ userInfo: UserBaseInfo }>
> = React.memo((props) => {
const { userInfo } = props;
const userId = userInfo._id;
const [isOnline] = useCachedOnlineStatus([userId]);
const { value: bannerColor } = useAsync(async () => {
if (!userInfo.avatar) {
@ -35,6 +37,7 @@ export const UserProfileContainer: React.FC<
size={80}
src={userInfo.avatar}
name={userInfo.nickname}
isOnline={isOnline}
/>
</div>

@ -3,7 +3,6 @@ import {
prop,
DocumentType,
Ref,
ReturnModelType,
index,
} from '@typegoose/typegoose';
import type { Base } from '@typegoose/typegoose/lib/defaultClasses';

Loading…
Cancel
Save