Release Kaleido Desktop 1.0.0

Out of beta. Show and season pages:
- Season pages list episodes as a grid of cards (still, description,
  watched state) instead of the episode list and season picker; the
  season title opens a menu of the show's seasons (replacing the page,
  so Back returns to the show).
- Show pages keep only the Seasons row; single-season shows list their
  episodes. The up-next line adds the title instead of repeating the
  episode number.
- Season Play/Resume follows the show's on-deck episode, and the season
  shows the year it aired.

Watching:
- A title Plex has counted as played stays watched during an
  unfinished rewatch; leftover positions only show in Continue Watching
  and on the episode you're up to. Resume buttons use resumable().
- Next/previous episode (autoplay, Up Next, player) start from the top.

Browsing:
- Rows that haven't been scrolled stay at their start when items are
  added in front (scroll snapping kept the old first card in place).
- Show names on episode cards link to the show; seasons outside their
  show's page are captioned with the show's name.
- Detail facts show the runtime; the Resume button has the time left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-13 13:41:02 -07:00
parent 5719432fe8
commit 5189b1f6b1
15 changed files with 263 additions and 247 deletions

View file

@ -1,5 +1,20 @@
# Changelog
## 1.0.0
Kaleido is out of beta. This release reworks the show and season pages and smooths out watching a series.
- Season pages show their episodes as a grid of cards, each with its still, description and watched state, in place of the long episode list.
- Click the season's name under the show's logo to switch to another season.
- Show pages list seasons once, as a row of posters. A show with only one season shows its episodes directly.
- Episodes you've watched stay marked as watched when you rewatch them and stop partway through. The leftover position only shows on the episode you're up to.
- When the next episode plays, whether automatically or with Next, it starts from the beginning instead of near the end of an earlier viewing.
- Click a show's name under a Continue Watching card to go to the show.
- Continue Watching starts at the first title when something new is added, instead of scrolling it off the left edge.
- Season posters outside their show's page, such as New Seasons, are labelled with the show's name.
- Season pages show the year the season aired, and their Play button agrees with the show page about which episode is next.
- Movie and episode pages show the runtime in their details, with the time left on the Resume button.
## 0.1.0-beta.19
Up Next fixes.

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "kaleido-desktop",
"version": "0.1.0-beta.19",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kaleido-desktop",
"version": "0.1.0-beta.19",
"version": "1.0.0",
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
"@tanstack/react-query": "^5.105.0",

View file

@ -1,7 +1,7 @@
{
"name": "kaleido-desktop",
"private": true,
"version": "0.1.0-beta.19",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",

2
src-tauri/Cargo.lock generated
View file

@ -2173,7 +2173,7 @@ dependencies = [
[[package]]
name = "kaleido"
version = "0.1.0-beta.19"
version = "1.0.0"
dependencies = [
"fs2",
"futures-util",

View file

@ -1,6 +1,6 @@
[package]
name = "kaleido"
version = "0.1.0-beta.19"
version = "1.0.0"
description = "Kaleido — a Plex client for Windows"
authors = ["Elijah"]
edition = "2021"

View file

@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Kaleido",
"version": "0.1.0-beta.19",
"version": "1.0.0",
"identifier": "tv.kaleido.desktop",
"build": {
"beforeDevCommand": "npm run dev",

View file

@ -36,10 +36,19 @@ export function progress(item: Item): number {
return Math.min(1, Math.max(0, item.viewOffset / item.duration));
}
/**
* Watched once Plex has counted a full play. A rewatch left partway through keeps the
* title watched; its position only matters for resuming (`resumable`).
*/
export function isWatched(item: Item, percent = 90): boolean {
if (item.type === 'show' || item.type === 'season') return item.leafCount > 0 && item.viewedLeafCount >= item.leafCount;
if (item.viewOffset > 0 && item.duration > 0) return item.viewCount > 0 && item.viewOffset / item.duration >= percent / 100;
return item.viewCount > 0;
if (item.viewCount > 0) return true;
return item.viewOffset > 0 && item.duration > 0 && item.viewOffset / item.duration >= percent / 100;
}
/** Has a saved position worth resuming from (not one at the very end). */
export function resumable(item: Item): boolean {
return item.viewOffset > 0 && item.duration > 0 && item.viewOffset < item.duration * 0.97;
}
export function remainingEpisodes(item: Item): number {

View file

@ -1,9 +1,9 @@
/**
* Arrow-key movement between titles, for keyboard users. Focus moves to the
* nearest card in the pressed direction (by on-screen geometry), so it works
* the same across shelves, grids, episode lists and people rows.
* the same across shelves, grids and people rows.
*/
const TARGETS = '.card, .person-card:not(:disabled), .episode-row, .shelf-title-link';
const TARGETS = '.card, .person-card:not(:disabled), .shelf-title-link';
function center(r: DOMRect) {
return { x: r.left + r.width / 2, y: r.top + r.height / 2 };

View file

@ -102,6 +102,14 @@ describe('Up Next playback lifecycle', () => {
expect(next).toHaveBeenCalledOnce();
usePlayer.setState({ playNext: original });
});
it('starts the next episode from the beginning, ignoring an earlier partial viewing', async () => {
const original = usePlayer.getState().play;
const spy = vi.fn().mockResolvedValue(undefined);
usePlayer.setState({ play: spy, nextUp: { ...episode('2'), viewOffset: 88000 } });
await usePlayer.getState().playNext();
expect(spy).toHaveBeenCalledWith(expect.objectContaining({ id: '2' }), expect.objectContaining({ resume: false }));
usePlayer.setState({ play: original });
});
it('cancels autoplay while keeping the screen open, including across EOF', () => {
time(81);
usePlayer.getState().cancelCountdown();

View file

@ -1019,13 +1019,15 @@ export const usePlayer = create<PlayerState>((set, get) => ({
const st = get();
stopCountdown();
if (!st.nextUp) return;
await st.play(st.nextUp, { resume: true, quality: st.quality });
// Watching on through a season starts each episode from the top, never at a
// stale position left by an earlier, unfinished viewing.
await st.play(st.nextUp, { resume: false, quality: st.quality });
},
async playPrevious() {
const st = get();
if (!st.prevUp) return;
await st.play(st.prevUp, { resume: true, quality: st.quality });
await st.play(st.prevUp, { resume: false, quality: st.quality });
},
cancelCountdown() {

View file

@ -3,7 +3,7 @@ import { parseItem, parseScores } from './parse';
import { isLocalAddress } from './account';
import { partAt } from './playback';
import { headerSafe } from './client';
import { duration, formatBadges, isWatched, remaining, washGradient } from '../app/format';
import { duration, formatBadges, isWatched, remaining, resumable, washGradient } from '../app/format';
import { buildFeatures } from '../screens/discover';
import type { Hub } from './types';
@ -65,10 +65,16 @@ describe('parsing', () => {
});
describe('watched rules', () => {
it('treats a resumed title as watched only past the threshold', () => {
expect(isWatched(movie({ viewCount: 1, viewOffset: 3000000 }), 90)).toBe(false);
expect(isWatched(movie({ viewCount: 1, viewOffset: 5700000 }), 90)).toBe(true);
it('keeps a title watched while it is being rewatched', () => {
expect(isWatched(movie({ viewCount: 1, viewOffset: 3000000 }), 90)).toBe(true);
expect(isWatched(movie({ viewCount: 1 }), 90)).toBe(true);
expect(resumable(movie({ viewCount: 1, viewOffset: 3000000 }))).toBe(true);
});
it('counts an unplayed title as watched only past the threshold', () => {
expect(isWatched(movie({ viewOffset: 3000000 }), 90)).toBe(false);
expect(isWatched(movie({ viewOffset: 5700000 }), 90)).toBe(true);
expect(isWatched(movie({}), 90)).toBe(false);
});
it('uses episode counts for shows', () => {

View file

@ -4,12 +4,12 @@ import type { Item } from '../plex/types';
import { PROGRESS, useChildren, useItem, useRelated, useServerQuery } from '../app/queries';
import { useServer } from '../app/session';
import { useSettings } from '../app/settings';
import { goBack, navigate, useRouter } from '../app/router';
import { canManage, itemMenu, openDialog, openItem, playItem, playWithVersion, setWatched, shuffleItem } from '../app/actions';
import { bitrate, channelLabel, date, duration, episodeLabel, extraLabel, fileSize, isWatched, remaining, resolutionLabel, technicalLine } from '../app/format';
import { goBack, navigate } from '../app/router';
import { canManage, itemMenu, openDialog, playItem, playWithVersion, setWatched, shuffleItem } from '../app/actions';
import { bitrate, channelLabel, date, duration, episodeLabel, extraLabel, fileSize, isWatched, remaining, remainingEpisodes, resolutionLabel, resumable, technicalLine } from '../app/format';
import { Backdrop } from '../ui/Backdrop';
import { Facts, HubShelf, LandscapeCard, PersonCard, PosterCard, Shelf, TitleArt } from '../ui/media';
import { Artwork, Button, EmptyState, ErrorState, IconButton, PageLoader, Select } from '../ui/primitives';
import { EpisodeCard, Facts, HubShelf, LandscapeCard, PersonCard, PosterCard, Shelf, TitleArt } from '../ui/media';
import { Artwork, Button, EmptyState, ErrorState, IconButton, PageLoader } from '../ui/primitives';
import { Icon } from '../ui/Icon';
import { openMenu } from '../ui/overlays';
import { useDownloads } from '../downloads/store';
@ -255,11 +255,12 @@ function AboutPanel({ item }: { item: Item }) {
// —— Movie ——————————————————————————————————————————————————————————
function MovieDetail({ item }: { item: Item }) {
const resume = item.viewOffset > 0 && !isWatched(item);
const resume = resumable(item);
return (
<div className="detail movie">
<DetailHero item={item}>
<Facts item={item} />
{/* The Resume button carries the time left; the facts give the runtime. */}
<Facts item={{ ...item, viewOffset: 0 }} />
<Synopsis item={item} text={item.summary} />
<div className="actions detail-actions">
<Button variant="primary" icon="play" onClick={() => playWithVersion(item)}>
@ -298,115 +299,75 @@ function MovieDetail({ item }: { item: Item }) {
// —— Shows and seasons ————————————————————————————————————————————
function EpisodeRow({ ep }: { ep: Item }) {
const server = useServer();
const percent = useSettings((s) => s.watchedPercent);
const watched = isWatched(ep, percent);
const p = ep.viewOffset && ep.duration ? ep.viewOffset / ep.duration : 0;
function EpisodeGrid({ episodes, upNextId }: { episodes: Item[] | undefined; upNextId?: string }) {
if (!episodes) return <PageLoader />;
if (!episodes.length) return <EmptyState icon="tv" title="No episodes" />;
return (
<div
className="episode-row"
role="button"
tabIndex={0}
onClick={() => openItem(ep)}
onKeyDown={(e) => e.key === 'Enter' && openItem(ep)}
onContextMenu={(e) => {
e.preventDefault();
openMenu(itemMenu(ep), { x: e.clientX, y: e.clientY });
}}
>
<div className="episode-index">{ep.index || '–'}</div>
<div className="episode-pic">
<Artwork src={server.image(ep.thumb, 320, 180)} />
<button
className="episode-play"
aria-label={`Play ${ep.title}`}
onClick={(e) => {
e.stopPropagation();
playWithVersion(ep);
}}
>
<Icon name="play" size={18} />
</button>
{p > 0 && !watched && (
<span className="progress-line">
<i style={{ width: `${p * 100}%` }} />
</span>
)}
</div>
<div className="episode-text">
<h3>
{ep.title}
{watched && <Icon name="check" size={15} className="episode-watched" />}
</h3>
<div className="episode-meta">
{[duration(ep.duration), ep.originallyAvailableAt ? date(ep.originallyAvailableAt) : '', ep.viewOffset && !watched ? remaining(ep) : ''].filter(Boolean).join(' · ')}
</div>
{ep.summary && <p>{ep.summary}</p>}
</div>
<button
className="icon-btn episode-more"
aria-label="More"
onClick={(e) => {
e.stopPropagation();
openMenu(itemMenu(ep), e.currentTarget);
}}
>
<Icon name="dots" size={18} />
</button>
<div className="episode-grid">
{episodes.map((ep) => (
<EpisodeCard key={ep.id} item={ep} upNext={ep.id === upNextId} />
))}
</div>
);
}
function Episodes({ seasons, initialSeason, showPicker = true }: { seasons: Item[]; initialSeason?: string; showPicker?: boolean }) {
const saved = useRouter((s) => s.current.state.season as string | undefined);
const [seasonId, setSeasonId] = useState(saved ?? initialSeason ?? seasons[0]?.id);
useEffect(() => {
if (!seasonId && seasons[0]) setSeasonId(initialSeason ?? seasons[0].id);
}, [seasons, initialSeason]);
const episodes = useChildren(seasonId);
const season = seasons.find((s) => s.id === seasonId);
if (!seasons.length) return null;
function EpisodesSection({ episodes, subtitle, upNextId }: { episodes: Item[] | undefined; subtitle?: string; upNextId?: string }) {
return (
<section className="episodes">
<div className="episodes-head">
<h2>Episodes</h2>
{showPicker && seasons.length > 1 && (
<Select
value={seasonId!}
label="Season"
options={seasons.map((s) => ({ value: s.id, label: s.title, hint: s.leafCount ? `${s.leafCount} ep` : undefined }))}
onChange={(v) => {
setSeasonId(v);
useRouter.getState().setState({ season: v });
}}
/>
)}
{season && (
<span className="episodes-sub">
{season.leafCount} episodes{season.year ? ` · ${season.year}` : ''}
</span>
)}
</div>
{season?.summary && <p className="season-summary">{season.summary}</p>}
<div className="episode-list">
{episodes.isLoading && <PageLoader />}
{episodes.data?.map((ep) => <EpisodeRow key={ep.id} ep={ep} />)}
{episodes.data && !episodes.data.length && <EmptyState icon="tv" title="No episodes" />}
<div className="shelf-head">
<h2>
Episodes
{subtitle && <small>{subtitle}</small>}
</h2>
</div>
<EpisodeGrid episodes={episodes} upNextId={upNextId} />
</section>
);
}
/** The season's name, which opens a menu of the show's other seasons. */
function SeasonSwitcher({ season, seasons }: { season: Item; seasons: Item[] }) {
if (seasons.length < 2) return <h1 className="detail-subtitle">{season.title}</h1>;
const choose = (e: React.MouseEvent<HTMLButtonElement>) =>
openMenu(
seasons.map((s) => ({
label: s.title,
hint: s.leafCount ? `${s.leafCount} episodes` : undefined,
checked: s.id === season.id,
// Replace, so Back still returns to the show rather than through each season.
onSelect: () => s.id !== season.id && navigate({ name: 'item', id: s.id, title: s.title }, { replace: true }),
})),
e.currentTarget,
{ minWidth: 240 },
);
return (
<h1 className="detail-subtitle">
<button className="season-switch" aria-haspopup="menu" title="Choose a season" onClick={choose}>
{season.title}
<Icon name="chevronDown" size={20} strokeWidth={2.4} />
</button>
</h1>
);
}
/** "24 episodes · 8 unwatched", by Plex's own counts so it agrees with the Watched button. */
function seasonSubtitle(season: Item) {
const count = season.leafCount;
if (!count) return '';
const left = remainingEpisodes(season);
return [`${count} episode${count === 1 ? '' : 's'}`, left > 0 && left < count ? `${left} unwatched` : ''].filter(Boolean).join(' · ');
}
function ShowDetail({ item }: { item: Item }) {
const seasons = useChildren(item.id);
const server = useServer();
const next = useServerQuery(['onDeck', item.id], (s) => api.onDeckFor(s, item), PROGRESS);
const nextEp = next.data;
const seasonList = (seasons.data ?? []).filter((s) => s.type === 'season');
// A single-season show lists its episodes here instead of one lonely poster.
const only = seasonList.length === 1 ? seasonList[0] : undefined;
const onlyEpisodes = useChildren(only?.id);
const percent = useSettings((s) => s.watchedPercent);
const playLabel = nextEp ? (nextEp.viewOffset ? `Resume ${episodeLabel(nextEp)}` : isWatched(item, percent) ? 'Play' : item.viewedLeafCount ? `Watch ${episodeLabel(nextEp)}` : 'Play') : 'Play';
void server;
const playLabel = nextEp ? (resumable(nextEp) ? `Resume ${episodeLabel(nextEp)}` : isWatched(item, percent) ? 'Play' : item.viewedLeafCount ? `Watch ${episodeLabel(nextEp)}` : 'Play') : 'Play';
return (
<div className="detail show">
<DetailHero item={item}>
@ -424,14 +385,16 @@ function ShowDetail({ item }: { item: Item }) {
<DownloadButton item={item} />
<MoreButton item={item} onDeleted={goBack} />
</div>
{/* The button names the episode number; this adds its title, and the time left when resuming. */}
{nextEp && (
<div className="detail-tech">
Up next: {episodeLabel(nextEp)} · {nextEp.title}
Up next: {[nextEp.title, resumable(nextEp) ? remaining(nextEp) : ''].filter(Boolean).join(' · ')}
</div>
)}
</DetailHero>
<div className="detail-body">
<div className="detail-main">
{seasons.isLoading && <PageLoader />}
{seasonList.length > 1 && (
<Shelf title="Seasons">
{seasonList.map((s) => (
@ -439,7 +402,7 @@ function ShowDetail({ item }: { item: Item }) {
))}
</Shelf>
)}
{seasons.isLoading ? <PageLoader /> : <Episodes seasons={seasonList} initialSeason={nextEp?.parentId} />}
{only && <EpisodesSection episodes={onlyEpisodes.data} subtitle={seasonSubtitle(only)} upNextId={nextEp?.id} />}
<CastRow item={item} />
<ExtrasRow item={item} />
<RelatedRows item={item} />
@ -452,12 +415,21 @@ function ShowDetail({ item }: { item: Item }) {
function SeasonDetail({ item }: { item: Item }) {
const show = useItem(item.parentId);
const showItem = show.data;
const episodes = useChildren(item.id);
const siblings = useChildren(item.parentId);
const seasonList = (siblings.data ?? []).filter((s) => s.type === 'season');
const episodes = useChildren(item.id);
const deck = useServerQuery(['onDeck', item.parentId], (s) => (showItem ? api.onDeckFor(s, showItem) : Promise.resolve(null)), { ...PROGRESS, enabled: !!showItem });
const percent = useSettings((s) => s.watchedPercent);
const next = (episodes.data ?? []).find((e) => !isWatched(e, percent)) ?? episodes.data?.[0];
const showItem = show.data;
const list = episodes.data ?? [];
// The show's up-next episode when it is in this season (so the season page and the
// show page agree), else the first one started but never finished, else the first
// unwatched, else the start of the season. Positions left by rewatches don't count.
const deckHere = deck.data?.parentId === item.id ? list.find((e) => e.id === deck.data!.id) : undefined;
const next = deckHere ?? list.find((e) => resumable(e) && !isWatched(e, percent)) ?? list.find((e) => !isWatched(e, percent)) ?? list[0];
const resumeNext = !!next && resumable(next) && (next === deckHere || !isWatched(next, percent));
const aired = list.find((e) => e.originallyAvailableAt)?.originallyAvailableAt;
const year = aired ? new Date(aired).getFullYear() : item.year;
return (
<div className="detail season">
<DetailHero
@ -472,15 +444,15 @@ function SeasonDetail({ item }: { item: Item }) {
) : (
<h2 className="title-text small">{item.parentTitle}</h2>
)}
<h1 className="detail-subtitle">{item.title}</h1>
<SeasonSwitcher season={item} seasons={seasonList} />
</>
}
>
<Facts item={{ ...item, contentRating: showItem?.contentRating ?? item.contentRating, genres: [] }} />
<Facts item={{ ...item, year, contentRating: showItem?.contentRating ?? item.contentRating, genres: [] }} />
<Synopsis item={item} text={item.summary || showItem?.summary || ''} />
<div className="actions detail-actions">
<Button variant="primary" icon="play" disabled={!next} onClick={() => next && playWithVersion(next)}>
{next ? (next.viewOffset ? `Resume ${episodeLabel(next)}` : `Play ${episodeLabel(next)}`) : 'Play'}
<Button variant="primary" icon="play" disabled={!next} onClick={() => next && playWithVersion(next, resumeNext ? {} : { offsetMs: 0, resume: false })}>
{next ? `${resumeNext ? 'Resume' : 'Play'} ${episodeLabel(next)}` : 'Play'}
</Button>
<WatchedButton item={item} />
<DownloadButton item={item} />
@ -489,7 +461,7 @@ function SeasonDetail({ item }: { item: Item }) {
</DetailHero>
<div className="detail-body single">
<div className="detail-main">
<Episodes seasons={seasonList.length ? seasonList : [item]} initialSeason={item.id} />
<EpisodesSection episodes={episodes.data} subtitle={seasonSubtitle(item)} upNextId={resumeNext ? next?.id : undefined} />
{showItem && <CastRow item={showItem} />}
</div>
</div>
@ -500,7 +472,7 @@ function SeasonDetail({ item }: { item: Item }) {
function EpisodeDetail({ item }: { item: Item }) {
const show = useItem(item.grandparentId);
const siblings = useChildren(item.parentId);
const resume = item.viewOffset > 0 && !isWatched(item);
const resume = resumable(item);
const showItem = show.data;
const others = (siblings.data ?? []).filter((e) => e.id !== item.id);
const startIndex = Math.max(0, (siblings.data ?? []).findIndex((e) => e.id === item.id));
@ -523,7 +495,7 @@ function EpisodeDetail({ item }: { item: Item }) {
</>
}
>
<Facts item={{ ...item, contentRating: item.contentRating || showItem?.contentRating || '' }} />
<Facts item={{ ...item, viewOffset: 0, contentRating: item.contentRating || showItem?.contentRating || '' }} />
<Synopsis item={item} text={item.summary} />
<div className="actions detail-actions">
<Button variant="primary" icon="play" onClick={() => playWithVersion(item)}>

View file

@ -853,6 +853,7 @@ html.splash-arrival .auth-screen {
overflow-y: hidden;
scroll-snap-type: x proximity;
scroll-padding: 0 var(--gutter);
overflow-anchor: none;
padding: 4px var(--gutter) 10px;
scrollbar-width: none;
}
@ -1091,6 +1092,23 @@ html.splash-arrival .auth-screen {
.card.landscape .card-title {
font-size: 13px;
}
.card-title-link {
max-width: 100%;
font: inherit;
color: inherit;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-decoration: underline;
text-decoration-color: transparent;
text-underline-offset: 3px;
transition: text-decoration-color var(--t-fast);
}
.card-title-link:hover {
color: #fff;
text-decoration-color: rgba(255, 255, 255, 0.5);
}
.card-meta {
font-size: 11.5px;
color: #8a9196;

View file

@ -430,6 +430,30 @@ button.chip:hover {
letter-spacing: -0.035em;
font-weight: 700;
}
.season-switch {
display: inline-flex;
align-items: center;
gap: 6px;
margin-left: -8px;
padding: 2px 6px 2px 8px;
border-radius: 8px;
font: inherit;
letter-spacing: inherit;
transition: background var(--t-fast);
}
.season-switch svg {
color: #aeb5b8;
transition:
color var(--t-fast),
transform var(--t-fast);
}
.season-switch:hover {
background: rgba(255, 255, 255, 0.08);
}
.season-switch:hover svg {
color: #fff;
transform: translateY(1px);
}
.synopsis-wrap {
max-width: 640px;
}
@ -580,122 +604,29 @@ button.chip:hover {
}
/* Episodes */
.episodes {
margin-bottom: 36px;
margin-bottom: 34px;
}
.episodes-head {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 8px;
.episodes .shelf-head {
padding: 0;
}
.episodes-head h2 {
margin: 0;
font-size: 19px;
letter-spacing: -0.028em;
.episode-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 19vw, 320px), 1fr));
gap: 30px 16px;
}
.episodes-sub {
color: var(--dim);
font-size: 12px;
}
.season-summary {
color: #aeb5b8;
font-size: 12.5px;
line-height: 1.6;
max-width: 760px;
margin: 4px 0 8px;
}
.episode-row {
.episode-grid .card {
scroll-margin: 96px 0 48px;
display: grid;
grid-template-columns: 34px 220px minmax(0, 1fr) 40px;
gap: 20px;
align-items: center;
padding: 16px 12px 16px 6px;
border-bottom: 1px solid var(--line-soft);
border-radius: 10px;
cursor: pointer;
transition: background var(--t-fast);
}
.episode-row:hover,
.episode-row:focus-visible {
background: rgba(255, 255, 255, 0.045);
}
.episode-row:focus-visible {
outline: 2px solid #f2f5f4;
outline-offset: 0;
}
.episode-index {
font-size: 22px;
font-weight: 650;
color: #8a9196;
text-align: center;
font-variant-numeric: tabular-nums;
}
.episode-pic {
position: relative;
aspect-ratio: 16 / 9;
border-radius: 6px;
overflow: hidden;
background: #1c2024;
}
.episode-pic .artwork {
position: absolute;
inset: 0;
}
.episode-play {
position: absolute;
left: 50%;
top: 50%;
width: 42px;
height: 42px;
margin: -21px 0 0 -21px;
border-radius: 50%;
display: grid;
place-items: center;
background: rgba(255, 255, 255, 0.92);
color: #121314;
opacity: 0;
transform: scale(0.9);
transition:
opacity var(--t),
transform var(--t) var(--ease-out);
}
.episode-row:hover .episode-play {
opacity: 1;
transform: none;
}
.episode-text h3 {
font-size: 14px;
margin: 0 0 4px;
font-weight: 640;
display: flex;
align-items: center;
gap: 8px;
}
.episode-watched {
color: #9fd6bb;
}
.episode-meta {
font-size: 11.5px;
color: #8a9196;
margin-bottom: 7px;
}
.episode-text p {
margin: 0;
.episode-card-summary {
margin: 7px 0 0;
font-size: 12px;
line-height: 1.55;
color: #a8afb3;
color: #a1a8ac;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.episode-more {
opacity: 0;
}
.episode-row:hover .episode-more {
opacity: 1;
}
/* —— Search ————————————————————————————————————————————————— */
.search-hero {
@ -2045,10 +1976,6 @@ button.chip:hover {
.download-intro {
grid-template-columns: minmax(0, 1fr);
}
.episode-row {
grid-template-columns: 26px 160px minmax(0, 1fr) 36px;
gap: 14px;
}
.history-row {
grid-template-columns: 36px minmax(0, 1fr) 120px 90px;
}

View file

@ -1,9 +1,10 @@
import { memo, useEffect, useRef, useState, type ReactNode } from 'react';
import { memo, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react';
import type { Item } from '../plex/types';
import { useServer, useSession } from '../app/session';
import { useSettings } from '../app/settings';
import { art, displayTitle, duration, episodeLabel, formatBadges, isWatched, progress, remaining, remainingEpisodes } from '../app/format';
import { art, date, displayTitle, duration, episodeLabel, formatBadges, isWatched, progress, remaining, remainingEpisodes } from '../app/format';
import { itemMenu, openItem, playWithVersion } from '../app/actions';
import { navigate } from '../app/router';
import { Artwork } from './primitives';
import { Icon } from './Icon';
import { openMenu } from './overlays';
@ -141,9 +142,14 @@ function WatchBadge({ item }: { item: Item }) {
return null;
}
function ProgressLine({ item }: { item: Item }) {
/**
* A watched title's leftover position (from an unfinished rewatch) only shows where it's
* what you're resuming: Continue Watching, or the season's up-next episode.
*/
function ProgressLine({ item, always = false }: { item: Item; always?: boolean }) {
const percent = useSettings((s) => s.watchedPercent);
const p = progress(item);
if (!p || p > 0.995) return null;
if (!p || p > 0.995 || (!always && isWatched(item, percent))) return null;
return (
<span className="progress-line">
<i style={{ width: `${Math.max(3, p * 100)}%` }} />
@ -204,12 +210,15 @@ export const PosterCard = memo(function PosterCard({ item, caption = 'year', cla
const server = useServer();
const handlers = useCardHandlers(item);
const path = art.poster(item);
// On its show's page a season is just "Season 2"; anywhere else it needs the show's name.
const seasonAlone = item.type === 'season' && caption !== 'episodes' && !!item.parentTitle;
const title = item.type === 'season' && !seasonAlone ? item.title : displayTitle(item);
let meta: ReactNode = null;
if (caption === 'year') meta = item.type === 'episode' ? episodeLabel(item) : item.type === 'season' ? (item.leafCount ? `${item.leafCount} episodes` : '') : item.type === 'collection' ? (item.childCount ? `${item.childCount} titles` : 'Collection') : item.year || '';
if (caption === 'year') meta = item.type === 'episode' ? episodeLabel(item) : item.type === 'season' ? item.title : item.type === 'collection' ? (item.childCount ? `${item.childCount} titles` : 'Collection') : item.year || '';
if (caption === 'episodes') meta = item.leafCount ? `${item.leafCount} episodes` : '';
if (caption === 'role') meta = (item as any).roleName ?? item.year;
return (
<article className={`card poster ${className}`} role="button" tabIndex={0} aria-label={item.title} {...handlers} {...previewHandlers(item)}>
<article className={`card poster ${className}`} role="button" tabIndex={0} aria-label={seasonAlone ? `${title}, ${item.title}` : title} {...handlers} {...previewHandlers(item)}>
<div className="card-cover">
<Artwork src={server.image(path, 240, 360)} alt="" fallback={<span className="cover-fallback">{displayTitle(item)}</span>} />
<div className="card-hover" />
@ -219,8 +228,8 @@ export const PosterCard = memo(function PosterCard({ item, caption = 'year', cla
</div>
{caption !== 'none' && (
<div className="card-caption">
<div className="card-title" title={item.type === 'season' ? item.title : displayTitle(item)}>
{item.type === 'season' ? item.title : displayTitle(item)}
<div className="card-title" title={title}>
{title}
</div>
{meta ? <div className="card-meta">{meta}</div> : null}
</div>
@ -232,14 +241,16 @@ export const PosterCard = memo(function PosterCard({ item, caption = 'year', cla
export const LandscapeCard = memo(function LandscapeCard({ item, continueWatching, showTitle = true, episodeStyle = false }: { item: Item; continueWatching?: boolean; showTitle?: boolean; episodeStyle?: boolean }) {
const server = useServer();
const handlers = useCardHandlers(item, { continueWatching });
const percent = useSettings((s) => s.watchedPercent);
const inProgress = !!item.viewOffset && (continueWatching || !isWatched(item, percent));
const isEp = item.type === 'episode';
const path = isEp ? item.thumb || item.grandparentArt : art.landscape(item);
const title = episodeStyle && isEp ? `${item.index}. ${item.title}` : displayTitle(item);
const meta = isEp
? episodeStyle
? [duration(item.duration), item.viewOffset ? remaining(item) : ''].filter(Boolean).join(' · ')
? [duration(item.duration), inProgress ? remaining(item) : ''].filter(Boolean).join(' · ')
: `${episodeLabel(item)} ${item.title}`
: item.viewOffset
: inProgress
? remaining(item)
: [item.year, duration(item.duration)].filter(Boolean).join(' · ');
return (
@ -254,12 +265,25 @@ export const LandscapeCard = memo(function LandscapeCard({ item, continueWatchin
<div className="card-hover" />
<CardActions item={item} ctx={{ continueWatching }} />
{episodeStyle && <WatchBadge item={item} />}
<ProgressLine item={item} />
<ProgressLine item={item} always={continueWatching} />
</div>
{showTitle && (
<div className="card-caption">
<div className="card-title" title={title}>
{title}
{isEp && !episodeStyle && item.grandparentId ? (
<button
className="card-title-link"
tabIndex={-1}
onClick={(e) => {
e.stopPropagation();
navigate({ name: 'item', id: item.grandparentId, title: item.grandparentTitle });
}}
>
{title}
</button>
) : (
title
)}
</div>
<div className="card-meta">{meta}</div>
</div>
@ -268,6 +292,34 @@ export const LandscapeCard = memo(function LandscapeCard({ item, continueWatchin
);
});
/** An episode with its synopsis, for a season's episode grid. `upNext` shows its resume point even when watched. */
export const EpisodeCard = memo(function EpisodeCard({ item, upNext = false }: { item: Item; upNext?: boolean }) {
const server = useServer();
const handlers = useCardHandlers(item);
const percent = useSettings((s) => s.watchedPercent);
const inProgress = !!item.viewOffset && (upNext || !isWatched(item, percent));
const title = item.index ? `${item.index}. ${item.title}` : item.title;
const meta = [duration(item.duration), inProgress ? remaining(item) : date(item.originallyAvailableAt)].filter(Boolean).join(' · ');
return (
<article className="card landscape episode-card" role="button" tabIndex={0} aria-label={title} {...handlers}>
<div className="card-cover">
<Artwork src={server.image(item.thumb || item.grandparentArt, 400, 225)} alt="" fallback={<span className="cover-fallback">{title}</span>} />
<div className="card-hover" />
<CardActions item={item} />
<WatchBadge item={item} />
<ProgressLine item={item} always={upNext} />
</div>
<div className="card-caption">
<div className="card-title" title={title}>
{title}
</div>
<div className="card-meta">{meta}</div>
{item.summary && <p className="episode-card-summary">{item.summary}</p>}
</div>
</article>
);
});
export function PersonCard({ name, role, thumb, onClick }: { name: string; role?: string; thumb?: string; onClick?: () => void }) {
const server = useServer();
const initials = name
@ -290,15 +342,22 @@ export function PersonCard({ name, role, thumb, onClick }: { name: string; role?
export function Shelf({ title, subtitle, onViewAll, children, className = '', kind = 'poster' }: { title: ReactNode; subtitle?: ReactNode; onViewAll?: () => void; children: ReactNode; className?: string; kind?: 'poster' | 'landscape' | 'people' | 'wide' }) {
const row = useRef<HTMLDivElement>(null);
const atStart = useRef(true);
const [edges, setEdges] = useState({ start: true, end: false });
const update = () => {
const el = row.current;
if (!el) return;
const start = el.scrollLeft < 8;
const end = el.scrollLeft + el.clientWidth >= el.scrollWidth - 8;
atStart.current = start;
// Runs on every scroll event; re-render only when an edge changes.
setEdges((prev) => (prev.start === start && prev.end === end ? prev : { start, end }));
};
// A row the viewer hasn't scrolled stays at its start when items are added
// in front (Continue Watching), rather than holding on to the old first card.
useLayoutEffect(() => {
if (atStart.current && row.current) row.current.scrollLeft = 0;
}, [children]);
useEffect(() => {
update();
const el = row.current;