Create Kaleido Desktop, a cinematic Plex client for Windows

Tauri 2 shell with a React/TypeScript interface and libmpv playback composed
beneath the web view (DirectComposition on Windows). Shared code with per-OS
platform modules and configs so macOS and Linux can follow.

- Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home
- Home, Movies and TV Shows (Discover, Library, Collections), search, people
- Title pages with logos, ratings, cast, extras, seasons and episodes
- Direct play with Plex conversion fallback, tracks, markers, autoplay
- Metadata editing, artwork, fix match, refresh, analyze and deletion
- Resumable offline downloads
- App settings and Plex server administration with a live dashboard
- Signed updater feed and Forgejo CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-30 16:26:37 -07:00
commit 00d72e70f4
121 changed files with 25315 additions and 0 deletions

111
src/screens/Section.tsx Normal file
View file

@ -0,0 +1,111 @@
import { useMemo } from 'react';
import * as api from '../plex/api';
import { useSectionFor, useServerQuery } from '../app/queries';
import { navigate, type SectionKind, type SectionTab } from '../app/router';
import { useSettings } from '../app/settings';
import type { Section } from '../plex/types';
import { Hero } from '../ui/Hero';
import { HubShelf, PosterCard } from '../ui/media';
import { EmptyState, ErrorState, PageLoader, Select } from '../ui/primitives';
import { buildFeatures, HIDDEN_HUBS, recentSeasons } from './discover';
import { LibraryBrowser } from './LibraryBrowser';
const TABS: { id: SectionTab; label: string }[] = [
{ id: 'discover', label: 'Discover' },
{ id: 'library', label: 'Library' },
{ id: 'collections', label: 'Collections' },
];
function SectionHeader({ kind, tab, section, all, overlay }: { kind: SectionKind; tab: SectionTab; section: Section; all: Section[]; overlay: boolean }) {
const set = useSettings((s) => s.set);
return (
<div className={`section-header${overlay ? ' overlay' : ''}`}>
<h1>{kind === 'movie' ? 'Movies' : 'TV Shows'}</h1>
<nav className="section-tabs" role="tablist">
{TABS.map((t) => (
<button key={t.id} role="tab" aria-selected={t.id === tab} className={t.id === tab ? 'active' : ''} onClick={() => navigate({ name: 'section', kind, tab: t.id }, { replace: true })}>
{t.label}
</button>
))}
</nav>
{all.length > 1 && (
<Select
className="section-picker"
value={section.id}
label="Library"
options={all.map((s) => ({ value: s.id, label: s.title }))}
onChange={(v) => set(kind === 'movie' ? 'movieSection' : 'showSection', v)}
/>
)}
</div>
);
}
function Discover({ kind, section }: { kind: SectionKind; section: Section }) {
const hubs = useServerQuery(['sectionHubs', section.id], (s) => api.sectionHubs(s, section.id));
const cw = useServerQuery(['continue', section.id], (s) => api.continueWatching(s, section.id), { staleTime: 15_000 });
const seasons = useServerQuery(['recentSeasons', section.id], (s) => recentSeasons(s, section.id), { enabled: kind === 'show', staleTime: 120_000 });
const features = useMemo(() => buildFeatures(hubs.data ?? [], 7, kind === 'movie' ? 1 : 2), [hubs.data, kind]);
if (hubs.isError && !hubs.data) return <ErrorState error={hubs.error} onRetry={() => hubs.refetch()} />;
if (!hubs.data) return <PageLoader />;
const rest = hubs.data.filter((h) => !HIDDEN_HUBS.test(h.id));
// TV: episodes lead; redundant episode hubs are skipped when they repeat Continue Watching.
const cwIds = new Set((cw.data ?? []).map((i) => i.id));
const shelves = rest.filter((h) => !(h.items.length && h.items.every((i) => cwIds.has(i.id))));
return (
<>
<Hero features={features} variant="section" />
<div className="shelves over-hero">
<HubShelf title={kind === 'show' ? 'Next Episodes' : 'Continue Watching'} items={cw.data ?? []} continueWatching />
{kind === 'show' && <HubShelf title="New Seasons" items={seasons.data ?? []} landscape={false} />}
{shelves.map((h) => (
<HubShelf key={h.id} title={h.title.replace(/ in (Movies|TV Shows)$/, '')} items={h.items} onViewAll={h.more || h.key.includes('/all') ? () => navigate({ name: 'hub', key: h.key, title: h.title }) : undefined} />
))}
</div>
</>
);
}
function Collections({ section }: { section: Section }) {
const q = useServerQuery(['collections', section.id], (s) => api.collections(s, section.id));
if (q.isError) return <ErrorState error={q.error} onRetry={() => q.refetch()} />;
if (!q.data) return <PageLoader />;
if (!q.data.length)
return (
<EmptyState icon="collection" title="No collections yet">
Collections created in Plex for {section.title} appear here.
</EmptyState>
);
return (
<div className="page-pad">
<div className="grid-count">{q.data.length.toLocaleString()} collections</div>
<div className="poster-grid auto">
{q.data.map((c) => (
<PosterCard key={c.id} item={c} />
))}
</div>
</div>
);
}
export function SectionScreen({ kind, tab }: { kind: SectionKind; tab: SectionTab }) {
const { section, all, loading } = useSectionFor(kind);
if (loading) return <PageLoader />;
if (!section)
return (
<div className="page-pad top">
<EmptyState icon={kind === 'movie' ? 'film' : 'tv'} title={`No ${kind === 'movie' ? 'movie' : 'TV'} libraries`}>
This server has no {kind === 'movie' ? 'movie' : 'TV show'} libraries you can access.
</EmptyState>
</div>
);
return (
<div className={`section-screen tab-${tab}`} key={section.id}>
<SectionHeader kind={kind} tab={tab} section={section} all={all} overlay={tab === 'discover'} />
{tab === 'discover' && <Discover kind={kind} section={section} />}
{tab === 'library' && <LibraryBrowser section={section} kind={kind} />}
{tab === 'collections' && <Collections section={section} />}
</div>
);
}