"use client"; import Link from "next/link"; import { Heart, X } from "lucide-react"; import { useFollows, useRemoveFollow } from "@/lib/hooks/useFollows"; import { billLabel } from "@/lib/utils"; export default function FollowingPage() { const { data: follows = [], isLoading } = useFollows(); const remove = useRemoveFollow(); const bills = follows.filter((f) => f.follow_type === "bill"); const members = follows.filter((f) => f.follow_type === "member"); const topics = follows.filter((f) => f.follow_type === "topic"); const Section = ({ title, items, renderValue }: { title: string; items: typeof follows; renderValue: (v: string) => React.ReactNode; }) => (

{title} ({items.length})

{!items.length ? (

Nothing followed yet.

) : (
{items.map((f) => (
{renderValue(f.follow_value)}
))}
)}
); if (isLoading) return
Loading...
; return (

Following

Manage what you follow

{ const [congress, type, num] = v.split("-"); return ( {type && num ? billLabel(type, parseInt(num)) : v} ); }} />
( {v} )} />
( {v.replace("-", " ")} )} />
); }