import { Loader2 } from 'lucide-react'; import { MediaShelf } from './MediaCard'; import { useJellyfinHome } from './useJellyfinData'; // The landing screen: what you were watching, what comes next, and the newest thing in each library. // // One request. The sidecar fans out to Jellyfin's four different endpoints and swallows per-library failures, // so a library mid-scan costs its own shelf rather than the whole page — which is why there is no per-shelf // loading state here to write. export const HomeSection = () => { const { data, isLoading, error } = useJellyfinHome(); if (isLoading) { return (
); } if (error) { return (
The server did not answer.
); } const resume = data?.resume ?? []; const nextUp = data?.nextUp ?? []; const latest = data?.latest ?? []; const empty = !resume.length && !nextUp.length && !latest.some((shelf) => shelf.items.length); if (empty) { return (

Nothing here yet

The server is connected but its video libraries are empty — or still scanning.

); } return (
{latest.map((shelf) => ( ))}
); };