Files
homelab-optimized/dashboard/ui/components/jellyfin-card.tsx
Gitea Mirror Bot 3406d7ce05
Some checks failed
Documentation / Build Docusaurus (push) Failing after 4m59s
Documentation / Deploy to GitHub Pages (push) Has been skipped
Sanitized mirror from private repository - 2026-04-05 05:34:18 UTC
2026-04-05 05:34:18 +00:00

72 lines
2.4 KiB
TypeScript

"use client";
import { usePoll } from "@/lib/use-poll";
import type { JellyfinStatus } from "@/lib/types";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
import { StatusBadge } from "./status-badge";
export function JellyfinCard() {
const { data } = usePoll<JellyfinStatus>("/api/jellyfin/status", 30000);
return (
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium">Jellyfin</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{!data ? (
<p className="text-xs text-muted-foreground">Loading...</p>
) : (
<>
<div>
<p className="text-[10px] uppercase tracking-wider text-muted-foreground mb-1">
Now Playing
</p>
{data.active_sessions.length > 0 ? (
<div className="space-y-1.5">
{data.active_sessions.map((s, i) => (
<div key={i} className="text-xs">
<p className="text-foreground font-medium">{s.title}</p>
<p className="text-muted-foreground">
{s.user} &middot; {s.device}
</p>
</div>
))}
</div>
) : (
<p className="text-xs text-muted-foreground">
No active streams
</p>
)}
</div>
<Separator />
<div>
<p className="text-[10px] uppercase tracking-wider text-muted-foreground mb-1">
Libraries
</p>
<div className="space-y-1">
{data.libraries.map((lib) => (
<div
key={lib.name}
className="flex items-center justify-between text-xs"
>
<span className="text-foreground">{lib.name}</span>
<StatusBadge color="green" label={lib.type} />
</div>
))}
</div>
</div>
{data.idle_sessions > 0 && (
<p className="text-[10px] text-muted-foreground">
{data.idle_sessions} idle session
{data.idle_sessions > 1 ? "s" : ""}
</p>
)}
</>
)}
</CardContent>
</Card>
);
}