import React from 'react'; import { Thread } from '../../stores/annotationStore'; import { getAuthorColor, getAuthorInitial } from '../../utils/authorColors'; import { relativeTime, fullTimestamp } from '../../utils/relativeTime'; import { TEXT_PRIMARY, TEXT_SECONDARY, TEXT_MUTED, STATUS_OPEN, STATUS_RESOLVED, BORDER, HOVER_BG, FOCUSED_BG, ACCENT, } from './feedbackStyles'; interface ThreadListItemProps { thread: Thread; pinNumber: number; onClick: () => void; focused?: boolean; } export default function ThreadListItem({ thread, pinNumber, onClick, focused }: ThreadListItemProps) { const firstComment = thread.comments[0]; const isResolved = thread.status === 'resolved'; return (
{ if (!focused) e.currentTarget.style.background = HOVER_BG; }} onMouseLeave={(e) => { if (!focused) e.currentTarget.style.background = 'transparent'; }} > {/* Row 1: author circle + name + timestamp */}
{getAuthorInitial(firstComment?.author_name || '?')} {firstComment?.author_name || 'Unknown'} {relativeTime(thread.last_commented_at || thread.created_at)}
{/* Row 2: comment preview */} {firstComment && (
{firstComment.content}
)} {/* Row 3: meta — replies, status */}
{thread.comment_count > 1 && ( {thread.comment_count - 1} {thread.comment_count === 2 ? 'reply' : 'replies'} )} {thread.status}
); }