From eb448d9bb83450dedbc00dd4025e74757e226c37 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Tue, 23 Sep 2025 11:09:02 +0800 Subject: [PATCH] fix avatar background color --- web/app/components/workflow/comment/thread.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/comment/thread.tsx b/web/app/components/workflow/comment/thread.tsx index c17a0f18fc..f8292c9abb 100644 --- a/web/app/components/workflow/comment/thread.tsx +++ b/web/app/components/workflow/comment/thread.tsx @@ -11,6 +11,7 @@ import { useFormatTimeFromNow } from '@/app/components/workflow/hooks' import type { WorkflowCommentDetail, WorkflowCommentDetailReply } from '@/service/workflow-comment' import { useAppContext } from '@/context/app-context' import { MentionInput } from './mention-input' +import { getUserColor } from '@/app/components/workflow/collaboration/utils/user-color' type CommentThreadProps = { comment: WorkflowCommentDetail @@ -28,12 +29,17 @@ type CommentThreadProps = { } const ThreadMessage: FC<{ + authorId: string authorName: string avatarUrl?: string | null createdAt: number content: string -}> = ({ authorName, avatarUrl, createdAt, content }) => { +}> = ({ authorId, authorName, avatarUrl, createdAt, content }) => { const { formatTimeFromNow } = useFormatTimeFromNow() + const { userProfile } = useAppContext() + const currentUserId = userProfile?.id + const isCurrentUser = authorId === currentUserId + const userColor = isCurrentUser ? undefined : getUserColor(authorId) return (
@@ -43,6 +49,7 @@ const ThreadMessage: FC<{ avatar={avatarUrl || null} size={24} className={cn('h-8 w-8 rounded-full')} + backgroundColor={userColor} />
@@ -183,6 +190,7 @@ export const CommentThread: FC = memo(({
= memo(({
) : (