2022-08-11 06:22:00 +03:00
|
|
|
/* eslint-disable react/no-danger */
|
|
|
|
import { Highlight } from 'react-highlighter-ts';
|
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
2022-07-15 23:15:20 +03:00
|
|
|
import s from './ChatSystemMessage.module.scss';
|
|
|
|
|
|
|
|
interface Props {
|
2022-08-11 06:22:00 +03:00
|
|
|
message: ChatMessage;
|
|
|
|
highlightString: string;
|
2022-07-15 23:15:20 +03:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2022-08-11 06:22:00 +03:00
|
|
|
export default function ChatSystemMessage({ message, highlightString }: Props) {
|
|
|
|
const { body, user } = message;
|
|
|
|
const { displayName } = user;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={s.chatSystemMessage}>
|
|
|
|
<div className={s.user}>
|
|
|
|
<span className={s.userName}>{displayName}</span>
|
|
|
|
</div>
|
|
|
|
<Highlight search={highlightString}>
|
|
|
|
<div className={s.message} dangerouslySetInnerHTML={{ __html: body }} />
|
|
|
|
</Highlight>
|
|
|
|
</div>
|
|
|
|
);
|
2022-07-15 23:15:20 +03:00
|
|
|
}
|