import { getChatDisplayInfo } from "../../utils/chatDisplay"; import TrashIcon from "../icons/TrashIcon"; export default function ChatListItem({ chat, post, unreadMap, t, onOpen, onDelete }) { const { title, imgSrc, emoji, unreadCount, preview } = getChatDisplayInfo(chat, post, unreadMap, t); return (
0 ? " unread" : ""}`} onClick={() => onOpen(chat.id)} >
{imgSrc ? ( ) : ( emoji || chat.otherUserName?.[0] || chat.otherUser?.name?.[0] || "?" )}
{title}
{preview}
{unreadCount > 0 && (
{unreadCount > 99 ? "99+" : unreadCount}
)}
); }