Files
owncast/web/components/chat/ChatJoinMessage/ChatJoinMessage.tsx
T
ab06b218e3 Fix: Fix to show color when user join the chat (#4706)
* Fix: Fix to show color when user join the chat

* Changes to restore unnecesary changes

* Deleting unnecesary changes

* Identation issues fixed

* fix(js): run prettier against changed code

---------

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
2025-12-26 16:45:30 -08:00

53 lines
1.4 KiB
TypeScript

import { FC } from 'react';
import dynamic from 'next/dynamic';
import { ModerationBadge } from '../ChatUserBadge/ModerationBadge';
import { Translation } from '../../ui/Translation/Translation';
import { Localization } from '../../../types/localization';
import styles from './ChatJoinMessage.module.scss';
// Lazy loaded components
const UsergroupAddOutlined = dynamic(() => import('@ant-design/icons/UsergroupAddOutlined'), {
ssr: false,
});
export type ChatJoinMessageProps = {
isAuthorModerator: boolean;
userColor: number;
displayName: string;
};
export const ChatJoinMessage: FC<ChatJoinMessageProps> = ({
isAuthorModerator,
userColor,
displayName,
}) => {
const color = userColor !== undefined ? `var(--theme-color-users-${userColor})` : 'inherit';
return (
<div className={styles.root}>
<span style={{ color }}>
<span className={styles.icon}>
<UsergroupAddOutlined />
</span>
{isAuthorModerator && (
<span className={styles.moderatorBadge}>
<ModerationBadge userColor={userColor} />
</span>
)}
<span className={styles.joinMessage}>
<span className={styles.user} style={{ color }}>
{displayName}
</span>
<span> </span>
<Translation
translationKey={Localization.Frontend.Chat.userJoined}
defaultText="joined the chat."
/>
</span>
</span>
</div>
);
};