feat(web): use season backdrop in series page if available
This commit is contained in:
3 files changed
+47
-8
No files matched your search
@@ -6,3 +6,5 @@
|
|||||||
- feat(settings-server): Add a refretch button by @prayag17
|
- feat(settings-server): Add a refretch button by @prayag17
|
||||||
- feat(web): Add a global query fetch/mutation status by @prayag17
|
- feat(web): Add a global query fetch/mutation status by @prayag17
|
||||||
- fix(server): Use redirect instead of relaunch when changing or deleting a server by @prayag17
|
- fix(server): Use redirect instead of relaunch when changing or deleting a server by @prayag17
|
||||||
|
- refactor(player): Rewrite and improve video playback by @prayag17
|
||||||
|
- feat(web): Use season backdrop in series page if available by @prayag17
|
||||||
@@ -429,7 +429,8 @@ const SearchPage = () => {
|
|||||||
musicAlbum.data.Items.length === 0 &&
|
musicAlbum.data.Items.length === 0 &&
|
||||||
book.data.Items.length === 0 &&
|
book.data.Items.length === 0 &&
|
||||||
musicArtists.data.Items.length === 0 &&
|
musicArtists.data.Items.length === 0 &&
|
||||||
person.data.Items.length === 0 && (
|
person.data.Items.length === 0 &&
|
||||||
|
episodes.data.SearchHints.length === 0 && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
height: "calc(100vh - 12em)",
|
height: "calc(100vh - 12em)",
|
||||||
|
|||||||
@@ -160,6 +160,11 @@ const SeriesTitlePage = () => {
|
|||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [backdropImage, setBackdropImage] = useState(() => {
|
||||||
|
const result = sessionStorage.getItem(`backdrop-${item.data?.Id}`);
|
||||||
|
return result ?? "0";
|
||||||
|
});
|
||||||
|
|
||||||
const [currentSeason, setCurrentSeason] = useState(() => {
|
const [currentSeason, setCurrentSeason] = useState(() => {
|
||||||
const result = sessionStorage.getItem(`season-${item.data?.Id}`);
|
const result = sessionStorage.getItem(`season-${item.data?.Id}`);
|
||||||
return result ?? 0;
|
return result ?? 0;
|
||||||
@@ -216,11 +221,15 @@ const SeriesTitlePage = () => {
|
|||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
|
setBackdropImage(
|
||||||
|
api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
||||||
|
tag: item.data?.BackdropImageTags[0],
|
||||||
|
}),
|
||||||
|
);
|
||||||
setAppBackdrop(
|
setAppBackdrop(
|
||||||
item.data.Type === BaseItemKind.MusicAlbum ||
|
api.getItemImageUrl(item.data?.Id, "Backdrop", {
|
||||||
item.data.Type === BaseItemKind.Episode
|
tag: item.data?.BackdropImageTags[0],
|
||||||
? `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
}),
|
||||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
||||||
@@ -252,6 +261,34 @@ const SeriesTitlePage = () => {
|
|||||||
}
|
}
|
||||||
}, [seasons.isSuccess]);
|
}, [seasons.isSuccess]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
currentSeasonItem.isSuccess &&
|
||||||
|
currentSeasonItem.data?.BackdropImageTags?.length > 0
|
||||||
|
) {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
`backdrop-${item.data?.Id}`,
|
||||||
|
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||||
|
tag: currentSeasonItem.data.BackdropImageTags[0],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setBackdropImage(
|
||||||
|
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||||
|
tag: currentSeasonItem.data.BackdropImageTags[0],
|
||||||
|
}),
|
||||||
|
currentSeasonItem.data.Id,
|
||||||
|
);
|
||||||
|
setAppBackdrop(
|
||||||
|
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
|
||||||
|
tag: currentSeasonItem.data.BackdropImageTags[0],
|
||||||
|
}),
|
||||||
|
currentSeasonItem.data.Id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [currentSeasonItem.dataUpdatedAt]);
|
||||||
|
|
||||||
|
console.log(backdropImage);
|
||||||
|
|
||||||
const pageRef = useRef(null);
|
const pageRef = useRef(null);
|
||||||
const { scrollYProgress } = useScroll({
|
const { scrollYProgress } = useScroll({
|
||||||
target: pageRef,
|
target: pageRef,
|
||||||
@@ -296,10 +333,9 @@ const SeriesTitlePage = () => {
|
|||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
{item.data.BackdropImageTags ? (
|
{item.data.BackdropImageTags ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
|
key={currentSeason}
|
||||||
alt={item.data.Name}
|
alt={item.data.Name}
|
||||||
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
|
src={backdropImage}
|
||||||
tag: item.data.BackdropImageTags[0],
|
|
||||||
})}
|
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = 1;
|
||||||
|
|||||||
Reference in new issue
Block a user