"use client"; import { useEffect, useState } from "react"; import { getRemoteFollowing, unfollowRemoteActor, type RemoteActor } from "@/lib/api"; import { useAuth } from "@/hooks/use-auth"; import { UserAvatar } from "@/components/user-avatar"; import { Button } from "@/components/ui/button"; import { toast } from "sonner"; import Link from "next/link"; export function RemoteFollowing() { const { token } = useAuth(); const [following, setFollowing] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { if (!token) return; getRemoteFollowing(token) .then(setFollowing) .catch(() => toast.error("Failed to load following")) .finally(() => setLoading(false)); }, [token]); const unfollow = async (handle: string) => { if (!token) return; setFollowing((prev) => prev.filter((f) => f.handle !== handle)); await unfollowRemoteActor(handle, token).catch(() => { toast.error("Failed to unfollow"); }); }; if (loading) return

Loading…

; if (following.length === 0) return

Not following anyone remotely yet.

; return ( ); }