import { useState } from "react"; import { Link } from "@tanstack/react-router"; import { motion } from "framer-motion"; import { Boxes, Activity, LayoutDashboard } from "lucide-react"; import { useWorkspaces, useQueueStatus } from "@/api/queries"; import { PageLoader } from "@/components/shared/LoadingSpinner"; import { ErrorAlert } from "@/components/shared/ErrorAlert"; function QueueCard({ workspaceId }: { workspaceId: string }) { const { data, isLoading } = useQueueStatus(workspaceId); if (isLoading) return (
); if (!data) return null; const pending = data.pending_work_units; return (

Queue Status

{pending === 0 ? "Idle" : "Active"}
{(["total_work_units", "completed_work_units", "in_progress_work_units", "pending_work_units"] as const).map((key) => (
{key.replace(/_work_units$/, "").replace(/_/g, " ")} {data[key]}
))}
); } export function Dashboard() { const [page] = useState(1); const { data, isLoading, error } = useWorkspaces(page, 6); const workspaces = (data as { items?: Array<{ id: string; created_at?: string }> } | undefined)?.items ?? []; const total = (data as { total?: number } | undefined)?.total ?? 0; return (

Dashboard

Overview of your Honcho instance

{isLoading && } {!isLoading && (
{/* Stat row */} {[ { label: "Workspaces", value: total, icon: Boxes }, ].map((stat) => { const Icon = stat.icon; return (
{stat.value}
{stat.label}
); })}
{/* Workspace list */}

Recent Workspaces

View all →
{workspaces.length === 0 ? (

No workspaces found.

) : (
{workspaces.map((ws) => ( {ws.id} ))}
)}
{/* Queue for first workspace */} {workspaces[0] && ( )}
)}
); }