feat(plex): every show card plays the episode it would put on
A show card's picture opened the show page everywhere but Home, whose shelves carried the
resolved `next`. Now every Plex picture plays: a show asks `GET /api/plex/show/{id}/next`
(the in-progress episode, else the first unwatched, else S1·E1 — the rule Home and the show
page's Resume follow) on the click, fresh each time. A started show shows Continue + Restart;
its title, an ⓘ and the menu's "Open show" row open its page; one with no episodes opens there.
The question is asked per show, never carried on every card: three probes a show would cost a
grid page up to 180 queries. The hover preview asks it once it opens and names the episode
("Next: S6·E16 — Title"). Related shows on a show page play the same way.
This commit is contained in:
@@ -18,12 +18,15 @@ export function MediaPreview({
|
||||
preview,
|
||||
title,
|
||||
facts,
|
||||
note,
|
||||
summary,
|
||||
}: {
|
||||
preview: ReturnType<typeof useMediaPreview>;
|
||||
title: string;
|
||||
/** One line under the title: year, length, score. */
|
||||
facts?: ReactNode;
|
||||
/** A line of its own under the facts (a show's "Next: S6·E16 — Title"). */
|
||||
note?: ReactNode;
|
||||
summary?: string | null;
|
||||
}) {
|
||||
return (
|
||||
@@ -36,6 +39,7 @@ export function MediaPreview({
|
||||
>
|
||||
<p className="text-sm font-semibold leading-snug text-fg">{title}</p>
|
||||
{facts && <div className="mt-0.5 text-xs text-muted">{facts}</div>}
|
||||
{note && <p className="mt-1 text-xs font-medium text-fg">{note}</p>}
|
||||
{summary && (
|
||||
<p className="mt-2 line-clamp-8 whitespace-pre-line text-xs leading-relaxed text-fg">
|
||||
{summary}
|
||||
|
||||
@@ -19,6 +19,8 @@ export function useMediaPreview(enabled = true) {
|
||||
});
|
||||
return {
|
||||
popover: pop,
|
||||
/** The preview is up: the pointer has rested on the card (what a card may fetch for it waits on). */
|
||||
open: open && enabled,
|
||||
/** The card root's props: the anchor, the hover wiring, and a close on any press — merged with
|
||||
* the root's own (its menu's right-click and long-press). */
|
||||
rootProps: (own: HTMLAttributes<HTMLDivElement> & Record<string, unknown> = {}) => ({
|
||||
|
||||
Reference in New Issue
Block a user