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,45 +1,24 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { TrendingUp, BookOpen, Flame, RefreshCw } from "lucide-react";
|
import { TrendingUp, BookOpen, Flame } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useDashboard } from "@/lib/hooks/useDashboard";
|
import { useDashboard } from "@/lib/hooks/useDashboard";
|
||||||
import { BillCard } from "@/components/shared/BillCard";
|
import { BillCard } from "@/components/shared/BillCard";
|
||||||
import { WelcomeBanner } from "@/components/shared/WelcomeBanner";
|
import { WelcomeBanner } from "@/components/shared/WelcomeBanner";
|
||||||
import { adminAPI } from "@/lib/api";
|
|
||||||
import { useState } from "react";
|
|
||||||
import { useAuthStore } from "@/stores/authStore";
|
import { useAuthStore } from "@/stores/authStore";
|
||||||
|
|
||||||
export default function DashboardPage() {
|
export default function DashboardPage() {
|
||||||
const { data, isLoading, refetch } = useDashboard();
|
const { data, isLoading } = useDashboard();
|
||||||
const [polling, setPolling] = useState(false);
|
|
||||||
const token = useAuthStore((s) => s.token);
|
const token = useAuthStore((s) => s.token);
|
||||||
|
|
||||||
const triggerPoll = async () => {
|
|
||||||
setPolling(true);
|
|
||||||
try {
|
|
||||||
await adminAPI.triggerPoll();
|
|
||||||
setTimeout(() => { refetch(); setPolling(false); }, 3000);
|
|
||||||
} catch { setPolling(false); }
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold">Dashboard</h1>
|
<h1 className="text-2xl font-bold">Dashboard</h1>
|
||||||
<p className="text-muted-foreground text-sm mt-1">
|
<p className="text-muted-foreground text-sm mt-1">
|
||||||
Your personalized Congressional activity feed
|
Your personalized Congressional activity feed
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</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>
|
|
||||||
|
|
||||||
<WelcomeBanner />
|
<WelcomeBanner />
|
||||||
|
|
||||||
@@ -101,7 +80,7 @@ export default function DashboardPage() {
|
|||||||
</h2>
|
</h2>
|
||||||
{!data?.trending?.length ? (
|
{!data?.trending?.length ? (
|
||||||
<div className="bg-card border border-border rounded-lg p-6 text-center text-muted-foreground text-xs">
|
<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>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user