2022-09-07 10:00:28 +03:00
|
|
|
import { FC } from 'react';
|
2023-01-16 09:31:36 +03:00
|
|
|
import dynamic from 'next/dynamic';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { ChatUserBadge } from '../ChatUserBadge/ChatUserBadge';
|
2022-10-03 11:15:00 +03:00
|
|
|
import styles from './ChatJoinMessage.module.scss';
|
2022-08-22 01:50:22 +03:00
|
|
|
|
2023-01-16 09:31:36 +03:00
|
|
|
// Lazy loaded components
|
|
|
|
|
|
|
|
const TeamOutlined = dynamic(() => import('@ant-design/icons/TeamOutlined'), {
|
|
|
|
ssr: false,
|
|
|
|
});
|
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
export type ChatJoinMessageProps = {
|
2022-08-22 01:50:22 +03:00
|
|
|
isAuthorModerator: boolean;
|
|
|
|
userColor: number;
|
|
|
|
displayName: string;
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2022-08-22 01:50:22 +03:00
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
export const ChatJoinMessage: FC<ChatJoinMessageProps> = ({
|
|
|
|
isAuthorModerator,
|
|
|
|
userColor,
|
|
|
|
displayName,
|
|
|
|
}) => {
|
2022-10-03 11:15:00 +03:00
|
|
|
const color = `var(--theme-color-users-${userColor})`;
|
2022-08-22 01:50:22 +03:00
|
|
|
|
|
|
|
return (
|
2022-10-03 11:15:00 +03:00
|
|
|
<div className={styles.root}>
|
2022-08-22 01:50:22 +03:00
|
|
|
<span style={{ color }}>
|
2022-10-03 11:15:00 +03:00
|
|
|
<span style={{ padding: '0 10px' }}>
|
|
|
|
<TeamOutlined />
|
|
|
|
</span>
|
|
|
|
<span style={{ fontWeight: 'bold' }}>{displayName}</span>
|
2022-08-22 01:50:22 +03:00
|
|
|
{isAuthorModerator && (
|
|
|
|
<span>
|
|
|
|
<ChatUserBadge badge="mod" userColor={userColor} />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</span>{' '}
|
|
|
|
joined the chat.
|
|
|
|
</div>
|
|
|
|
);
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|