2022-05-22 16:10:34 +02:00
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
|
|
|
import s from './ChatUserMessage.module.scss';
|
2022-04-28 08:19:20 +02:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
message: ChatMessage;
|
2022-04-30 00:09:53 +02:00
|
|
|
showModeratorMenu: boolean;
|
2022-04-28 08:19:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function ChatUserMessage(props: Props) {
|
2022-04-30 00:09:53 +02:00
|
|
|
const { message, showModeratorMenu } = props;
|
2022-05-12 08:31:31 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2022-04-30 00:09:53 +02:00
|
|
|
const { body, user, timestamp } = message;
|
2022-05-12 08:31:31 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2022-04-30 00:09:53 +02:00
|
|
|
const { displayName, displayColor } = user;
|
|
|
|
|
2022-05-22 16:10:34 +02:00
|
|
|
const color = `hsl(${displayColor}, 100%, 70%)`;
|
2022-04-30 00:09:53 +02:00
|
|
|
|
|
|
|
return (
|
2022-05-22 16:10:34 +02:00
|
|
|
<div className={s.root} style={{ borderColor: color }}>
|
|
|
|
<div className={s.user} style={{ color }}>
|
|
|
|
{displayName}
|
|
|
|
</div>
|
|
|
|
<div className={s.message}>{body}</div>
|
2022-04-30 00:09:53 +02:00
|
|
|
{showModeratorMenu && <div>Moderator menu</div>}
|
|
|
|
</div>
|
|
|
|
);
|
2022-04-28 08:19:20 +02:00
|
|
|
}
|