Use user color for name change messages

This commit is contained in:
Gabe Kangas 2022-06-28 20:40:18 -07:00
parent 23e3751303
commit 5e4334ac01
No known key found for this signature in database
GPG key ID: 9A56337728BC81EA

View file

@ -7,7 +7,6 @@ import { MessageType, NameChangeEvent } from '../../../interfaces/socket-events'
import s from './ChatContainer.module.scss';
import { ChatMessage } from '../../../interfaces/chat-message.model';
import { ChatUserMessage } from '..';
import ChatActionMessage from '../ChatActionMessage';
interface Props {
messages: ChatMessage[];
@ -24,11 +23,15 @@ export default function ChatContainer(props: Props) {
const spinIcon = <LoadingOutlined style={{ fontSize: '32px' }} spin />;
const getNameChangeViewForMessage = (message: NameChangeEvent) => {
const { oldName } = message;
const { user } = message;
const { displayName } = user;
const body = `<strong>${oldName}</strong> is now known as <strong>${displayName}</strong>`;
return <ChatActionMessage body={body} />;
const { oldName, user } = message;
const { displayName, displayColor } = user;
const color = `var(--theme-user-colors-${displayColor})`;
return (
<div>
<span style={{ color }}>{oldName}</span> is now known as {displayName}
</div>
);
};
const getViewForMessage = message => {