Skip to content

Commit

Permalink
feat: add online status in user popover
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Sep 2, 2023
1 parent 56c042d commit 1b813f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion client/web/src/components/UserProfileContainer.tsx
Original file line number Diff line number Diff line change
@@ -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';

/**
* 用户信息容器
Expand All @@ -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) {
Expand All @@ -35,6 +37,7 @@ export const UserProfileContainer: React.FC<
size={80}
src={userInfo.avatar}
name={userInfo.nickname}
isOnline={isOnline}
/>
</div>

Expand Down
1 change: 0 additions & 1 deletion server/models/chat/ack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
prop,
DocumentType,
Ref,
ReturnModelType,
index,
} from '@typegoose/typegoose';
import type { Base } from '@typegoose/typegoose/lib/defaultClasses';
Expand Down

0 comments on commit 1b813f9

Please sign in to comment.