Skip to content

Commit

Permalink
feat(web): update MessgeItems on chat
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocroh committed Jun 11, 2024
1 parent c62de48 commit d6b1b2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions apps/web/app/room/[slug]/components/message-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const MessageItem: React.FC<MessageItem> = ({ message }) => {
<div
className={clsx(
'flex items-center gap-3',
isMe ? 'justify-start' : 'justify-end'
isMe ? 'justify-end' : 'justify-start'
)}
>
<span
Expand All @@ -21,7 +21,6 @@ export const MessageItem: React.FC<MessageItem> = ({ message }) => {
isMe ? 'bg-accent' : 'bg-purple-950'
)}
>
<span className="text-sm font-semibold">{message.sender}</span>:{' '}
<span className="text-sm">{message.content}</span>
</span>
</div>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/app/room/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default function Page(): JSX.Element {
})

peerRef.current?.on('data', (message) => {
console.log({ message })
setMessages((prevMessages) => [
...prevMessages,
{ sender: 'other', content: message.toString() },
Expand Down Expand Up @@ -152,6 +153,8 @@ export default function Page(): JSX.Element {
}
)

console.log({ messages })

useEffect(() => {
return () => {
peerRef.current?.destroy()
Expand Down

0 comments on commit d6b1b2e

Please sign in to comment.