fix: do not display missing items in series
This commit is contained in:
3 files changed
+222
-235
No files matched your search
@@ -143,6 +143,7 @@ const PlayButton = ({
|
|||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
seasonId: item.SeasonId,
|
seasonId: item.SeasonId,
|
||||||
|
isMissing: false,
|
||||||
// startItemId: item.Id,
|
// startItemId: item.Id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -185,8 +186,8 @@ const PlayButton = ({
|
|||||||
],
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
isMissing: false,
|
||||||
});
|
});
|
||||||
console.log(result.data);
|
|
||||||
if (
|
if (
|
||||||
currentEpisodeId &&
|
currentEpisodeId &&
|
||||||
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ===
|
result.data.Items?.map((i) => i.Id).indexOf(currentEpisodeId) ===
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ import { Blurhash } from "react-blurhash";
|
|||||||
import useParallax from "@/utils/hooks/useParallax";
|
import useParallax from "@/utils/hooks/useParallax";
|
||||||
import { motion, useScroll } from "framer-motion";
|
import { motion, useScroll } from "framer-motion";
|
||||||
|
|
||||||
import { MediaStreamType } from "@jellyfin/sdk/lib/generated-client";
|
import {
|
||||||
|
BaseItemKind,
|
||||||
|
MediaStreamType,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -51,9 +54,12 @@ import sdrIcon from "@/assets/icons/sdr.svg";
|
|||||||
|
|
||||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||||
|
|
||||||
|
import { Card } from "@/components/card/card";
|
||||||
|
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/episode/$id")({
|
export const Route = createFileRoute("/_api/episode/$id")({
|
||||||
@@ -81,6 +87,22 @@ function EpisodeTitlePage() {
|
|||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const upcomingEpisodes = useQuery({
|
||||||
|
queryKey: ["item", id, "episode", "upcomingEpisodes"],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
|
const result = await getItemsApi(api).getItems({
|
||||||
|
userId: user?.Id,
|
||||||
|
parentId: item.data?.ParentId ?? "",
|
||||||
|
startIndex: item.data?.IndexNumber ?? 0,
|
||||||
|
excludeLocationTypes: ["Virtual"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Episode,
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
|
||||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
const [selectedVideoTrack, setSelectedVideoTrack] = useState(0);
|
||||||
@@ -748,7 +770,7 @@ function EpisodeTitlePage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{item.data.People?.length && (
|
{(item.data.People?.length ?? 0) > 0 && (
|
||||||
<div className="item-detail-cast">
|
<div className="item-detail-cast">
|
||||||
<Typography variant="h5" mb={2}>
|
<Typography variant="h5" mb={2}>
|
||||||
Cast & Crew
|
Cast & Crew
|
||||||
@@ -967,6 +989,30 @@ function EpisodeTitlePage() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{upcomingEpisodes.isSuccess &&
|
||||||
|
(upcomingEpisodes.data?.Items?.length ?? 0) > 0 && (
|
||||||
|
<CardScroller
|
||||||
|
title="Upcoming Episodes"
|
||||||
|
displayCards={4}
|
||||||
|
disableDecoration
|
||||||
|
>
|
||||||
|
{upcomingEpisodes.data?.Items?.map((episode) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={episode.Id}
|
||||||
|
item={episode}
|
||||||
|
cardTitle={episode.SeriesName}
|
||||||
|
imageType="Primary"
|
||||||
|
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||||
|
cardType="thumb"
|
||||||
|
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||||
|
userId={user?.Id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+172
-232
@@ -1,16 +1,10 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useState, useEffect, useRef, useMemo } from "react";
|
||||||
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import MuiCard from "@mui/material/Card";
|
|
||||||
import CardContent from "@mui/material/CardContent";
|
|
||||||
import CardMedia from "@mui/material/CardMedia";
|
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Skeleton from "@mui/material/Skeleton";
|
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
@@ -21,14 +15,9 @@ import { AnimatePresence, motion, useScroll } from "framer-motion";
|
|||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
|
|
||||||
import {
|
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||||
BaseItemKind,
|
|
||||||
ItemFields,
|
|
||||||
LocationType,
|
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -63,29 +52,6 @@ import { useCentralStore } from "@/utils/store/central";
|
|||||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||||
import { Link } from "@tanstack/react-router";
|
import { Link } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`full-width-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`full-width-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
style={{ marginTop: "1em" }}
|
|
||||||
>
|
|
||||||
{value === index && <Box>{children}</Box>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
const getEpisodeDateString = (date: Date) => {
|
const getEpisodeDateString = (date: Date) => {
|
||||||
const formatter = new Intl.DateTimeFormat(navigator.language ?? "en-US", {
|
const formatter = new Intl.DateTimeFormat(navigator.language ?? "en-US", {
|
||||||
dateStyle: "full",
|
dateStyle: "full",
|
||||||
@@ -109,6 +75,7 @@ function SeriesTitlePage() {
|
|||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
@@ -123,48 +90,31 @@ function SeriesTitlePage() {
|
|||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getLibraryApi(api).getSimilarShows({
|
const result = await getLibraryApi(api).getSimilarShows({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data.Id,
|
itemId: item.data?.Id ?? "",
|
||||||
limit: 16,
|
limit: 16,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
networkMode: "always",
|
|
||||||
refetchOnWindowFocus: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const seasons = useQuery({
|
const seasons = useQuery({
|
||||||
queryKey: ["item", id, "seasons"],
|
queryKey: ["item", id, "seasons"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
|
if (!item.data?.Id) return null;
|
||||||
const result = await getTvShowsApi(api).getSeasons({
|
const result = await getTvShowsApi(api).getSeasons({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
seriesId: item.data.Id,
|
seriesId: item.data.Id,
|
||||||
// isSpecialSeason: false,
|
isSpecialSeason: false,
|
||||||
|
isMissing: false,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
networkMode: "always",
|
|
||||||
refetchOnWindowFocus: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const nextUpEpisode = useQuery({
|
|
||||||
queryKey: ["item", id, "nextUp"],
|
|
||||||
queryFn: async () => {
|
|
||||||
const result = await getTvShowsApi(api).getNextUp({
|
|
||||||
userId: user?.Id,
|
|
||||||
limit: 1,
|
|
||||||
parentId: item.data.Id,
|
|
||||||
disableFirstEpisode: true,
|
|
||||||
fields: [ItemFields.Overview],
|
|
||||||
});
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
enabled: item.isSuccess && item.data.Type === "Series",
|
|
||||||
networkMode: "always",
|
|
||||||
refetchOnWindowFocus: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [backdropImage, setBackdropImage] = useState<SeriesBackdropImage>(() => {
|
const [backdropImage, setBackdropImage] = useState<SeriesBackdropImage>(() => {
|
||||||
@@ -182,9 +132,10 @@ function SeriesTitlePage() {
|
|||||||
const currentSeasonItem = useQuery({
|
const currentSeasonItem = useQuery({
|
||||||
queryKey: ["item", id, "season", currentSeason],
|
queryKey: ["item", id, "season", currentSeason],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: seasons.data.Items[currentSeason].Id,
|
itemId: seasons.data?.Items?.[Number(currentSeason)].Id ?? "",
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -196,12 +147,13 @@ function SeriesTitlePage() {
|
|||||||
const episodes = useQuery({
|
const episodes = useQuery({
|
||||||
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
queryKey: ["item", id, "season", currentSeason, "episodes"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getTvShowsApi(api).getEpisodes({
|
const result = await getTvShowsApi(api).getEpisodes({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
seriesId: item.data.Id,
|
seriesId: item.data?.Id ?? "",
|
||||||
seasonId: seasons.data.Items[currentSeason].Id,
|
seasonId: seasons.data?.Items?.[Number(currentSeason)].Id,
|
||||||
fields: [ItemFields.Overview],
|
fields: [ItemFields.Overview],
|
||||||
excludeLocationTypes: [LocationType.Virtual],
|
isMissing: false,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -213,8 +165,9 @@ function SeriesTitlePage() {
|
|||||||
const specialFeatures = useQuery({
|
const specialFeatures = useQuery({
|
||||||
queryKey: ["item", id, "specialFeatures"],
|
queryKey: ["item", id, "specialFeatures"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getSpecialFeatures({
|
const result = await getUserLibraryApi(api).getSpecialFeatures({
|
||||||
itemId: item.data.Id,
|
itemId: item.data?.Id ?? "",
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
@@ -222,111 +175,84 @@ function SeriesTitlePage() {
|
|||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [directors, setDirectors] = useState([]);
|
const directors = useMemo(() => {
|
||||||
const [writers, setWriters] = useState([]);
|
return item.data?.People?.filter((itm) => itm.Type === "Director") ?? [];
|
||||||
const [actors, setActors] = useState([]);
|
}, [item.data?.Id]);
|
||||||
const [producers, setProducers] = useState([]);
|
const writers = useMemo(() => {
|
||||||
|
return item.data?.People?.filter((itm) => itm.Type === "Writer") ?? [];
|
||||||
useLayoutEffect(() => {
|
}, [item.data?.Id]);
|
||||||
if (item.isSuccess) {
|
const actors = useMemo(() => {
|
||||||
// setBackdropImage({
|
return item.data?.People?.filter((itm) => itm.Type === "Actor") ?? [];
|
||||||
// url: getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
}, [item.data?.Id]);
|
||||||
// tag: item.data?.BackdropImageTags[0],
|
const producers = useMemo(() => {
|
||||||
// }),
|
return item.data?.People?.filter((itm) => itm.Type === "Producer") ?? [];
|
||||||
// key: item.data?.BackdropImageTags[0],
|
}, [item.data?.Id]);
|
||||||
// });
|
|
||||||
// setBackdrop(
|
|
||||||
// getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
|
|
||||||
// tag: item.data?.BackdropImageTags[0],
|
|
||||||
// }),
|
|
||||||
// item.data.Id,
|
|
||||||
// );
|
|
||||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
|
||||||
setDirectors(direTp);
|
|
||||||
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
|
|
||||||
setWriters(writeTp);
|
|
||||||
const producerTp = item.data.People.filter(
|
|
||||||
(itm) => itm.Type === "Producer",
|
|
||||||
);
|
|
||||||
setProducers(producerTp);
|
|
||||||
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
|
|
||||||
setActors(actorTp);
|
|
||||||
}
|
|
||||||
}, [item.isSuccess]);
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
if (
|
|
||||||
seasons.isSuccess &&
|
|
||||||
!sessionStorage.getItem(`season-${item.data?.Id}`)
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
seasons.data.TotalRecordCount > 1 &&
|
|
||||||
seasons.data.Items[0].Name.toLowerCase().includes("special")
|
|
||||||
) {
|
|
||||||
setCurrentSeason(1);
|
|
||||||
} else {
|
|
||||||
setCurrentSeason(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [seasons.isSuccess]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (api && currentSeasonItem.isSuccess && item.isSuccess) {
|
||||||
if (
|
if (
|
||||||
currentSeasonItem.isSuccess &&
|
currentSeasonItem.isSuccess &&
|
||||||
currentSeasonItem.data?.BackdropImageTags?.length > 0
|
(currentSeasonItem.data?.BackdropImageTags?.length ?? 0) > 0
|
||||||
) {
|
) {
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}`,
|
`backdrop-${item.data?.Id}`,
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
currentSeasonItem.data.Id,
|
currentSeasonItem.data?.Id ?? "",
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data?.BackdropImageTags?.[0],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}-key`,
|
`backdrop-${item.data?.Id}-key`,
|
||||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
currentSeasonItem.data?.BackdropImageTags?.[0] ?? "",
|
||||||
);
|
);
|
||||||
setBackdropImage({
|
setBackdropImage({
|
||||||
url: getImageUrlsApi(api).getItemImageUrlById(
|
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
currentSeasonItem.data.Id,
|
currentSeasonItem.data?.Id ?? "",
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data?.BackdropImageTags?.[0],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
key: currentSeasonItem.data.BackdropImageTags?.[0],
|
key: currentSeasonItem.data?.BackdropImageTags?.[0],
|
||||||
});
|
});
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
currentSeasonItem.data.Id,
|
currentSeasonItem.data?.Id ?? "",
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
tag: currentSeasonItem.data.BackdropImageTags?.[0],
|
tag: currentSeasonItem.data?.BackdropImageTags?.[0],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
currentSeasonItem.data.BackdropImageTags?.[0],
|
currentSeasonItem.data?.BackdropImageTags?.[0],
|
||||||
);
|
);
|
||||||
setBackdropImageLoaded(false);
|
setBackdropImageLoaded(false);
|
||||||
} else if (item.isSuccess && item.data?.BackdropImageTags?.length > 0) {
|
} else if (
|
||||||
|
item.isSuccess &&
|
||||||
|
(item.data?.BackdropImageTags?.length ?? 0) > 0
|
||||||
|
) {
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}`,
|
`backdrop-${item.data?.Id}`,
|
||||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.data.BackdropImageTags?.[0],
|
item.data?.Id ?? "",
|
||||||
}),
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: item.data?.BackdropImageTags?.[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
`backdrop-${item.data?.Id}-key`,
|
`backdrop-${item.data?.Id}-key`,
|
||||||
item.data?.BackdropImageTags?.[0],
|
item.data?.BackdropImageTags?.[0] ?? "",
|
||||||
);
|
);
|
||||||
if (backdropImage.key !== item.data?.BackdropImageTags?.[0]) {
|
if (backdropImage.key !== item.data?.BackdropImageTags?.[0]) {
|
||||||
setBackdropImageLoaded(false); // Reset Backdrop image load status if previous image is diff then new image
|
setBackdropImageLoaded(false); // Reset Backdrop image load status if previous image is diff then new image
|
||||||
}
|
}
|
||||||
setBackdropImage({
|
setBackdropImage({
|
||||||
url: getImageUrlsApi(api).getItemImageUrlById(
|
url: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
item.data?.Id,
|
item.data?.Id ?? "",
|
||||||
"Backdrop",
|
"Backdrop",
|
||||||
{
|
{
|
||||||
tag: item.data?.BackdropImageTags?.[0],
|
tag: item.data?.BackdropImageTags?.[0],
|
||||||
@@ -335,12 +261,16 @@ function SeriesTitlePage() {
|
|||||||
key: item.data?.BackdropImageTags?.[0],
|
key: item.data?.BackdropImageTags?.[0],
|
||||||
});
|
});
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.data.BackdropImageTags?.[0],
|
item.data?.Id ?? "",
|
||||||
}),
|
"Backdrop",
|
||||||
item.data.BackdropImageTags?.[0],
|
{
|
||||||
|
tag: item.data?.BackdropImageTags?.[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
item.data?.BackdropImageTags?.[0],
|
||||||
);
|
);
|
||||||
// setBackdropImageLoaded(false);
|
}
|
||||||
}
|
}
|
||||||
}, [currentSeasonItem.dataUpdatedAt]);
|
}, [currentSeasonItem.dataUpdatedAt]);
|
||||||
|
|
||||||
@@ -369,7 +299,7 @@ function SeriesTitlePage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -392,8 +322,8 @@ function SeriesTitlePage() {
|
|||||||
{item.data.BackdropImageTags ? (
|
{item.data.BackdropImageTags ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
key={backdropImage.key}
|
key={backdropImage.key}
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={backdropImage.url}
|
src={backdropImage.url ?? ""}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
initial={{
|
initial={{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
@@ -417,11 +347,11 @@ function SeriesTitlePage() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={heroBg}
|
src={heroBg}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -436,53 +366,59 @@ function SeriesTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary ? (
|
||||||
<>
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
] ?? ""
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "Series")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail">
|
<div className="item-hero-detail">
|
||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.data.Id ?? "",
|
||||||
"Logo",
|
"Logo",
|
||||||
{
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillWidth: 592,
|
fillWidth: 592,
|
||||||
fillHeight: 592,
|
fillHeight: 592,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
@@ -587,7 +523,7 @@ function SeriesTitlePage() {
|
|||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.data.RunTimeTicks -
|
item.data.RunTimeTicks -
|
||||||
item.data.UserData.PlaybackPositionTicks,
|
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
@@ -605,10 +541,8 @@ function SeriesTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PlayButton
|
<PlayButton
|
||||||
itemId={item.data.Id}
|
|
||||||
item={item.data}
|
item={item.data}
|
||||||
itemType={BaseItemKind.Series}
|
itemType={BaseItemKind.Series}
|
||||||
itemUserData={item.data.UserData}
|
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentSubTrack="nosub"
|
currentSubTrack="nosub"
|
||||||
@@ -619,22 +553,24 @@ function SeriesTitlePage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||||
|
{item.data.RemoteTrailers && (
|
||||||
<TrailerButton
|
<TrailerButton
|
||||||
trailerItem={item.data.RemoteTrailers}
|
trailerItem={item.data.RemoteTrailers}
|
||||||
disabled={item.data.RemoteTrailers?.length === 0}
|
disabled={item.data.RemoteTrailers?.length === 0}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData?.Played}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -642,14 +578,11 @@ function SeriesTitlePage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="item-detail">
|
<div className="item-detail">
|
||||||
<div style={{ width: "100%" }}>
|
<div style={{ width: "100%" }}>
|
||||||
{item.data.Taglines?.length > 0 && (
|
{(item.data.Taglines?.length ?? 0) > 0 && (
|
||||||
<Typography variant="h5" mb={2}>
|
<Typography variant="h5" mb={2}>
|
||||||
{item.data.Taglines[0]}
|
{item.data.Taglines?.[0]}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Typography variant="h5" fontStyle="italic" mb={1}>
|
|
||||||
{item.data.Taglines[0] ?? ""}
|
|
||||||
</Typography>
|
|
||||||
<ShowMoreText
|
<ShowMoreText
|
||||||
content={item.data.Overview ?? ""}
|
content={item.data.Overview ?? ""}
|
||||||
collapsedLines={4}
|
collapsedLines={4}
|
||||||
@@ -661,9 +594,13 @@ function SeriesTitlePage() {
|
|||||||
alignSelf: "end",
|
alignSelf: "end",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map(
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
(url) =>
|
||||||
))}
|
url.Url &&
|
||||||
|
url.Name && (
|
||||||
|
<IconLink key={url.Url} url={url.Url} name={url.Name} />
|
||||||
|
),
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -672,7 +609,7 @@ function SeriesTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="item-detail-cast">
|
<div className="item-detail-cast">
|
||||||
{actors.length > 0 && (
|
{actors?.length > 0 && (
|
||||||
<div className="item-detail-cast-container">
|
<div className="item-detail-cast-container">
|
||||||
<Typography variant="h6" className="item-detail-cast-title">
|
<Typography variant="h6" className="item-detail-cast-title">
|
||||||
Actors
|
Actors
|
||||||
@@ -682,23 +619,26 @@ function SeriesTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
actor.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -734,23 +674,26 @@ function SeriesTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
actor.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -786,23 +729,26 @@ function SeriesTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
actor.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -838,23 +784,26 @@ function SeriesTitlePage() {
|
|||||||
<Link
|
<Link
|
||||||
className="item-detail-cast-card"
|
className="item-detail-cast-card"
|
||||||
key={actor.Id}
|
key={actor.Id}
|
||||||
to={`/person/$id`}
|
to="/person/$id"
|
||||||
params={{
|
params={{
|
||||||
id: actor.Id,
|
id: actor.Id ?? "",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{actor.PrimaryImageTag ? (
|
{actor.PrimaryImageTag ? (
|
||||||
<img
|
<img
|
||||||
alt={actor.Name}
|
alt={actor.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
actor.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
actor.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
quality: 80,
|
quality: 80,
|
||||||
fillWidth: 200,
|
fillWidth: 200,
|
||||||
fillHeight: 200,
|
fillHeight: 200,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
className="item-detail-cast-card-image"
|
className="item-detail-cast-card-image"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -904,7 +853,7 @@ function SeriesTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography variant="h5">
|
<Typography variant="h5">
|
||||||
{seasons.data.Items[currentSeason].Name}
|
{seasons.data?.Items?.[Number(currentSeason)].Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Chip
|
<Chip
|
||||||
label={
|
label={
|
||||||
@@ -918,7 +867,7 @@ function SeriesTitlePage() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
episodes.data.TotalRecordCount
|
episodes.data?.TotalRecordCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -931,23 +880,21 @@ function SeriesTitlePage() {
|
|||||||
>
|
>
|
||||||
{currentSeasonItem.isSuccess && (
|
{currentSeasonItem.isSuccess && (
|
||||||
<LikeButton
|
<LikeButton
|
||||||
itemId={currentSeasonItem.data.Id}
|
itemId={currentSeasonItem.data?.Id}
|
||||||
isFavorite={currentSeasonItem.data.UserData.IsFavorite}
|
isFavorite={currentSeasonItem.data?.UserData?.IsFavorite}
|
||||||
queryKey={["item", id, "season", currentSeason]}
|
queryKey={["item", id]}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
itemName={currentSeasonItem.data.Name}
|
itemName={currentSeasonItem.data?.Name}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{currentSeasonItem.isSuccess && (
|
{currentSeasonItem.isSuccess && (
|
||||||
<>
|
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={currentSeasonItem.data.Id}
|
itemId={currentSeasonItem.data?.Id}
|
||||||
isPlayed={currentSeasonItem.data.UserData.Played}
|
isPlayed={currentSeasonItem.data?.UserData?.Played}
|
||||||
queryKey={["item", id, "season", currentSeason]}
|
queryKey={["item", id]}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
itemName={currentSeasonItem.data.Name}
|
itemName={currentSeasonItem.data?.Name}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<TextField
|
<TextField
|
||||||
value={currentSeason}
|
value={currentSeason}
|
||||||
@@ -966,7 +913,7 @@ function SeriesTitlePage() {
|
|||||||
}}
|
}}
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
{seasons.data.Items.map((season, index) => {
|
{seasons.data?.Items?.map((season, index) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem key={season.Id} value={index}>
|
<MenuItem key={season.Id} value={index}>
|
||||||
{season.Name}
|
{season.Name}
|
||||||
@@ -981,14 +928,14 @@ function SeriesTitlePage() {
|
|||||||
{episodes.isPending ? (
|
{episodes.isPending ? (
|
||||||
<EpisodeSkeleton />
|
<EpisodeSkeleton />
|
||||||
) : (
|
) : (
|
||||||
episodes.data.Items.map((episode, index) => {
|
episodes.data?.Items?.map((episode) => {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={episode.Id}
|
key={episode.Id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
navigate({
|
navigate({
|
||||||
to: "/episode/$id",
|
to: "/episode/$id",
|
||||||
params: { id: episode.Id },
|
params: { id: episode.Id ?? "" },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
initial={{
|
initial={{
|
||||||
@@ -1033,6 +980,7 @@ function SeriesTitlePage() {
|
|||||||
currentSubTrack="nosub"
|
currentSubTrack="nosub"
|
||||||
size="medium"
|
size="medium"
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
|
//@ts-ignore
|
||||||
color: "white",
|
color: "white",
|
||||||
style: {
|
style: {
|
||||||
color: "black ",
|
color: "black ",
|
||||||
@@ -1047,21 +995,24 @@ function SeriesTitlePage() {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt={episode.Name}
|
alt={episode.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
episode.Id,
|
api &&
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
episode.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
tag: episode.ImageTags.Primary,
|
tag: episode.ImageTags?.Primary,
|
||||||
fillHeight: 300,
|
fillHeight: 300,
|
||||||
},
|
},
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
className="item-detail-episode-image"
|
className="item-detail-episode-image"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{episode.UserData?.PlaybackPositionTicks > 0 && (
|
{(episode.UserData?.PlaybackPositionTicks ?? 0) > 0 && (
|
||||||
<div className="card-progress-container">
|
<div className="card-progress-container">
|
||||||
<div
|
<div
|
||||||
className="card-progress"
|
className="card-progress"
|
||||||
@@ -1092,7 +1043,7 @@ function SeriesTitlePage() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Typography variant="caption">
|
<Typography variant="caption">
|
||||||
{getRuntimeCompact(episode.RunTimeTicks)}
|
{getRuntimeCompact(episode.RunTimeTicks ?? 0)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -1133,13 +1084,14 @@ function SeriesTitlePage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{specialFeatures.isSuccess && specialFeatures.data.length > 0 && (
|
{specialFeatures.isSuccess &&
|
||||||
|
(specialFeatures.data?.length ?? 0) > 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="Special Features"
|
title="Special Features"
|
||||||
displayCards={7}
|
displayCards={7}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{specialFeatures.data.map((special) => {
|
{specialFeatures.data?.map((special) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={special.Id}
|
key={special.Id}
|
||||||
@@ -1147,15 +1099,9 @@ function SeriesTitlePage() {
|
|||||||
seriesId={special.SeriesId}
|
seriesId={special.SeriesId}
|
||||||
cardTitle={special.Name}
|
cardTitle={special.Name}
|
||||||
imageType="Primary"
|
imageType="Primary"
|
||||||
cardCaption={getRuntimeMusic(special.RunTimeTicks)}
|
cardCaption={getRuntimeMusic(special.RunTimeTicks ?? 0)}
|
||||||
cardType="portrait"
|
cardType="portrait"
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
imageBlurhash={
|
|
||||||
!!special.ImageBlurHashes?.Primary &&
|
|
||||||
special.ImageBlurHashes.Primary[
|
|
||||||
Object.keys(special.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
/>
|
/>
|
||||||
@@ -1163,13 +1109,13 @@ function SeriesTitlePage() {
|
|||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{similarItems.data.TotalRecordCount > 0 && (
|
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="You might also like"
|
title="You might also like"
|
||||||
displayCards={7}
|
displayCards={7}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{similarItems.data.Items.map((similar) => {
|
{similarItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -1202,12 +1148,6 @@ function SeriesTitlePage() {
|
|||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in new issue
Block a user