Display episodes in SeriesTitlePage #160
This commit is contained in:
9 files changed
+481
-567
No files matched your search
@@ -177,7 +177,7 @@ export const Card = ({
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
sx: { fontSize: "2.5em" },
|
||||
style: { fontSize: "2.5em" },
|
||||
}}
|
||||
iconOnly
|
||||
/>
|
||||
@@ -203,7 +203,7 @@ export const Card = ({
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={item.UserData.PlayedPercentage}
|
||||
sx={{
|
||||
style={{
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
right: 0,
|
||||
@@ -227,7 +227,7 @@ export const Card = ({
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="center"
|
||||
sx={{ opacity: 0.9 }}
|
||||
style={{ opacity: 0.9 }}
|
||||
>
|
||||
{cardTitle}
|
||||
</Typography>
|
||||
@@ -235,7 +235,7 @@ export const Card = ({
|
||||
variant="subtitle2"
|
||||
noWrap
|
||||
textAlign="center"
|
||||
sx={{ opacity: 0.6 }}
|
||||
style={{ opacity: 0.6 }}
|
||||
lineHeight="auto"
|
||||
>
|
||||
{cardCaption}
|
||||
|
||||
@@ -107,4 +107,9 @@
|
||||
height: 15%;
|
||||
}
|
||||
}
|
||||
&-episode {
|
||||
.card-box {
|
||||
height: unset !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
+179
-382
@@ -1,421 +1,218 @@
|
||||
/** @format */
|
||||
import React, { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
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 CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { green, pink } from "@mui/material/colors";
|
||||
|
||||
import { TypeIconCollectionCard } from "../utils/iconsCollection";
|
||||
|
||||
import { borderRadiusDefault } from "../../palette.module.scss";
|
||||
import "./card.module.scss";
|
||||
import { MdiCheck } from "../icons/mdiCheck";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiHeart } from "../icons/mdiHeart";
|
||||
import { endsAt, getRuntime } from "../../utils/date/time";
|
||||
import { MdiStarHalfFull } from "../icons/mdiStarHalfFull";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { MdiTelevisionClassic } from "../icons/mdiTelevisionClassic";
|
||||
import { getRuntimeCompact } from "../../utils/date/time";
|
||||
|
||||
const availableSpecialRoutes = [BaseItemKind.Series];
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {string} cardTitle
|
||||
* @property {string | number} cardCaption
|
||||
* @property {string} imageBlurhash
|
||||
* @property {Array} queryKey
|
||||
* @property {string} userId
|
||||
* @property {() => {}} onClick
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
|
||||
export const EpisodeCard = ({
|
||||
itemName,
|
||||
itemRating,
|
||||
itemTicks,
|
||||
itemId,
|
||||
imageTags,
|
||||
subText = "",
|
||||
playedPercent,
|
||||
cardProps,
|
||||
onClickEvent,
|
||||
watchedStatus,
|
||||
blurhash,
|
||||
currentUser,
|
||||
favourite,
|
||||
showName,
|
||||
episodeLocation,
|
||||
centerAlignText = false,
|
||||
parentId,
|
||||
item,
|
||||
cardTitle,
|
||||
cardCaption,
|
||||
imageBlurhash,
|
||||
queryKey,
|
||||
userId,
|
||||
onClick,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
let result;
|
||||
if (!isWatched) {
|
||||
result = await getPlaystateApi(window.api).markPlayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (isWatched) {
|
||||
result = await getPlaystateApi(window.api).markUnplayedItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
const defaultOnClick = () => {
|
||||
if (availableSpecialRoutes.includes(item.Type)) {
|
||||
navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`);
|
||||
} else {
|
||||
navigate(`/item/${item.Id}`);
|
||||
}
|
||||
setIsWatched(result.data.Played);
|
||||
};
|
||||
const handleLiking = async () => {
|
||||
let result;
|
||||
if (isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
} else if (!isFavourite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: currentUser.Id,
|
||||
itemId: itemId,
|
||||
});
|
||||
}
|
||||
setIsFavourite(result.data.IsFavorite);
|
||||
};
|
||||
|
||||
return (
|
||||
<MuiCard
|
||||
className="card landscape"
|
||||
sx={{
|
||||
background: "transparent",
|
||||
borderRadius: borderRadiusDefault,
|
||||
mr: 1,
|
||||
mb: 0.5,
|
||||
<CardActionArea
|
||||
style={{
|
||||
padding: "0.6em",
|
||||
borderRadius: "calc(0.6em + 6px)",
|
||||
}}
|
||||
elevation={0}
|
||||
{...cardProps}
|
||||
className="card-container"
|
||||
onClick={!!onClick ? onClick : defaultOnClick}
|
||||
>
|
||||
<CardActionArea
|
||||
sx={{ p: "1px" }}
|
||||
component="div"
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
className="cardBox"
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
sx={{
|
||||
position: "relative",
|
||||
m: 1,
|
||||
aspectRatio: "1.777",
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<Chip
|
||||
className="card-indicator"
|
||||
label={<MdiCheck />}
|
||||
sx={{
|
||||
transition: "opacity 150ms",
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
<Box
|
||||
className="card-media-image-container"
|
||||
sx={{
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
}}
|
||||
>
|
||||
{imageTags && (
|
||||
<CardMedia
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
itemId +
|
||||
"/Images/Primary?fillHeight=300&fillWidth=532&quality=96"
|
||||
}
|
||||
alt={itemName}
|
||||
sx={{
|
||||
width: "100%",
|
||||
aspectRatio: "1.777",
|
||||
borderRadius:
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
)}
|
||||
</Box>
|
||||
{!!blurhash && (
|
||||
<Blurhash
|
||||
hash={blurhash}
|
||||
width="100%"
|
||||
height="100%"
|
||||
resolutionX={12}
|
||||
resolutionY={18}
|
||||
<MuiCard className="card card-episode" elevation={0}>
|
||||
<div className="card-box">
|
||||
<div
|
||||
className="card-image-container"
|
||||
style={{
|
||||
aspectRatio: 1.777,
|
||||
}}
|
||||
>
|
||||
{!!item.UserData && (
|
||||
<div
|
||||
className="card-indicator check"
|
||||
style={{
|
||||
aspectRatio: "1.777",
|
||||
opacity: item.UserData?.Played
|
||||
? 1
|
||||
: 0,
|
||||
}}
|
||||
>
|
||||
<MdiCheck />
|
||||
</div>
|
||||
)}
|
||||
{!!imageBlurhash && (
|
||||
<Blurhash
|
||||
hash={imageBlurhash}
|
||||
width={128}
|
||||
height={128}
|
||||
resolutionX={24}
|
||||
resolutionY={24}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
{TypeIconCollectionCard["Episode"]}
|
||||
<MdiTelevisionClassic className="card-image-icon" />
|
||||
</div>
|
||||
{!!playedPercent && (
|
||||
<img
|
||||
src={window.api.getItemImageUrl(
|
||||
item.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
fillHeight: 512,
|
||||
fillWidth: 512,
|
||||
},
|
||||
)}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
opacity: 0,
|
||||
}}
|
||||
loading="lazy"
|
||||
onLoad={(e) => (e.target.style.opacity = 1)}
|
||||
className="card-image"
|
||||
/>
|
||||
|
||||
<div className="card-overlay">
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
style: { fontSize: "2.5em" },
|
||||
}}
|
||||
iconOnly
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isPlayed={item.UserData.Played}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
</div>
|
||||
{100 > item.UserData?.PlayedPercentage > 0 && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedPercent}
|
||||
sx={{
|
||||
width: "90%",
|
||||
value={item.UserData.PlayedPercentage}
|
||||
style={{
|
||||
position: "absolute",
|
||||
left: "5%",
|
||||
bottom: "5%",
|
||||
borderRadius: "100px",
|
||||
height: "5px",
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 2,
|
||||
height: "6px",
|
||||
background:
|
||||
"rgb(5 5 5 / 0.5) !important",
|
||||
backdropFilter: "blur(5px)",
|
||||
}}
|
||||
color="white"
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<Box
|
||||
className="card-media-overlay"
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-end",
|
||||
p: 1,
|
||||
}}
|
||||
</div>
|
||||
<div
|
||||
className="card-text-container"
|
||||
style={{ display: "block", marginTop: "0.5em" }}
|
||||
>
|
||||
<ButtonGroup>
|
||||
<IconButton
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleMarkAsPlayOrUnMarkAsPlay();
|
||||
}}
|
||||
>
|
||||
<MdiCheck
|
||||
sx={{
|
||||
color: isWatched
|
||||
? green[200]
|
||||
: "white",
|
||||
}}
|
||||
/>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleLiking();
|
||||
}}
|
||||
>
|
||||
{isFavourite ? (
|
||||
<MdiHeart
|
||||
sx={{ color: pink[700] }}
|
||||
/>
|
||||
) : (
|
||||
<MdiHeartOutline />
|
||||
)}
|
||||
</IconButton>
|
||||
</ButtonGroup>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<CardContent
|
||||
className="card-text-container"
|
||||
sx={{
|
||||
padding: "0 0.5em",
|
||||
alignItems: "flex-start",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
>
|
||||
{!!showName && (
|
||||
<>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h5"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/item/${parentId}`);
|
||||
}}
|
||||
sx={{
|
||||
"&:hover": {
|
||||
textDecoration: "underline",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{showName}
|
||||
{" - "}
|
||||
{episodeLocation}
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
opacity: !!showName ? 0.75 : 1,
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
width="100%"
|
||||
mb={0.5}
|
||||
mt={0.5}
|
||||
>
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={500}
|
||||
textAlign={
|
||||
centerAlignText ? "center" : "left"
|
||||
}
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
gap: "1em",
|
||||
}}
|
||||
>
|
||||
{itemName}
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="start"
|
||||
style={{ opacity: 0.9 }}
|
||||
>
|
||||
{cardTitle}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="start"
|
||||
style={{ opacity: 0.8, flexShrink: 0 }}
|
||||
>
|
||||
{getRuntimeCompact(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
textAlign="start"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
display: "-webkit-box",
|
||||
overflow: "hidden",
|
||||
WebkitBoxOrient: "vertical",
|
||||
WebkitLineClamp: 3,
|
||||
}}
|
||||
lineHeight="auto"
|
||||
>
|
||||
{cardCaption}
|
||||
</Typography>
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="h6"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
{getRuntime(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<Stack
|
||||
alignItems="flex-start"
|
||||
width="100%"
|
||||
direction="row"
|
||||
gap={1}
|
||||
divider={
|
||||
<Divider
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
variant="middle"
|
||||
/>
|
||||
}
|
||||
mb={1}
|
||||
>
|
||||
{!!itemRating && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
<MdiStarHalfFull
|
||||
sx={{
|
||||
fontSize: "1.2em",
|
||||
mr: "0.25em",
|
||||
}}
|
||||
/>{" "}
|
||||
{Math.round(itemRating * 10) / 10}
|
||||
</Typography>
|
||||
)}
|
||||
{!!itemTicks && (
|
||||
<Typography
|
||||
gutterBottom={false}
|
||||
variant="subtitle1"
|
||||
component="div"
|
||||
color="white"
|
||||
fontWeight={300}
|
||||
textAlign="left"
|
||||
noWrap
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
opacity: 0.65,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
>
|
||||
{endsAt(itemTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
gutterBottom
|
||||
variant="body2"
|
||||
component="div"
|
||||
color="white"
|
||||
textAlign="left"
|
||||
width="fit-content"
|
||||
maxWidth="100%"
|
||||
sx={{
|
||||
display: "-webkit-box",
|
||||
overflow: "hidden",
|
||||
WebkitBoxOrient: "vertical",
|
||||
WebkitLineClamp: 3,
|
||||
opacity: 0.45,
|
||||
}}
|
||||
>
|
||||
{subText}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
</MuiCard>
|
||||
</div>
|
||||
</div>
|
||||
</MuiCard>
|
||||
</CardActionArea>
|
||||
);
|
||||
};
|
||||
|
||||
EpisodeCard.propTypes = {
|
||||
itemName: PropTypes.string.isRequired,
|
||||
itemId: PropTypes.string.isRequired,
|
||||
imageTags: PropTypes.bool,
|
||||
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
playedPercent: PropTypes.number,
|
||||
onClickEvent: PropTypes.func,
|
||||
watchedStatus: PropTypes.bool,
|
||||
blurhash: PropTypes.string,
|
||||
currentUser: PropTypes.object,
|
||||
favourite: PropTypes.bool,
|
||||
showName: PropTypes.string,
|
||||
episodeLocation: PropTypes.string,
|
||||
itemTicks: PropTypes.number,
|
||||
itemRating: PropTypes.number,
|
||||
centerAlignText: PropTypes.bool,
|
||||
parentId: PropTypes.any,
|
||||
};
|
||||
@@ -53,13 +53,7 @@ export const EpisodeCardsSkeleton = () => {
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
<Typography variant="subtitle1" mb={1}>
|
||||
<Skeleton
|
||||
variant="text"
|
||||
width="50%"
|
||||
animation="wave"
|
||||
/>
|
||||
</Typography>
|
||||
|
||||
<Typography variant="body2">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
@@ -69,6 +63,7 @@ export const EpisodeCardsSkeleton = () => {
|
||||
variant="text"
|
||||
animation="wave"
|
||||
/>
|
||||
|
||||
<Skeleton
|
||||
variant="text"
|
||||
animation="wave"
|
||||
|
||||
@@ -78,7 +78,7 @@ export const TypeIconCollectionCard = {
|
||||
Channel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
ChannelFolderItem: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
CollectionFolder: <MdiFolderOutline className="card-image-icon" />,
|
||||
Episode: <MdiTelevision className="card-image-icon" />,
|
||||
Episode: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
Folder: <MdiFolderOutline className="card-image-icon" />,
|
||||
LiveTvChannel: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
LiveTvProgram: <MdiTelevisionClassic className="card-image-icon" />,
|
||||
|
||||
+96
-84
@@ -601,90 +601,102 @@ const ItemDetail = () => {
|
||||
audioTracks={audioTracks}
|
||||
subtitleTracks={subtitleTracks}
|
||||
/>
|
||||
<CardScroller
|
||||
title="Cast & Crew"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={person.Id}
|
||||
item={person}
|
||||
cardTitle={person.Name}
|
||||
cardCaption={person.Role}
|
||||
cardType="square"
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
person.ImageBlurHashes?.Primary[0]
|
||||
}
|
||||
overrideIcon="Person"
|
||||
disableOverlay
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
<CardScroller
|
||||
title="More Like This"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type == BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
similar.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
{item.data.People.length > 0 && (
|
||||
<CardScroller
|
||||
title="Cast & Crew"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={person.Id}
|
||||
item={person}
|
||||
cardTitle={person.Name}
|
||||
cardCaption={person.Role}
|
||||
cardType="square"
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
person.ImageBlurHashes
|
||||
?.Primary[0]
|
||||
}
|
||||
overrideIcon="Person"
|
||||
disableOverlay
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
<CardScroller
|
||||
title="More Like This"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+167
-89
@@ -392,15 +392,17 @@ const SeriesTitlePage = () => {
|
||||
}
|
||||
</Typography>
|
||||
<Chip
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
label={
|
||||
episodes.isLoading ? (
|
||||
<CircularProgress
|
||||
size={20}
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems:
|
||||
"center",
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
episodes.data
|
||||
@@ -437,6 +439,70 @@ const SeriesTitlePage = () => {
|
||||
</TextField>
|
||||
</div>
|
||||
<Divider />
|
||||
<div className="item-detail-episodes-container">
|
||||
{episodes.isLoading ? (
|
||||
<EpisodeCardsSkeleton />
|
||||
) : (
|
||||
episodes.data.Items.map(
|
||||
(episode, index) => {
|
||||
return (
|
||||
<motion.div
|
||||
key={episode.Id}
|
||||
initial={{
|
||||
transform:
|
||||
"translateY(10px)",
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform:
|
||||
"translateY(0px)",
|
||||
}}
|
||||
transition={{
|
||||
delay:
|
||||
index *
|
||||
0.05,
|
||||
duration: 0.2,
|
||||
ease: "backInOut",
|
||||
}}
|
||||
>
|
||||
<EpisodeCard
|
||||
item={episode}
|
||||
cardTitle={`${episode.IndexNumber}. ${episode.Name}`}
|
||||
cardCaption={
|
||||
episode.Overview
|
||||
}
|
||||
imageBlurhash={
|
||||
episode
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
episode
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
`season ${
|
||||
currentSeason +
|
||||
1
|
||||
}`,
|
||||
"episodes",
|
||||
]}
|
||||
userId={
|
||||
user.data
|
||||
.Id
|
||||
}
|
||||
/>
|
||||
</motion.div>
|
||||
);
|
||||
},
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{specialFeatures.isSuccess &&
|
||||
@@ -485,90 +551,102 @@ const SeriesTitlePage = () => {
|
||||
)}
|
||||
</CardScroller>
|
||||
)}
|
||||
<CardScroller
|
||||
title="Cast & Crew"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={person.Id}
|
||||
item={person}
|
||||
cardTitle={person.Name}
|
||||
cardCaption={person.Role}
|
||||
cardType="square"
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
person.ImageBlurHashes?.Primary[0]
|
||||
}
|
||||
overrideIcon="Person"
|
||||
disableOverlay
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
<CardScroller
|
||||
title="More Like This"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type == BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
similar.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
{item.data.People.length > 0 && (
|
||||
<CardScroller
|
||||
title="Cast & Crew"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={person.Id}
|
||||
item={person}
|
||||
cardTitle={person.Name}
|
||||
cardCaption={person.Role}
|
||||
cardType="square"
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
person.ImageBlurHashes
|
||||
?.Primary[0]
|
||||
}
|
||||
overrideIcon="Person"
|
||||
disableOverlay
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
<CardScroller
|
||||
title="More Like This"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data.Items.map((similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,10 @@
|
||||
width: 26%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
&-episodes-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
gap: 0.25em;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,27 @@ export const getRuntimeFull = (ticks) => {
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
* @return {number} Converted ticks to Hhr Mmin formate
|
||||
*/
|
||||
export const getRuntimeCompact = (ticks) => {
|
||||
let time = ticksToMs(ticks);
|
||||
let formatedTime = "";
|
||||
let timeSec = Math.floor(time / 1000);
|
||||
let timeMin = Math.floor(timeSec / 60);
|
||||
timeSec -= timeMin * 60;
|
||||
if (timeMin > 60) {
|
||||
let timeHr = Math.floor(timeMin / 60);
|
||||
timeMin -= timeHr * 60;
|
||||
formatedTime = `${timeHr}h ${timeMin}m`;
|
||||
} else {
|
||||
formatedTime = `${timeMin}m`;
|
||||
}
|
||||
return formatedTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @format
|
||||
* @param {number} ticks - C# ticks of a particular item
|
||||
|
||||
Reference in new issue
Block a user