fix(catalog): use season posters for episode cards
This commit is contained in:
@@ -11,7 +11,7 @@ vi.mock("@/playback/watchPlaybackContext", () => ({
|
||||
}));
|
||||
|
||||
describe("ContinueWatchingCard", () => {
|
||||
it("prefers the poster image for episodes (poster_url is the horizontal still)", () => {
|
||||
it("prefers the backdrop image for section episodes (backdrop_url is the horizontal still)", () => {
|
||||
const queryClient = new QueryClient();
|
||||
const markup = renderToStaticMarkup(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
@@ -34,7 +34,7 @@ describe("ContinueWatchingCard", () => {
|
||||
position_seconds: 120,
|
||||
duration_seconds: 3600,
|
||||
progress_updated_at: "2026-03-07T00:00:00Z",
|
||||
poster_url: "/episode-poster.jpg",
|
||||
poster_url: "/season-poster.jpg",
|
||||
poster_thumbhash: "",
|
||||
backdrop_url: "/episode-backdrop.jpg",
|
||||
backdrop_thumbhash: "",
|
||||
@@ -45,8 +45,8 @@ describe("ContinueWatchingCard", () => {
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
|
||||
expect(markup).toContain('src="/episode-poster.jpg"');
|
||||
expect(markup).not.toContain('src="/episode-backdrop.jpg"');
|
||||
expect(markup).toContain('src="/episode-backdrop.jpg"');
|
||||
expect(markup).not.toContain('src="/season-poster.jpg"');
|
||||
});
|
||||
|
||||
it("prefers the backdrop image for movies (poster_url is a vertical poster)", () => {
|
||||
|
||||
@@ -144,19 +144,23 @@ export default function ContinueWatchingCard(props: ContinueWatchingCardProps) {
|
||||
? "w-[140px] shrink-0 sm:w-[160px] lg:w-[185px]"
|
||||
: "w-[260px] shrink-0 sm:w-[315px]";
|
||||
const imageAspect = isPoster ? "aspect-[2/3]" : "aspect-video";
|
||||
// Episodes store the horizontal still in poster_url (see episode_catalog_source.go);
|
||||
// wide-variant movies/series/seasons need the backdrop for the 16:9 card.
|
||||
// Poster variant always wants the vertical poster.
|
||||
const isSectionEpisode = "sectionItem" in props && props.sectionItem?.type === "episode";
|
||||
// Section episode payloads use poster_url for vertical season/series artwork
|
||||
// and backdrop_url for the episode still used by wide cards.
|
||||
const imagePrimary = isPoster
|
||||
? card.posterUrl
|
||||
: card.type === "episode"
|
||||
? card.posterUrl
|
||||
: card.backdropUrl;
|
||||
: isSectionEpisode
|
||||
? card.backdropUrl
|
||||
: card.type === "episode"
|
||||
? card.posterUrl
|
||||
: card.backdropUrl;
|
||||
const imageFallback = isPoster
|
||||
? card.backdropUrl
|
||||
: card.type === "episode"
|
||||
? card.backdropUrl
|
||||
: card.posterUrl;
|
||||
: isSectionEpisode
|
||||
? card.posterUrl
|
||||
: card.type === "episode"
|
||||
? card.backdropUrl
|
||||
: card.posterUrl;
|
||||
const imageSrc = imagePrimary || imageFallback;
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user