fix: artwork fallbacks everywhere and hero layout

- resolveItemImage(): try the item's own images, then series/album/parent artwork
- hero sidebar tickers fall back from Thumb to Backdrop/Primary instead of an icon
- hero background falls back to the poster when no backdrop exists
- stop stacked slides when the carousel advances (drop leaking AnimatePresence)
- keep the hero title/logo inside the slide on narrow windows
- sensible slides-per-view on tablet/mobile widths
This commit is contained in:
1xDed committed 2026-11-27 03:11:17 +03:00
1 parent 1c499f42ec
commit 5a9b3ad273
7 files changed
+197 -34

No files matched your search

+31 -19
View File
@@ -1,5 +1,6 @@
import { AnimatePresence } from "motion/react";
import { motion } from "motion/react";
import React, { useCallback, useEffect, useState } from "react";
import type { Api } from "@jellyfin/sdk";
import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss";
@@ -8,6 +9,7 @@ import {
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { resolveItemImage } from "@/utils/methods/itemImages";
import { useApiInContext } from "@/utils/store/api";
import CarouselSlide from "../carouselSlide";
import CarouselTickers from "./tickers";
@@ -15,6 +17,24 @@ import CarouselTickers from "./tickers";
// Memoize CarouselSlide to prevent unnecessary re-renders
const MemoizedCarouselSlide = React.memo(CarouselSlide);
/** Sidebar thumbnail: prefer Thumb, fall back to Backdrop/Primary when missing. */
const tickerImageUrl = (
api: Api,
item: BaseItemDto,
): string | undefined => {
const image = resolveItemImage(item, "Thumb");
if (!image) return undefined;
return getImageUrlsApi(api).getItemImageUrlById(
image.itemId,
image.imageType,
{
quality: 90,
fillHeight: 360,
tag: image.tag,
},
);
};
const Carousel = ({
content,
onChange,
@@ -96,12 +116,15 @@ const Carousel = ({
onMouseEnter={() => setIsPaused(true)}
onMouseLeave={() => setIsPaused(false)}
>
<AnimatePresence mode="sync">
<MemoizedCarouselSlide
item={content[currentSlide]}
key={content[currentSlide].Id}
/>
</AnimatePresence>
<motion.div
key={content[currentSlide].Id}
className="hero-carousel-slide-wrapper"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.35, ease: "easeInOut" }}
>
<MemoizedCarouselSlide item={content[currentSlide]} />
</motion.div>
<div className="carousel-sidebar" ref={sidebarRef}>
{content.map((item, index) => (
<div
@@ -112,18 +135,7 @@ const Carousel = ({
className="carousel-ticker-wrapper"
>
<CarouselTickers
imageUrl={
item.ImageTags?.Thumb
? getImageUrlsApi(api).getItemImageUrlById(
item.Id ?? "",
"Thumb",
{
quality: 90,
fillHeight: 360,
},
)
: undefined
}
imageUrl={tickerImageUrl(api, item)}
isActive={index === currentSlide}
itemName={item.Name ?? "Unknown"}
itemYear={