import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { Checkbox } from '@/components/ui/checkbox' import { buildProfileUrl } from '@/lib/utils' import type { EngagementAccount } from '@/types' interface AccountCardProps { account: EngagementAccount selected: boolean onToggle: () => void } const RELATIONSHIP_STYLE = { mutual: { label: 'Mutual', badgeClass: 'border-[var(--fo-mutual-border)] bg-[var(--fo-mutual-bg)] text-[var(--fo-mutual)]', ringClass: 'ring-1 ring-[var(--fo-mutual)]/15', }, following: { label: 'Following', badgeClass: 'border-[var(--fo-following-border)] bg-[var(--fo-following-bg)] text-[var(--fo-following)]', ringClass: 'ring-1 ring-[var(--fo-following)]/15', }, follower: { label: 'Follows you', badgeClass: 'border-[var(--fo-follower-border)] bg-[var(--fo-follower-bg)] text-[var(--fo-follower)]', ringClass: '', }, none: null, } as const const TYPE_LABEL: Record = { op: 'OP', like: 'Liked', repost: 'Reposted', quote: 'Quoted', reply: 'Replied', } export function AccountCard({ account, selected, onToggle }: AccountCardProps) { const { profile, relationship, engagementTypes, comments, commentCount } = account const relStyle = RELATIONSHIP_STYLE[relationship] const hasComments = !!comments?.length // comments arrive capped server-side; commentCount carries the true total const hiddenComments = hasComments ? (commentCount ?? comments!.length) - comments!.length : 0 return (
e.stopPropagation()} className="shrink-0" /> {(profile.displayName ?? profile.handle).charAt(0).toUpperCase()}
e.stopPropagation()} > {profile.displayName ?? profile.handle} {relStyle && ( {relStyle.label} )}

@{profile.handle}

{hasComments && (
{comments!.map((comment) => (

{comment.text}

))} {hiddenComments > 0 && (

+{hiddenComments} more

)}
)}
{engagementTypes.map((type) => ( {TYPE_LABEL[type] ?? type} ))}
) }