From 70530e30e28d6e1490803d4d00b9791c16ca090b Mon Sep 17 00:00:00 2001 From: Elijah Date: Thu, 12 Nov 2026 12:17:52 -0700 Subject: [PATCH] Release Kaleido Desktop 0.1.0-beta.18 Rebuild the Up Next screen on Kaleido's own components: - Backdrop, colour wash, buttons and cards from the title pages; the credits play in a top-left frame with a matching hole in the page. - Season and related rows use Shelf, so they scroll with side arrows instead of scrollbars; the season row starts at the playing episode. - Returning to the video at the end no longer restarts the episode. - Compact layout for short windows; Mac window buttons stay visible. - Restore the flat Episodes and markers settings. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 + docs/development.md | 14 +- package-lock.json | 4 +- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/player/PlayerOverlay.tsx | 2 +- src/player/PostPlay.tsx | 370 ++++++++++++++++++--------- src/screens/settings/AppSettings.tsx | 38 ++- src/styles/player.css | 304 +++++++++++----------- src/styles/screens.css | 23 -- 12 files changed, 427 insertions(+), 346 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc20e3..fe77357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.1.0-beta.18 + +A rebuilt Up Next screen that looks and works like the rest of Kaleido. + +- Up Next now uses the same artwork backdrop, colour wash, buttons and cards as the title pages. The credits keep playing in the top-left corner beside the next episode, and the Play next episode button fills as the countdown runs. +- The Season and Related shows rows scroll with the side arrows, like every other row, instead of scrollbars. The season row starts at the episode you just watched. +- Click the video or press Esc to go back to the credits; at the end of an episode this no longer restarts it from the beginning. +- Up Next fits smaller windows, and the window buttons stay visible on Mac while it's open. +- Playback settings are a simple list again: Skip intros, Skip movie credits, Automatic skip delay and Autoplay next episode. + ## 0.1.0-beta.17 - Fix the Up Next countdown stalling when the native video has keyboard focus instead of the webview. Count elapsed time accurately through delayed timer callbacks, and keep the countdown independent of the video's pause state, as on Android TV. diff --git a/docs/development.md b/docs/development.md index 316d041..dbf8d76 100644 --- a/docs/development.md +++ b/docs/development.md @@ -47,15 +47,11 @@ Playback tests change real Plex progress; resume an in-progress title near its s position, or restore it afterwards. Selecting audio or subtitle tracks is saved to Plex for that file. -Up Next opens at the first Plex credits marker for an episode, including after a seek; -without markers it opens at EOF. Movie-credit skipping is independent. There is one -autoplay timer, measured by elapsed time without requiring webview keyboard focus. -Mouse movement, clicks, keypresses (including Tab), and scrolling cancel it. Esc or -clicking the video returns to playback; F/F11 toggles full screen. Video hover/focus -shows only a white outline. The play button's fill is the visible countdown. -The video rectangle must follow window resizes and DPI changes and return to the full -window on dismissal, episode changes, errors, and closing. Verify those native video -transitions on a GPU-equipped machine; browser layout checks cannot prove rendering. +Up Next (`player/PostPlay.tsx`) opens at an episode's first credits marker, or at the end +without markers. The video is drawn into its top-left frame (`player_rect`) behind a +matching hole in the page; check that the two line up after resizing, changing display +scale and returning to the video. In the browser, open it from the console by setting +`postPlay: true` (with `item`, `nextUp`, `episodeContextReady`) on `__kaleido.usePlayer`. ## Diagnostics diff --git a/package-lock.json b/package-lock.json index 5751ec6..0d3af2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kaleido-desktop", - "version": "0.1.0-beta.17", + "version": "0.1.0-beta.18", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kaleido-desktop", - "version": "0.1.0-beta.17", + "version": "0.1.0-beta.18", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "@tanstack/react-query": "^5.105.0", diff --git a/package.json b/package.json index ec1a7fc..22fdfd0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kaleido-desktop", "private": true, - "version": "0.1.0-beta.17", + "version": "0.1.0-beta.18", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 49f2df2..1b9a740 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2173,7 +2173,7 @@ dependencies = [ [[package]] name = "kaleido" -version = "0.1.0-beta.17" +version = "0.1.0-beta.18" dependencies = [ "fs2", "futures-util", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2f201f8..b8c8d87 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kaleido" -version = "0.1.0-beta.17" +version = "0.1.0-beta.18" description = "Kaleido — a Plex client for Windows" authors = ["Elijah"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 525d4f7..951df20 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Kaleido", - "version": "0.1.0-beta.17", + "version": "0.1.0-beta.18", "identifier": "tv.kaleido.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/player/PlayerOverlay.tsx b/src/player/PlayerOverlay.tsx index b917128..5843ece 100644 --- a/src/player/PlayerOverlay.tsx +++ b/src/player/PlayerOverlay.tsx @@ -911,7 +911,7 @@ export function PlayerOverlay() { }, [st.open, st.mini, seekStep, poke]); // The macOS traffic lights fade with the rest of the player's chrome. - const chromeHidden = st.open && !st.mini && !visible && st.firstFrame && !st.error; + const chromeHidden = st.open && !st.mini && !st.postPlay && !visible && st.firstFrame && !st.error; useEffect(() => { if (!chromeHidden) return; win.setButtonsVisible(false); diff --git a/src/player/PostPlay.tsx b/src/player/PostPlay.tsx index b76c3e7..6241093 100644 --- a/src/player/PostPlay.tsx +++ b/src/player/PostPlay.tsx @@ -1,181 +1,297 @@ -import { useEffect, useRef, useState, type CSSProperties } from 'react'; +import { useEffect, useLayoutEffect, useRef, type CSSProperties } from 'react'; +import { useQuery } from '@tanstack/react-query'; import { usePlayer } from './store'; import { mpv } from './engine'; import { isNative } from '../platform/native'; import { useSession } from '../app/session'; import { navigate } from '../app/router'; -import { clock, duration, episodeLabel } from '../app/format'; +import { art, clock, duration, episodeLabel } from '../app/format'; import * as api from '../plex/api'; import type { Item } from '../plex/types'; import { Backdrop } from '../ui/Backdrop'; -import { Facts, TitleArt } from '../ui/media'; +import { Facts, Shelf, TitleArt } from '../ui/media'; +import { Artwork } from '../ui/primitives'; import { Icon } from '../ui/Icon'; import { WindowControls } from '../app/TopBar'; -import { Spinner } from '../ui/primitives'; -/** One Up Next screen, with a transparent opening over the native video. */ +/** + * Up Next, adapted from Kaleido for Android TV: the credits keep playing in the + * top-left corner (the native video is drawn into that rectangle, with a matching + * hole in the page) beside the next episode, with the season and related shows + * below. Play next episode carries the one countdown; moving the mouse, clicking, + * scrolling or pressing a key stops it. Clicking the video, or Esc, returns to it. + */ export function PostPlay() { - const st = usePlayer(); + const item = usePlayer((s) => s.item)!; + const nextUp = usePlayer((s) => s.nextUp); + const contextReady = usePlayer((s) => s.episodeContextReady); + const fullscreen = usePlayer((s) => s.fullscreen); const server = useSession((s) => s.server); const root = useRef(null); const video = useRef(null); const play = useRef(null); - const currentEpisode = useRef(null); - const [season, setSeason] = useState([]); - const [related, setRelated] = useState([]); - const [details, setDetails] = useState(null); - const item = st.item!; - const upcoming = details?.id === st.nextUp?.id ? details : st.nextUp; - const counting = st.countdown !== null; + + // The listed episode lacks the rating and full synopsis. + const details = useQuery({ + queryKey: [server?.machineId, 'item', nextUp?.id], + queryFn: () => api.metadata(server!, nextUp!.id), + enabled: !!server && !!nextUp, + staleTime: 30_000, + }); + const upcoming = nextUp && details.data?.id === nextUp.id ? details.data : nextUp; + + useVideoRect(root, video); useEffect(() => { - currentEpisode.current?.scrollIntoView({ block: 'nearest', inline: 'center' }); - }, [season]); - - useEffect(() => { - if (!server) return; - let alive = true; - if (item.parentId) api.children(server, item.parentId).then((items) => alive && setSeason(items), () => {}); - if (item.grandparentId) api.related(server, item.grandparentId).then((hubs) => { - const seen = new Set([item.grandparentId]); - const shows = hubs.flatMap((h) => h.items).filter((i) => i.type === 'show' && !seen.has(i.id) && !!seen.add(i.id)); - if (alive) setRelated(shows); - }, () => {}); - return () => { alive = false; }; - }, [server, item.id]); - - useEffect(() => { - if (!server || !st.nextUp) return; - let alive = true; - api.metadata(server, st.nextUp.id).then((next) => alive && setDetails(next), () => {}); - return () => { alive = false; }; - }, [server, st.nextUp?.id]); - - useEffect(() => { - const previous = document.activeElement as HTMLElement | null; (play.current ?? video.current)?.focus({ preventScroll: true }); - const cancel = () => { - const player = usePlayer.getState(); - if (!player.postPlayDismissed) player.cancelCountdown(); - }; - const move = (event: MouseEvent) => { - if (event.movementX !== 0 || event.movementY !== 0) cancel(); + const stop = () => { + if (usePlayer.getState().countdown !== null) usePlayer.getState().cancelCountdown(); }; + // Layout changes can send a mousemove without the mouse moving. + const move = (e: MouseEvent) => (e.movementX || e.movementY) && stop(); const key = (e: KeyboardEvent) => { - cancel(); + stop(); if (e.key === 'Escape' || e.key === 'Backspace') { e.preventDefault(); - e.stopImmediatePropagation(); usePlayer.getState().dismissPostPlay(); - } else if (e.key === 'F11' || (e.key.toLowerCase() === 'f' && !e.ctrlKey && !e.metaKey && !e.altKey)) { + } else if (e.key === 'F11' || ((e.key === 'f' || e.key === 'F') && !e.ctrlKey && !e.metaKey && !e.altKey)) { e.preventDefault(); usePlayer.getState().toggleFullscreen(); - } else if (e.key === 'Tab') { - // Keep keyboard focus in the player, including after Shift+Tab. - const buttons = [...root.current!.querySelectorAll('button:not(:disabled)')]; - const first = buttons[0], last = buttons[buttons.length - 1]; - if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last?.focus(); } - else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first?.focus(); } } }; + const opts = { capture: true, passive: true }; window.addEventListener('keydown', key, true); - window.addEventListener('pointerdown', cancel, true); - window.addEventListener('mousemove', move, { capture: true, passive: true }); - window.addEventListener('wheel', cancel, { capture: true, passive: true }); + window.addEventListener('pointerdown', stop, opts); + window.addEventListener('mousemove', move, opts); + window.addEventListener('wheel', stop, opts); return () => { window.removeEventListener('keydown', key, true); - window.removeEventListener('pointerdown', cancel, true); - window.removeEventListener('mousemove', move, true); - window.removeEventListener('wheel', cancel, true); - if (previous?.isConnected) previous.focus({ preventScroll: true }); + window.removeEventListener('pointerdown', stop, opts); + window.removeEventListener('mousemove', move, opts); + window.removeEventListener('wheel', stop, opts); }; }, []); - useEffect(() => { - const el = video.current; - if (!el) return; - let frame = 0; + const backToVideo = () => usePlayer.getState().dismissPostPlay(); + + return ( +
+
{server && }
+
+ {!fullscreen && } +
+ +
+
+
+
+ + {upcoming || !contextReady ? 'Up next' : 'More to watch'} + + + {upcoming ? ( + <> +

{upcoming.title}

+ + {upcoming.summary &&

{upcoming.summary}

} + + + ) : ( + contextReady &&

You’ve reached the end of this series.

+ )} +
+
+ + {server && } +
+ ); +} + +/** + * Draws the native video into the frame's rectangle and cuts the same hole in + * the page, following window resizes and display scale changes. + */ +function useVideoRect(root: React.RefObject, frame: React.RefObject) { + useLayoutEffect(() => { + const el = frame.current; + const page = root.current; + if (!el || !page) return; + let raf = 0; const place = () => { - cancelAnimationFrame(frame); - frame = requestAnimationFrame(() => { + cancelAnimationFrame(raf); + raf = requestAnimationFrame(() => { const r = el.getBoundingClientRect(); - const style = root.current!.style; - for (const [key, value] of Object.entries({ x: r.x, y: r.y, w: r.width, h: r.height })) style.setProperty(`--up-video-${key}`, `${value}px`); + page.style.setProperty('--up-x', `${r.x}px`); + page.style.setProperty('--up-y', `${r.y}px`); + page.style.setProperty('--up-w', `${r.width}px`); + page.style.setProperty('--up-h', `${r.height}px`); + page.classList.add('placed'); const dpr = window.devicePixelRatio || 1; + // A pixel of overdraw on each side keeps the hole covered at any scale. if (isNative) mpv.rect({ x: r.x * dpr - 1, y: r.y * dpr - 1, width: r.width * dpr + 2, height: r.height * dpr + 2 }).catch(() => {}); - root.current!.classList.add('placed'); }); }; - const observer = new ResizeObserver(place); - observer.observe(el); + const ro = new ResizeObserver(place); + ro.observe(el); window.addEventListener('resize', place); place(); return () => { - cancelAnimationFrame(frame); - observer.disconnect(); + cancelAnimationFrame(raf); + ro.disconnect(); window.removeEventListener('resize', place); if (isNative) mpv.rect(null).catch(() => {}); }; }, []); +} - const watch = () => { - if (st.ended) st.togglePause(); - st.dismissPostPlay(); - }; - const choose = (episode: Item) => { - if (episode.id === item.id) watch(); - else st.play(episode, { resume: true, quality: st.quality }); - }; - const browse = async (show: Item) => { - await st.close(); - navigate({ name: 'item', id: show.id, title: show.title }); - }; - const rail = (label: string, items: Item[], episodes: boolean) => items.length > 0 && ( -
-

{label}

-
- {items.map((entry) => ( - - ))} -
-
- ); - +/** Where the playing episode is, under the video. Its own subscription: position ticks re-render only this. */ +function NowPlaying({ item }: { item: Item }) { + const position = usePlayer((s) => s.position); + const total = usePlayer((s) => s.duration); return ( -
-
{server && }
- {!st.fullscreen &&
} -
-
-
-
- {upcoming || !st.episodeContextReady ? 'Up next' : 'More to watch'} - - {upcoming ? <> -

{upcoming.title}

- - {upcoming.summary &&

{upcoming.summary}

} -
- -
- : st.episodeContextReady ?

You’ve reached the end of this series.

: } -
+
+
+ + {episodeLabel(item)} · {item.title} + + −{clock(Math.max(0, total - position))}
-
- {rail(item.parentIndex ? `Season ${item.parentIndex}` : 'Episodes', season, true)} - {rail('Related shows', related, false)} +
+
); } + +/** Play next episode. While autoplay counts down, a lighter fill sweeps across it. */ +function PlayNext({ ref }: { ref: React.Ref }) { + const countdown = usePlayer((s) => s.countdown); + const total = usePlayer((s) => s.countdownTotal); + const counting = countdown !== null && total > 0; + const fill = counting ? (1 - countdown / total) * 100 : 0; + return ( + + ); +} + +function UpNextRows({ item, nextUp }: { item: Item; nextUp: Item | null }) { + const server = useSession((s) => s.server)!; + const season = useQuery({ + queryKey: [server.machineId, 'children', item.parentId], + queryFn: () => api.children(server, item.parentId), + enabled: !!item.parentId, + staleTime: 30_000, + }); + const related = useQuery({ + queryKey: [server.machineId, 'related', item.grandparentId], + queryFn: () => api.related(server, item.grandparentId), + enabled: !!item.grandparentId, + staleTime: 10 * 60_000, + }); + const episodes = (season.data ?? []).filter((e) => e.type === 'episode'); + const seen = new Set([item.grandparentId]); + const shows = (related.data ?? []).flatMap((h) => h.items).filter((i) => i.type === 'show' && !seen.has(i.id) && !!seen.add(i.id)); + + // The season row starts just before the playing episode. + const seasonRow = useRef(null); + useLayoutEffect(() => { + const row = seasonRow.current?.querySelector('.shelf'); + const current = row?.querySelector('[aria-current]'); + if (!row || !current) return; + const start = (current.previousElementSibling as HTMLElement | null) ?? current; + const target = row.scrollLeft + start.getBoundingClientRect().left - row.getBoundingClientRect().left - parseFloat(getComputedStyle(row).paddingLeft); + row.scrollTo({ left: target, behavior: 'instant' }); + }, [episodes.length]); + + const choose = (episode: Item) => { + const st = usePlayer.getState(); + if (episode.id === item.id) st.dismissPostPlay(); + else st.play(episode, { resume: true, quality: st.quality }); + }; + const browse = async (show: Item) => { + await usePlayer.getState().close(); + navigate({ name: 'item', id: show.id, title: show.title }); + }; + if (!episodes.length && !shows.length) return null; + return ( +
+ {episodes.length > 0 && ( +
+ + {episodes.map((ep) => ( + choose(ep)} + /> + ))} + +
+ )} + {shows.length > 0 && ( + + {shows.map((show) => ( + void browse(show)} /> + ))} + + )} +
+ ); +} + +function UpNextCard({ item, caption, current, onChoose }: { item: Item; caption: string; current?: boolean; onChoose: () => void }) { + const server = useSession((s) => s.server)!; + const episode = item.type === 'episode'; + const title = episode ? `${item.index}. ${item.title}` : item.title; + const progress = episode && !current && item.viewOffset && item.duration ? item.viewOffset / item.duration : 0; + return ( +
{ + if (e.key !== 'Enter' && e.key !== ' ') return; + e.preventDefault(); + onChoose(); + }} + > +
+ {title}} /> +
+ {episode && !current && ( +
+ +
+ )} + {progress > 0 && ( + + + + )} +
+
+
+ {title} +
+ {caption &&
{caption}
} +
+
+ ); +} diff --git a/src/screens/settings/AppSettings.tsx b/src/screens/settings/AppSettings.tsx index 4ef6f38..abfa4a5 100644 --- a/src/screens/settings/AppSettings.tsx +++ b/src/screens/settings/AppSettings.tsx @@ -188,28 +188,22 @@ export function AppSettings({ tab }: { tab: string }) { set('hdrPassthrough', v)} /> - -
- -
-
- Intros - set('skipCredits', v)} options={skipOptions} /> -
- {(s.skipIntro === 'auto' || s.skipCredits === 'auto') && ( -
- Skip delay - set('skipIntro', v)} options={skipOptions} /> + + + set('autoSkipDelay', v)} + options={[0, 3, 5, 10].map((v) => ({ value: v, label: v ? `${v} seconds` : 'Skip straight away' }))} + /> + +