Skip to content

Commit bc7639a

Browse files
committed
Highlight messages that tag you
1 parent 4de066a commit bc7639a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/collaboration/src/chatbox.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ interface ChatBoxMessageProps {
182182

183183
const ChatBoxMessage: React.FC<ChatBoxMessageProps> = ({message, user, currentUser}) => {
184184

185+
const tagged = message.includes(`@${currentUser.identity!.name}`);
186+
187+
const messageClass = tagged ? 'jp-Chat-Message-tagged' : 'jp-Chat-Message';
188+
185189
// Adds line breaks back to the message
186190
const lineBreaksMessage = message.split('\n').map((line, index, array) => (
187191
<React.Fragment key={index}>
@@ -191,7 +195,7 @@ const ChatBoxMessage: React.FC<ChatBoxMessageProps> = ({message, user, currentUs
191195
));
192196

193197
return (
194-
<div className='jp-Chat-Message'>
198+
<div className={messageClass}>
195199
<div style={{ display: 'flex', alignItems: 'center' }}>
196200

197201
<strong style={{ marginRight: '5px', textDecoration: ((user === currentUser.identity!.name) ? 'underline' : 'none')}}>{user}</strong>

packages/collaboration/style/sidepanel.css

+6
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@
182182
margin-bottom: 8px;
183183
}
184184

185+
.jp-Chat-Message-tagged {
186+
word-wrap: break-word;
187+
margin-bottom: 8px;
188+
background-color: #727272;
189+
}
190+
185191
/************************************************************
186192
Poll Panel
187193
*************************************************************/

0 commit comments

Comments
 (0)