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

Up Next fixes:
- Re-arm Up Next when playback leaves the credits, and always open it
  at the end of an episode, so it appears every time the credits start.
- Restore the back arrow (to the miniplayer) and add a full-screen
  button at the top, beside the window buttons.
- The show logo opens the show page, as in the player.
- Draw the countdown fill every frame instead of in 50 ms steps.
- Size the row cards from the space under the header so the rows fill
  it; the related row runs off the bottom of short windows.
- Use the next episode's still as the backdrop with a stronger scrim and
  brighter, shadowed description text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-12 12:53:48 -07:00
parent e2166070d0
commit bb204796ac
10 changed files with 133 additions and 49 deletions

View file

@ -1,4 +1,4 @@
import { useEffect, useLayoutEffect, useRef, type CSSProperties } from 'react';
import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';
import { useQuery } from '@tanstack/react-query';
import { usePlayer } from './store';
import { mpv } from './engine';
@ -73,11 +73,25 @@ export function PostPlay() {
}, []);
const backToVideo = () => usePlayer.getState().dismissPostPlay();
// As in the player: the show page opens with playback moving to the miniplayer.
const openShow = () => {
usePlayer.getState().minimize();
navigate({ name: 'item', id: item.grandparentId });
};
// The next episode's own still, as on Android TV: darker than most show art, so the copy reads.
const scene = upcoming ?? item;
const sceneArt = useMemo(() => ({ ...scene, grandparentArt: scene.thumb || scene.grandparentArt }), [scene]);
return (
<div className="player up-next" ref={root} role="dialog" aria-modal="true" aria-labelledby="up-next-label">
<div className="up-next-scene">{server && <Backdrop item={upcoming ?? item} className="up-next-backdrop" />}</div>
<div className="up-next-top" data-tauri-drag-region={isNative ? true : undefined}>
<div className="up-next-scene">{server && <Backdrop item={sceneArt} className="up-next-backdrop" />}</div>
<div className="player-top up-next-top" data-tauri-drag-region={isNative ? true : undefined}>
<button className="player-back" onClick={() => usePlayer.getState().minimize()} aria-label="Back to browsing" title="Keep playing in the corner">
<Icon name="arrowLeft" size={22} />
</button>
<button className="player-icon up-next-fullscreen" aria-label={fullscreen ? 'Exit full screen' : 'Full screen'} title={fullscreen ? 'Exit full screen' : 'Full screen'} onClick={() => usePlayer.getState().toggleFullscreen()}>
<Icon name={fullscreen ? 'collapse' : 'expand'} size={21} />
</button>
{!fullscreen && <WindowControls />}
</div>
@ -90,7 +104,13 @@ export function PostPlay() {
<span className="micro" id="up-next-label">
{upcoming || !contextReady ? 'Up next' : 'More to watch'}
</span>
<TitleArt item={item} maxWidth={300} maxHeight={64} as="h2" className="up-next-logo" />
{item.grandparentId ? (
<button className="player-title-link up-next-logo" title={`Go to ${item.grandparentTitle}`} onClick={openShow}>
<TitleArt item={item} maxWidth={300} maxHeight={64} as="h2" />
</button>
) : (
<TitleArt item={item} maxWidth={300} maxHeight={64} as="h2" className="up-next-logo" />
)}
{upcoming ? (
<>
<h1>{upcoming.title}</h1>
@ -165,19 +185,36 @@ function NowPlaying({ item }: { item: Item }) {
);
}
/** Play next episode. While autoplay counts down, a lighter fill sweeps across it. */
/**
* Play next episode. While autoplay counts down, a lighter fill sweeps across it.
* The store counts in 50 ms steps; the fill is drawn every frame between them.
*/
function PlayNext({ ref }: { ref: React.Ref<HTMLButtonElement> }) {
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;
const counting = usePlayer((s) => s.countdown !== null && s.countdownTotal > 0);
const fill = useRef<HTMLSpanElement>(null);
useEffect(() => {
if (!counting) return;
let last = { value: usePlayer.getState().countdown ?? 0, at: performance.now() };
const unsubscribe = usePlayer.subscribe((s, prev) => {
if (s.countdown !== prev.countdown && s.countdown !== null) last = { value: s.countdown, at: performance.now() };
});
let raf = 0;
const draw = () => {
const { countdownTotal: total } = usePlayer.getState();
// Run on from the last step, but never more than a couple of steps ahead (a held countdown stays held).
const remaining = Math.max(0, last.value - Math.min(performance.now() - last.at, 120) / 1000);
if (fill.current && total) fill.current.style.transform = `scaleX(${1 - remaining / total})`;
raf = requestAnimationFrame(draw);
};
draw();
return () => {
unsubscribe();
cancelAnimationFrame(raf);
};
}, [counting]);
return (
<button
ref={ref}
className={`btn primary lg up-next-play${counting ? ' counting' : ''}`}
style={{ '--fill': `${fill}%` } as CSSProperties}
onClick={() => usePlayer.getState().playNext()}
>
<button ref={ref} className={`btn primary lg up-next-play${counting ? ' counting' : ''}`} onClick={() => usePlayer.getState().playNext()}>
{counting && <span className="up-next-play-fill" ref={fill} aria-hidden="true" />}
<Icon name="play" size={17} />
<span>Play next episode</span>
</button>

View file

@ -109,13 +109,27 @@ describe('Up Next playback lifecycle', () => {
vi.advanceTimersByTime(10000);
expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: null, postPlayDismissed: true });
});
it('returns to credits without reopening on the next time event or EOF', () => {
it('returns to credits without reopening while they play', () => {
time(81);
usePlayer.getState().dismissPostPlay();
time(82);
eof();
expect(usePlayer.getState()).toMatchObject({ postPlay: false, countdown: null });
});
it('reopens at the end after returning to the credits', () => {
time(81);
usePlayer.getState().dismissPostPlay();
eof();
expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: 5 });
});
it('reopens when the credits start again after seeking back into the episode', () => {
time(81);
usePlayer.getState().dismissPostPlay();
usePlayer.getState().seek(40);
time(40);
expect(usePlayer.getState().postPlay).toBe(false);
time(80);
expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: 5 });
});
it.each(['hidden', 'mini'] as const)('holds the countdown while %s', (reason) => {
time(81);
if (reason === 'hidden') Object.assign(document, { hidden: true });

View file

@ -647,8 +647,12 @@ function fallbackAfterError() {
function maybeCredits(pos: number) {
const st = usePlayer.getState();
if (st.item?.type !== 'episode' || !st.firstFrame || st.postPlayDismissed) return;
if (st.item.markers.some((m) => m.type === 'credits' && pos * 1000 >= m.start && pos * 1000 < m.end)) openPostPlay();
if (st.item?.type !== 'episode' || !st.firstFrame) return;
const inCredits = st.item.markers.some((m) => m.type === 'credits' && pos * 1000 >= m.start && pos * 1000 < m.end);
// Leaving the credits (seeking back into the episode) re-arms Up Next for the next time they start.
if (!inCredits) {
if (st.postPlayDismissed && !st.postPlay && !st.ended) usePlayer.setState({ postPlayDismissed: false });
} else if (!st.postPlayDismissed) openPostPlay();
}
function onEnded() {
@ -657,7 +661,11 @@ function onEnded() {
usePlayer.setState({ ended: true });
report('stopped');
checkScrobble();
if (st.item?.type === 'episode') openPostPlay();
// Reaching the end always offers Up Next, as on Android, even after watching the credits.
if (st.item?.type === 'episode' && !st.postPlay) {
usePlayer.setState({ postPlayDismissed: false });
openPostPlay();
}
}
export const usePlayer = create<PlayerState>((set, get) => ({

View file

@ -711,11 +711,8 @@ html.os-macos:not(.window-fullscreen) .player-top {
.up-next {
display: flex;
flex-direction: column;
--up-top: 44px;
--up-video-w: clamp(320px, 34vw, 640px);
}
html.os-macos:not(.window-fullscreen) .up-next {
--up-top: 64px;
--up-video-w: clamp(320px, 34vw, 640px);
}
.up-next-scene {
position: absolute;
@ -745,28 +742,30 @@ html.os-macos:not(.window-fullscreen) .up-next {
.up-next-backdrop .backdrop-scrim,
.up-next-backdrop.washed .backdrop-scrim {
background:
linear-gradient(90deg, rgba(9, 10, 12, 0.95) 0%, rgba(9, 10, 12, 0.86) 36%, rgba(9, 10, 12, 0.6) 64%, rgba(9, 10, 12, 0.28) 100%),
linear-gradient(90deg, rgba(9, 10, 12, 0.96) 0%, rgba(9, 10, 12, 0.9) 38%, rgba(9, 10, 12, 0.74) 62%, rgba(9, 10, 12, 0.55) 100%),
linear-gradient(0deg, var(--bg) 0%, rgba(9, 10, 12, 0.6) 22%, transparent 55%);
}
.up-next-top {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 34px;
height: 60px;
z-index: 3;
}
.up-next-top .window-controls {
position: absolute;
top: 0;
right: 0;
height: 34px;
margin: 0;
.up-next-fullscreen {
margin-left: auto;
}
.up-next-top .window-controls button {
/* Beside the window's own buttons (Windows, outside full screen), it takes
their size and line so the four read as one group. */
.up-next-top:has(> .window-controls) .up-next-fullscreen {
align-self: flex-start;
width: 46px;
height: 34px;
margin-right: 110px;
border-radius: 0;
color: #e4e8e9;
}
.up-next-top:has(> .window-controls) .up-next-fullscreen svg {
width: 15px;
height: 15px;
}
.up-next-head {
position: relative;
z-index: 1;
@ -860,7 +859,8 @@ html.os-macos:not(.window-fullscreen) .up-next {
}
.up-next-summary {
margin: 14px 0 0;
color: #d0d5d8;
color: #e3e7e9;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 14px rgba(0, 0, 0, 0.55);
font-size: 14px;
line-height: 1.62;
display: -webkit-box;
@ -880,13 +880,14 @@ html.os-macos:not(.window-fullscreen) .up-next {
.up-next-play.counting:hover:not(:disabled) {
background: #a3a8a9;
}
.up-next-play.counting::before {
content: '';
.up-next-play-fill {
position: absolute;
inset: 0 auto 0 0;
inset: 0;
z-index: -1;
width: var(--fill);
background: #f6f7f7;
transform: scaleX(0);
transform-origin: left;
will-change: transform;
}
.up-next-play:focus-visible {
outline: 2px solid #fff;
@ -905,8 +906,21 @@ html.os-macos:not(.window-fullscreen) .up-next {
.up-next-shelf {
margin-bottom: 22px;
}
/* Cards are sized from the space below the header, so the season and related
rows fill it (--up-row: a row's height besides its artwork). In a short,
wide window they keep a sensible size and the related row runs off the
bottom, as on Android TV. */
.up-next-rows {
container-type: size;
--up-row: 128px;
}
.up-next-shelf .shelf .card.landscape {
width: clamp(200px, 15.5vw, 290px);
width: clamp(15vw, calc((50cqh - var(--up-row)) * 16 / 9), 26vw);
}
@media (max-width: 1333px) {
.up-next-shelf .shelf .card.landscape {
width: clamp(200px, calc((50cqh - var(--up-row)) * 16 / 9), 26vw);
}
}
.up-next-shelf .card {
scroll-margin-left: 0;