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

114
src/ui/HoverPreview.tsx Normal file
View file

@ -0,0 +1,114 @@
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { create } from 'zustand';
import { useRouter } from '../app/router';
import type { Item } from '../plex/types';
import { useSession } from '../app/session';
import { art, duration, episodeLabel } from '../app/format';
import { Ratings } from './media';
/**
* A quiet preview shown after the pointer rests on a poster: artwork, facts
* and synopsis, without opening the title. It never captures the pointer.
*/
const usePreview = create<{ item: Item | null; rect: DOMRect | null; anchor: HTMLElement | null; show(item: Item, anchor: HTMLElement): void; hide(): void }>((set) => ({
item: null,
rect: null,
anchor: null,
show: (item, anchor) => set({ item, anchor, rect: anchor.getBoundingClientRect() }),
hide: () => set({ item: null, rect: null, anchor: null }),
}));
let timer: ReturnType<typeof setTimeout> | null = null;
const DELAY = 650;
export function previewHandlers(item: Item) {
return {
onMouseEnter: (e: React.MouseEvent) => {
const el = e.currentTarget as HTMLElement;
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
if (el.matches(':hover') && !document.querySelector('.menu-layer')) usePreview.getState().show(item, el);
}, DELAY);
},
onMouseLeave: () => {
if (timer) clearTimeout(timer);
timer = null;
usePreview.getState().hide();
},
onMouseDown: () => {
if (timer) clearTimeout(timer);
usePreview.getState().hide();
},
};
}
export function HoverPreviewHost() {
const { item, rect } = usePreview();
const server = useSession((s) => s.server);
const ref = useRef<HTMLDivElement>(null);
const [pos, setPos] = useState<{ left: number; top: number; side: 'right' | 'left' } | null>(null);
useEffect(() => {
const close = () => usePreview.getState().hide();
// The anchor card can disappear (navigation, re-render) without a mouseleave.
const check = () => {
const a = usePreview.getState().anchor;
if (a && (!a.isConnected || !a.matches(':hover'))) close();
};
const unsub = useRouter.subscribe(close);
window.addEventListener('wheel', close, { passive: true });
window.addEventListener('keydown', close);
window.addEventListener('input', close, true);
window.addEventListener('mousemove', check, { passive: true });
return () => {
unsub();
window.removeEventListener('wheel', close);
window.removeEventListener('keydown', close);
window.removeEventListener('input', close, true);
window.removeEventListener('mousemove', check);
};
}, []);
useLayoutEffect(() => {
if (!rect || !ref.current) return setPos(null);
const w = ref.current.offsetWidth;
const h = ref.current.offsetHeight;
const side = rect.right + 14 + w < window.innerWidth - 12 ? 'right' : 'left';
const left = side === 'right' ? rect.right + 14 : rect.left - 14 - w;
const top = Math.min(Math.max(76, rect.top + rect.height / 2 - h / 2), window.innerHeight - h - 12);
setPos({ left, top, side });
}, [rect, item]);
if (!item || !rect || !server) return null;
const backdrop = art.backdrop(item);
const summary = item.summary || item.tagline;
const facts = [
item.type === 'episode' ? episodeLabel(item) : item.year || '',
item.type === 'show' ? (item.childCount ? `${item.childCount} season${item.childCount === 1 ? '' : 's'}` : '') : duration(item.duration),
item.genres.slice(0, 2).map((g) => g.tag).join(', '),
].filter(Boolean);
return createPortal(
<div ref={ref} className={`hover-preview ${pos?.side ?? 'right'}`} style={{ left: pos?.left ?? -9999, top: pos?.top ?? -9999 }} aria-hidden="true">
{backdrop && (
<div className="hover-preview-art">
<img src={server.image(backdrop, 360, 202)} alt="" />
{item.logo && <img className="hover-preview-logo" src={server.image(item.logo, 200, 64, { format: 'png' })} alt="" />}
</div>
)}
<div className="hover-preview-body">
{!item.logo && <b className="hover-preview-title">{item.type === 'episode' ? item.grandparentTitle : item.title}</b>}
<div className="hover-preview-facts">
{item.contentRating && <span className="badge">{item.contentRating}</span>}
{facts.map((f) => (
<span key={f}>{f}</span>
))}
</div>
<Ratings item={item} compact />
{summary && <p>{summary}</p>}
</div>
</div>,
document.body,
);
}