'use client'; import Link from 'next/link'; import { MetricCard } from '@/components/dashboard/metric-card'; import { SpoonCard } from '@/components/spoons/spoon-card'; import { MaintenanceQueue } from '@/components/threads/maintenance-queue'; import { useQuery } from 'convex/react'; import { GitBranch, MessageSquare, RefreshCw, ShieldCheck } from 'lucide-react'; import { api } from '@spoon/backend/convex/_generated/api.js'; import { Button, Card, CardContent, CardHeader, CardTitle } from '@spoon/ui'; const DashboardPage = () => { const spoons = useQuery(api.spoons.listMine, {}) ?? []; const syncRuns = useQuery(api.syncRuns.listRecent, { limit: 5 }) ?? []; const threads = useQuery(api.threads.listMine, { limit: 25 }) ?? []; const activeSpoons = spoons.filter( (spoon) => spoon.status === 'active', ).length; const behind = spoons.filter((spoon) => spoon.syncStatus === 'behind').length; const diverged = spoons.filter( (spoon) => spoon.syncStatus === 'diverged', ).length; const openPullRequests = spoons.reduce( (total, spoon) => total + (spoon.upstreamAheadBy ?? 0), 0, ); return (

Dashboard

Monitor managed forks, upstream activity, and open maintenance threads.

!['resolved', 'ignored', 'failed', 'cancelled'].includes( thread.status, ), ).length } note='Across all Spoons' icon={MessageSquare} />

Maintenance queue

Recent Spoons

{spoons.length ? ( spoons .slice(0, 3) .map((spoon) => ) ) : (

No Spoons yet

Create a manual Spoon record to start shaping your fork maintenance dashboard.

)}

Recent activity

Upstream checks {syncRuns.length ? (
{syncRuns.map((run) => (

{run.kind.replaceAll('_', ' ')}

{run.status.replaceAll('_', ' ')}

))}
) : (

Scheduled upstream checks will appear here once provider automation is connected.

)}
Recent threads {threads.length ? (
{threads.slice(0, 5).map((thread) => (

{thread.title}

{thread.status.replaceAll('_', ' ')} ยท{' '} {thread.source.replaceAll('_', ' ')}

))}
) : (

Threads appear when you request work or upstream changes need review.

)}
); }; export default DashboardPage;