"use client"; import { useState } from "react"; import { useAuth } from "@/hooks/use-auth"; import { followUser, RemoteActor } from "@/lib/api"; import { Button } from "@/components/ui/button"; import { UserAvatar } from "@/components/user-avatar"; import { toast } from "sonner"; import { UserPlus } from "lucide-react"; interface RemoteUserCardProps { actor: RemoteActor; } export function RemoteUserCard({ actor }: RemoteUserCardProps) { const [followed, setFollowed] = useState(false); const [loading, setLoading] = useState(false); const { token } = useAuth(); const handleFollow = async () => { if (!token) { toast.error("You must be logged in to follow users."); return; } setLoading(true); try { await followUser(actor.handle, token); setFollowed(true); toast.success(`Follow request sent to ${actor.handle}`); } catch { toast.error("Failed to send follow request."); } finally { setLoading(false); } }; return (

{actor.displayName ?? actor.handle}

{actor.handle}

); }