Release Kaleido Desktop 0.1.0-beta.17
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m36s

This commit is contained in:
Elijah 2026-11-12 11:45:07 -07:00
parent dfe865d8f4
commit 28e633dad1
13 changed files with 165 additions and 156 deletions

View file

@ -4,13 +4,14 @@ import { mpv } from './engine';
import { isNative } from '../platform/native';
import { useSession } from '../app/session';
import { navigate } from '../app/router';
import { clock, episodeLabel } from '../app/format';
import { 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 { 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. */
export function PostPlay() {
@ -53,7 +54,13 @@ export function PostPlay() {
useEffect(() => {
const previous = document.activeElement as HTMLElement | null;
(play.current ?? video.current)?.focus({ preventScroll: true });
const cancel = () => usePlayer.getState().cancelCountdown();
const cancel = () => {
const player = usePlayer.getState();
if (!player.postPlayDismissed) player.cancelCountdown();
};
const move = (event: MouseEvent) => {
if (event.movementX !== 0 || event.movementY !== 0) cancel();
};
const key = (e: KeyboardEvent) => {
cancel();
if (e.key === 'Escape' || e.key === 'Backspace') {
@ -73,10 +80,12 @@ export function PostPlay() {
};
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 });
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 });
};
@ -126,12 +135,12 @@ export function PostPlay() {
<h2>{label}</h2>
<div className="up-next-cards">
{items.map((entry) => (
<button key={entry.id} ref={entry.id === item.id ? currentEpisode : undefined} className={`up-next-card${episodes ? '' : ' poster'}`} onClick={() => episodes ? choose(entry) : void browse(entry)} aria-current={entry.id === item.id ? 'true' : undefined}>
<button key={entry.id} ref={entry.id === item.id ? currentEpisode : undefined} className="up-next-card" onClick={() => episodes ? choose(entry) : void browse(entry)} aria-current={entry.id === item.id ? 'true' : undefined}>
<div className="up-next-card-art">
{server && entry.thumb && <img src={server.image(entry.thumb, episodes ? 360 : 220, episodes ? 202 : 330)} alt="" loading="lazy" draggable={false} />}
{(entry.id === item.id || entry.id === st.nextUp?.id) && <span>{entry.id === item.id ? 'Now playing' : 'Up next'}</span>}
{server && (entry.thumb || entry.art) && <img src={server.image(episodes ? entry.thumb : entry.art || entry.thumb, 360, 202)} alt="" loading="lazy" draggable={false} />}
</div>
<b>{episodes ? `${episodeLabel(entry)} · ${entry.title}` : entry.title}</b>
<b>{episodes ? `${entry.index}. ${entry.title}` : entry.title}</b>
<small>{entry.id === item.id ? 'Now playing' : entry.id === st.nextUp?.id ? 'Up next' : episodes ? duration(entry.duration) : entry.year || ''}</small>
</button>
))}
</div>
@ -141,33 +150,26 @@ export function PostPlay() {
return (
<div className="player up-next" ref={root} role="dialog" aria-modal="true" aria-labelledby="up-next-heading">
<div className="up-next-scene">{server && <Backdrop item={upcoming ?? item} />}</div>
<header className="up-next-toolbar" data-tauri-drag-region={isNative ? true : undefined}>
<button className="up-next-back" onClick={watch} title="Return to video (Esc)"><Icon name="arrowLeft" size={18} /> Return to video</button>
<button className="up-next-back" onClick={() => st.close()}>Done watching</button>
{st.fullscreen && <button className="up-next-back" onClick={() => st.toggleFullscreen()} aria-label="Exit full screen" title="Exit full screen (F11)"><Icon name="collapse" size={18} /></button>}
{!st.fullscreen && <WindowControls />}
</header>
<div className="up-next-header">
{!st.fullscreen && <div className="up-next-window-controls"><WindowControls /></div>}
<div className="up-next-header" data-tauri-drag-region={isNative ? true : undefined}>
<div className="up-next-now">
<button ref={video} className="up-next-video" onClick={watch} aria-label={`Return to ${item.title}`}><span><Icon name="expand" size={20} /> Return to video</span></button>
<div className="up-next-caption"><span>{episodeLabel(item)} · {item.title}</span><small>{st.ended ? 'Finished' : `−${clock(Math.max(0, st.duration - st.position))}`}</small></div>
<button ref={video} className="up-next-video" onClick={watch} aria-label={`Return to ${item.title}`} />
<div className="up-next-caption"><span>{episodeLabel(item)} · {item.title}</span><small>−{clock(Math.max(0, st.duration - st.position))}</small></div>
<div className="up-next-progress"><i style={{ width: `${st.duration ? Math.min(100, st.position / st.duration * 100) : 0}%` }} /></div>
</div>
<div className="up-next-details">
<span className="micro" id="up-next-heading">{upcoming ? 'Up next' : 'More to watch'}</span>
<span className="micro" id="up-next-heading">{upcoming || !st.episodeContextReady ? 'Up next' : 'More to watch'}</span>
<TitleArt item={item} maxWidth={280} maxHeight={52} as="h2" />
{upcoming ? <>
<h1>{upcoming.title}</h1>
<Facts item={upcoming} withFormats={false} />
<Facts item={{ ...upcoming, viewOffset: 0, originallyAvailableAt: '' }} withFormats={false} />
{upcoming.summary && <p className="up-next-summary">{upcoming.summary}</p>}
<div className="actions">
<button ref={play} className={`up-next-play${counting ? ' counting' : ''}`} style={{ '--p': `${counting && st.countdownTotal ? (1 - st.countdown! / st.countdownTotal) * 100 : 0}%` } as CSSProperties} onClick={() => st.playNext()}>
<span><Icon name="play" size={18} /> Play next episode</span>
</button>
{counting && <button className="up-next-cancel" onClick={() => st.cancelCountdown()}>Cancel autoplay</button>}
</div>
<p className="up-next-hint" role="status">{counting ? 'Autoplay is on · Click, scroll or press any key to cancel' : 'Autoplay is off for this episode'}</p>
</> : <p className="up-next-summary">You’ve reached the end of this series.</p>}
</> : st.episodeContextReady ? <p className="up-next-summary">You’ve reached the end of this series.</p> : <Spinner size={24} />}
</div>
</div>
<div className="up-next-rows">