@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next"
33import { useVirtualizer } from "@tanstack/react-virtual"
44
55import { useMessageSender } from "@/hooks/use-message-sender"
6+ import { decodeUtf8Hex } from "@/lib/message-content"
67import { DidAvatar } from "@/components/shared/DidAvatar"
78import { useIdentityStore } from "@/stores/identity"
89import { useContactStore } from "@/stores/contact"
@@ -153,8 +154,8 @@ export function MessageList({ messages }: MessageListProps) {
153154 )
154155 }
155156
156- const senderHint = row . value . sealedHeader
157- const isSelf = selfDid ? senderHint . includes ( selfDid . slice ( - 8 ) ) : false
157+ const senderDid = decodeUtf8Hex ( row . value . sealedHeader )
158+ const isSelf = ! ! ( selfDid && senderDid && senderDid === selfDid )
158159 const avatarDid = isSelf
159160 ? ( selfDid ?? "did:claw:me" )
160161 : ( peerDid ?? "did:claw:unknown" )
@@ -172,15 +173,20 @@ export function MessageList({ messages }: MessageListProps) {
172173 data-index = { virtualItem . index }
173174 ref = { rowVirtualizer . measureElement }
174175 >
175- < div className = { `flex items-end gap-2 py-[3px] ${ isSelf ? "flex-row-reverse justify-end" : "flex-row justify-start" } ` } >
176- < DidAvatar did = { avatarDid } avatarUrl = { avatarUrl } className = "size-8 shrink-0 rounded-full" />
177- < div className = "min-w-0" style = { { maxWidth : "min(720px, 80%)" } } >
176+ < div className = { `flex items-end gap-2 py-[3px] ${ isSelf ? "justify-end" : "justify-start" } ` } >
177+ { ! isSelf && (
178+ < DidAvatar did = { avatarDid } avatarUrl = { avatarUrl } className = "size-8 shrink-0 rounded-full" />
179+ ) }
180+ < div style = { { maxWidth : "min(720px, 80%)" } } >
178181 < MemoMessageBubble
179182 message = { row . value }
180183 align = { isSelf ? "right" : "left" }
181184 onRetry = { handleRetry }
182185 />
183186 </ div >
187+ { isSelf && (
188+ < DidAvatar did = { avatarDid } avatarUrl = { avatarUrl } className = "size-8 shrink-0 rounded-full" />
189+ ) }
184190 </ div >
185191 </ div >
186192 )
0 commit comments