import type { LucideIcon } from "lucide-react" import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { Card, CardContent } from "@/components/ui/card" import { Skeleton } from "@/components/ui/skeleton" import { EmptyState } from "@/components/empty-state" import type { ActorListResponse, RemoteActorDto } from "@/features/social" type ActorListProps = { data: ActorListResponse | undefined isPending: boolean emptyIcon: LucideIcon emptyTitle: string emptyDescription?: string renderAction?: (actor: RemoteActorDto) => React.ReactNode } export function ActorList({ data, isPending, emptyIcon, emptyTitle, emptyDescription, renderAction }: ActorListProps) { if (isPending) return if (!data?.actors.length) return return (
{data.actors.map((actor) => ( ))}
) } function actorHandle(actor: RemoteActorDto): string { try { const host = new URL(actor.url).host return `@${actor.handle}@${host}` } catch { return `@${actor.handle}` } } function ActorCard({ actor, action }: { actor: RemoteActorDto; action?: React.ReactNode }) { const initial = (actor.display_name || actor.handle)[0]?.toUpperCase() ?? "?" return ( {initial}

{actor.display_name || actor.handle}

{actorHandle(actor)}

{action}
) } function ListSkeleton() { return (
{[1, 2, 3].map((i) => ( ))}
) }