mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
28 lines
860 B
TypeScript
28 lines
860 B
TypeScript
import { Box, HStack, type StackProps } from '@chakra-ui/react';
|
|
import { type SourceMemberType } from '@fastgpt/global/support/user/type';
|
|
import React from 'react';
|
|
import Avatar from '../Avatar';
|
|
import { useTranslation } from 'next-i18next';
|
|
import Tag from '../Tag';
|
|
|
|
export type UserBoxProps = {
|
|
sourceMember: SourceMemberType;
|
|
avatarSize?: string;
|
|
} & StackProps;
|
|
|
|
function UserBox({ sourceMember, avatarSize = '1.25rem', ...props }: UserBoxProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<HStack space="1" {...props}>
|
|
<Avatar src={sourceMember.avatar} w={avatarSize} />
|
|
<Box maxW={'150px'} whiteSpace={'nowrap'} overflow={'hidden'}>
|
|
{sourceMember.name}
|
|
</Box>
|
|
{sourceMember.status === 'leave' && <Tag color="gray">{t('common:user_leaved')}</Tag>}
|
|
</HStack>
|
|
);
|
|
}
|
|
|
|
export default React.memo(UserBox);
|