11import { UserRound } from "lucide-react" ;
22import { formatRelativeTime } from "@/utils/formatChatTime" ;
3+ import { normalizeImageUrl } from "@/utils/normalizeImageUrl" ;
34import type { ChatRoomListItem } from "@/types/chat" ;
45
56interface ChatListItemProps {
@@ -8,49 +9,46 @@ interface ChatListItemProps {
89}
910
1011export default function ChatListItem ( { room, onClick } : ChatListItemProps ) {
11- const { context, counterparty, lastMessage, unreadCount, lastMessageAt } =
12- room ;
12+ const { context, counterparty, lastMessage, unreadCount, lastMessageAt } = room ;
1313 const relativeTime = formatRelativeTime ( lastMessageAt ) ;
14+ const profileImageUrl = normalizeImageUrl ( counterparty . profileImage ) ;
1415
1516 return (
1617 < li >
1718 < button
1819 type = "button"
1920 onClick = { onClick }
20- className = "flex w-full items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-bg-primary-darker "
21+ className = "hover:bg-bg-primary-darker flex w-full items-center gap-4 px-5 py-4 text-left transition-colors"
2122 >
2223 { /* 아바타: profileImage 없으면 placeholder (시안 갭) */ }
23- { counterparty . profileImage ? (
24+ { profileImageUrl ? (
2425 // eslint-disable-next-line @next/next/no-img-element
2526 < img
26- src = { counterparty . profileImage }
27+ src = { profileImageUrl }
2728 alt = ""
28- className = "h-12 w-12 shrink-0 rounded-full border border-border-primary object-cover"
29+ className = "border-border-primary h-12 w-12 shrink-0 rounded-full border object-cover"
2930 />
3031 ) : (
3132 < div
3233 aria-hidden
33- className = "flex h-12 w-12 shrink-0 items-center justify-center rounded-full border border-border-primary bg-bg-primary-darker text-text-disabled "
34+ className = "border-border-primary bg-bg-primary-darker text-text-disabled flex h-12 w-12 shrink-0 items-center justify-center rounded-full border"
3435 >
3536 < UserRound size = { 24 } />
3637 </ div >
3738 ) }
3839
3940 < div className = "flex min-w-0 flex-1 flex-col gap-1" >
4041 { /* 작품/공간 이름 */ }
41- < div className = "truncate text-body-1 font-semibold text-text-primary" >
42+ < div className = "text-body-1 text-text-primary truncate font-semibold " >
4243 { context . title ?? "대화 중인 작품/공간" }
4344 </ div >
4445
4546 { /* 닉네임 · 시각 (2px 점 구분) */ }
46- < div className = "flex items-center gap-1 text-label font-regular text-text-secondary" >
47+ < div className = "text-label font-regular text-text-secondary flex items-center gap-1 " >
4748 < span className = "truncate" > { counterparty . nickname ?? "상대방" } </ span >
4849 { relativeTime && (
4950 < >
50- < span
51- aria-hidden
52- className = "size-0.5 shrink-0 rounded-full bg-text-secondary"
53- />
51+ < span aria-hidden className = "bg-text-secondary size-0.5 shrink-0 rounded-full" />
5452 < span className = "shrink-0" > { relativeTime } </ span >
5553 </ >
5654 ) }
@@ -59,11 +57,11 @@ export default function ChatListItem({ room, onClick }: ChatListItemProps) {
5957 { /* 마지막 메시지 + 안읽음 배지 (양 끝 정렬) */ }
6058 { ( lastMessage || unreadCount > 0 ) && (
6159 < div className = "flex items-center justify-between gap-2" >
62- < div className = "min-w-0 flex-1 truncate text-label font-regular text-text-secondary" >
60+ < div className = "text-label font-regular text-text-secondary min-w-0 flex-1 truncate " >
6361 { lastMessage ?? "" }
6462 </ div >
6563 { unreadCount > 0 && (
66- < span className = "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-object-red px-1.5 text-caption font-regular text-text-invert " >
64+ < span className = "bg-object-red text-caption font-regular text-text-invert flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5" >
6765 { unreadCount }
6866 </ span >
6967 ) }
0 commit comments