/** * RequestsTab — Jellyseerr request stats surface on the Jellyfin page. * * Reads the Jellyfin service's jellyseerr_url (config) + jellyseerr_api_key * (secret). When configured, polls /api/jellyseerr/stats and renders the * request-count grid + a recent-requests list. Individual stats can be pinned * to dashboards via the "Request stat" widget. */ import type { ServiceInstance } from "../../types"; import { useJellyseerrStats } from "../../hooks/useJellyseer"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { MetricCard } from "../../components/MetricCard"; import { ExternalLink } from "lucide-react"; export function RequestsTab({ instance }: { instance: ServiceInstance }) { const jellyseerrUrl = String( (instance.config as Record).jellyseerr_url ?? "", ).trim(); const jellyseerrApiKeySet = Boolean( (instance.secrets_set as Record | undefined) ?.jellyseerr_api_key, ); const { data, isLoading, error } = useJellyseerrStats(instance.id); if (!jellyseerrUrl || !jellyseerrApiKeySet) { return ( Jellyseerr is not configured for this Jellyfin instance. Add a jellyseerr_url config field and a jellyseerr_api_key secret to the Jellyfin service to enable request management. ); } return (

Jellyseerr

{jellyseerrUrl}
{error ? ( {error.message} ) : isLoading ? ( ) : data?.detail && !(data.stats && data.stats.length > 0) ? ( {data.detail} ) : ( <>
{(data?.stats ?? []).map((s) => ( ))}
{data?.recent && data.recent.length > 0 ? (
Recent requests {data.recent.slice(0, 12).map((r, i) => (
{r.name ?? "—"} {r.type ? String(r.type) : ""}
{r.media_status ? ( {r.media_status} ) : null} {r.status ? {r.status} : null}
))}
) : null}

Pin individual stats to a dashboard with the “Request stat” widget.

)}
); }