diff --git a/src/components/chat/ChatMessage.tsx b/src/components/chat/ChatMessage.tsx index 026a41e..4208884 100644 --- a/src/components/chat/ChatMessage.tsx +++ b/src/components/chat/ChatMessage.tsx @@ -3,6 +3,7 @@ type ChatMessageProps = { accentColor: string; name: string; isSelf: boolean; + hideName?: boolean; }; export const ChatMessage = ({ @@ -10,16 +11,19 @@ export const ChatMessage = ({ message, accentColor, isSelf, + hideName, }: ChatMessageProps) => { return ( -
-
- {name} -
+
+ {!hideName && ( +
+ {name} +
+ )}
{ height: `calc(100% - ${inputHeight}px)`, }} > -
- {messages.map((message, index) => ( - - ))} +
+ {messages.map((message, index, allMsg) => { + const hideName = + index >= 1 && allMsg[index - 1].name === message.name; + + return ( + + ); + })}