| 1 | "use client"; |
| 2 | |
| 3 | import { trpc } from "@/lib/trpc"; |
| 4 | import { Badge } from "@/components/ui/badge"; |
| 5 | import { Skeleton } from "@/components/ui/skeleton"; |
| 6 | |
| 7 | export function HealthCheck() { |
| 8 | const { data, isLoading, error } = trpc.health.useQuery(); |
| 9 | |
| 10 | if (isLoading) { |
| 11 | return <Skeleton className="h-6 w-24" />; |
| 12 | } |
| 13 | |
| 14 | if (error) { |
| 15 | return <Badge variant="destructive">API Error</Badge>; |
| 16 | } |
| 17 | |
| 18 | return ( |
| 19 | <Badge variant="secondary"> |
| 20 | API: {data?.status} {data?.timestamps.toLocaleTimeString()} |
| 21 | </Badge> |
| 22 | ); |
| 23 | } |