"use client"; import { TrendingUp, BookOpen, Flame, RefreshCw } from "lucide-react"; import Link from "next/link"; import { useDashboard } from "@/lib/hooks/useDashboard"; import { BillCard } from "@/components/shared/BillCard"; import { adminAPI } from "@/lib/api"; import { useState } from "react"; import { useAuthStore } from "@/stores/authStore"; export default function DashboardPage() { const { data, isLoading, refetch } = useDashboard(); const [polling, setPolling] = useState(false); const token = useAuthStore((s) => s.token); const triggerPoll = async () => { setPolling(true); try { await adminAPI.triggerPoll(); setTimeout(() => { refetch(); setPolling(false); }, 3000); } catch { setPolling(false); } }; return (

Dashboard

Your personalized Congressional activity feed

{isLoading ? (
Loading dashboard...
) : (

{token ? : } {token ? "Your Feed" : "Most Popular"} {token && data?.follows && ( ({data.follows.bills} bills · {data.follows.members} members · {data.follows.topics} topics) )}

{!token ? (

Sign in to personalise this feed with bills and members you follow.

Register Sign in
{data?.trending?.length ? (
{data.trending.map((bill) => ( ))}
) : null}
) : !data?.feed?.length ? (

Your feed is empty.

Follow bills, members, or topics to see activity here.

) : (
{data.feed.map((bill) => ( ))}
)}

Trending

{!data?.trending?.length ? (
No trend data yet. Run a poll to populate.
) : (
{data.trending.map((bill) => ( ))}
)}
)}
); }