fix: remove Poll Now button from dashboard
Admin-only actions belong in the admin panel, not the dashboard. Cleaned up dead imports and "Run a poll to populate" copy. Authored-By: Jack Levy Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,44 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { TrendingUp, BookOpen, Flame, RefreshCw } from "lucide-react";
|
||||
import { TrendingUp, BookOpen, Flame } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { useDashboard } from "@/lib/hooks/useDashboard";
|
||||
import { BillCard } from "@/components/shared/BillCard";
|
||||
import { WelcomeBanner } from "@/components/shared/WelcomeBanner";
|
||||
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 { data, isLoading } = useDashboard();
|
||||
const token = useAuthStore((s) => s.token);
|
||||
|
||||
const triggerPoll = async () => {
|
||||
setPolling(true);
|
||||
try {
|
||||
await adminAPI.triggerPoll();
|
||||
setTimeout(() => { refetch(); setPolling(false); }, 3000);
|
||||
} catch { setPolling(false); }
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||
<p className="text-muted-foreground text-sm mt-1">
|
||||
Your personalized Congressional activity feed
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={triggerPoll}
|
||||
disabled={polling}
|
||||
className="flex items-center gap-2 px-4 py-2 text-sm bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50"
|
||||
>
|
||||
<RefreshCw className={`w-4 h-4 ${polling ? "animate-spin" : ""}`} />
|
||||
{polling ? "Polling..." : "Poll Now"}
|
||||
</button>
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||
<p className="text-muted-foreground text-sm mt-1">
|
||||
Your personalized Congressional activity feed
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<WelcomeBanner />
|
||||
@@ -101,7 +80,7 @@ export default function DashboardPage() {
|
||||
</h2>
|
||||
{!data?.trending?.length ? (
|
||||
<div className="bg-card border border-border rounded-lg p-6 text-center text-muted-foreground text-xs">
|
||||
No trend data yet. Run a poll to populate.
|
||||
No trend data yet.
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
|
||||
Reference in New Issue
Block a user