Skip to content

Commit

Permalink
[MOD] removed message dates if identical
Browse files Browse the repository at this point in the history
  • Loading branch information
adbusnel committed Aug 13, 2024
1 parent dd38e11 commit 0e1ec8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Components/ChatRoom/message.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Message = ({ message, participants, next }) => {
const [fileURL, setFileURL] = useState(null)
const [isMyMessage, setIsMyMessage] = useState(message.user === localStorage.getItem('id'))
const messageUser = participants.find(item => item._id === message.user)
console.log(next)

useEffect(() => {
setIsMyMessage(message.user === localStorage.getItem('id'))
if (message.contentType === 'file') {
Expand Down Expand Up @@ -89,7 +89,7 @@ const Message = ({ message, participants, next }) => {
{
(next !== undefined && next.user === message.user) ? <span className="img image-right" /> : (isMyMessage ? <img className='img image-right' src={messageUser?.picture ? messageUser.picture : userIcon} alt={userIcon}/> : <img className='img image-left' src={messageUser?.picture ? messageUser.picture : userIcon} alt={userIcon}/>)

Check warning on line 90 in src/Components/ChatRoom/message.jsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 90 in src/Components/ChatRoom/message.jsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 90 in src/Components/ChatRoom/message.jsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}
<span className='message-time'>{moment(message.date).format('DD/MM/YY HH:mm')}</span>
<span className='message-time'>{(next !== undefined && moment(message.date).format('DD/MM/YY HH:mm') === moment(next.date).format('DD/MM/YY HH:mm')) ? '' : moment(message.date).format('DD/MM/YY HH:mm')}</span>
</div>
</div>
)
Expand Down

0 comments on commit 0e1ec8f

Please sign in to comment.