Skip to content

Commit

Permalink
Highlight messages that tag you
Browse files Browse the repository at this point in the history
  • Loading branch information
Liototo committed May 24, 2024
1 parent 4de066a commit bc7639a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/collaboration/src/chatbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ interface ChatBoxMessageProps {

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

const tagged = message.includes(`@${currentUser.identity!.name}`);

const messageClass = tagged ? 'jp-Chat-Message-tagged' : 'jp-Chat-Message';

// Adds line breaks back to the message
const lineBreaksMessage = message.split('\n').map((line, index, array) => (
<React.Fragment key={index}>
Expand All @@ -191,7 +195,7 @@ const ChatBoxMessage: React.FC<ChatBoxMessageProps> = ({message, user, currentUs
));

return (
<div className='jp-Chat-Message'>
<div className={messageClass}>
<div style={{ display: 'flex', alignItems: 'center' }}>

<strong style={{ marginRight: '5px', textDecoration: ((user === currentUser.identity!.name) ? 'underline' : 'none')}}>{user}</strong>
Expand Down
6 changes: 6 additions & 0 deletions packages/collaboration/style/sidepanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@
margin-bottom: 8px;
}

.jp-Chat-Message-tagged {
word-wrap: break-word;
margin-bottom: 8px;
background-color: #727272;
}

/************************************************************
Poll Panel
*************************************************************/
Expand Down

0 comments on commit bc7639a

Please sign in to comment.