Update episode list in title Page #26
This commit is contained in:
3 files changed
+130
-135
No files matched your search
@@ -56,6 +56,7 @@ export const EpisodeCard = ({
|
||||
parentId,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoaded, setImgLoaded] = useState(false);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
const handleMarkAsPlayOrUnMarkAsPlay = async () => {
|
||||
@@ -130,10 +131,16 @@ export const EpisodeCard = ({
|
||||
opacity: isWatched ? 1 : 0,
|
||||
}}
|
||||
/>
|
||||
<Box className="card-media-image-container">
|
||||
<Box
|
||||
className="card-media-image-container"
|
||||
sx={{
|
||||
opacity: imgLoaded ? 1 : 0,
|
||||
transition: "opacity 250ms",
|
||||
}}
|
||||
>
|
||||
{imageTags && (
|
||||
<CardMedia
|
||||
component="div"
|
||||
component="img"
|
||||
image={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
@@ -148,6 +155,7 @@ export const EpisodeCard = ({
|
||||
borderRadiusDefault,
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onLoad={() => setImgLoaded(true)}
|
||||
className="card-image"
|
||||
></CardMedia>
|
||||
)}
|
||||
|
||||
@@ -248,7 +248,7 @@ export const SideMenu = ({}) => {
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline></MdiHomeVariantOutline>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
|
||||
+119
-132
@@ -26,7 +26,7 @@ import MenuItem from "@mui/material/MenuItem";
|
||||
import Link from "@mui/material/Link";
|
||||
import { green, pink, yellow } from "@mui/material/colors";
|
||||
|
||||
import { AvatarImage } from "../../components/avatar/avatar";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
@@ -204,6 +204,8 @@ const ItemDetail = () => {
|
||||
enabled: seasons.isSuccess,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
keepPreviousData: false,
|
||||
cacheTime: 0,
|
||||
});
|
||||
|
||||
const personMovies = useQuery({
|
||||
@@ -2187,139 +2189,124 @@ const ItemDetail = () => {
|
||||
|
||||
{seasons.isSuccess && (
|
||||
<Box sx={{ mb: 2 }}>
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
scrollButtons="auto"
|
||||
value={currentSeason}
|
||||
onChange={(e, newVal) => {
|
||||
setCurrentSeason(newVal);
|
||||
}}
|
||||
sx={{
|
||||
borderBottom: 1,
|
||||
borderColor: "divider",
|
||||
mb: 2,
|
||||
}}
|
||||
selectionFollowsFocus
|
||||
<Stack
|
||||
alignItems="center"
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
mb={1}
|
||||
>
|
||||
{seasons.data.Items.map(
|
||||
(season, index) => {
|
||||
return (
|
||||
<Tab
|
||||
label={season.Name}
|
||||
{...a11yProps(
|
||||
index,
|
||||
)}
|
||||
key={index}
|
||||
/>
|
||||
<Typography variant="h5">
|
||||
Episodes
|
||||
</Typography>
|
||||
<TextField
|
||||
value={currentSeason}
|
||||
select
|
||||
onChange={(e, newVal) => {
|
||||
setCurrentSeason(
|
||||
e.target.value,
|
||||
);
|
||||
},
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
{seasons.data.Items.map(
|
||||
(season, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={index}
|
||||
value={index}
|
||||
>
|
||||
{season.Name}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
</Stack>
|
||||
|
||||
<Grid2
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
>
|
||||
{episodes.isLoading ? (
|
||||
<EpisodeCardsSkeleton />
|
||||
) : (
|
||||
episodes.data.Items.map(
|
||||
(mitem, mindex) => {
|
||||
return (
|
||||
<Grid2
|
||||
key={mindex}
|
||||
xs={1}
|
||||
sm={1}
|
||||
md={1}
|
||||
>
|
||||
<EpisodeCard
|
||||
itemId={
|
||||
mitem.Id
|
||||
}
|
||||
itemName={`${mitem.IndexNumber}. ${mitem.Name}`}
|
||||
imageTags={
|
||||
!!mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
}
|
||||
subText={
|
||||
mitem.Overview
|
||||
}
|
||||
playedPercent={
|
||||
mitem
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
watchedStatus={
|
||||
mitem
|
||||
.UserData
|
||||
.Played
|
||||
}
|
||||
favourite={
|
||||
mitem
|
||||
.UserData
|
||||
.IsFavorite
|
||||
}
|
||||
blurhash={
|
||||
mitem.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
? !!mitem
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? mitem
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={
|
||||
user.data
|
||||
}
|
||||
itemTicks={
|
||||
mitem.RunTimeTicks
|
||||
}
|
||||
itemRating={
|
||||
mitem.CommunityRating
|
||||
}
|
||||
/>
|
||||
</Grid2>
|
||||
);
|
||||
},
|
||||
)
|
||||
)}
|
||||
</Tabs>
|
||||
{seasons.data.Items.map((season, index) => {
|
||||
return (
|
||||
<TabPanel
|
||||
value={currentSeason}
|
||||
index={index}
|
||||
key={index}
|
||||
>
|
||||
<Grid2
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
>
|
||||
{episodes.isLoading ? (
|
||||
<EpisodeCardsSkeleton />
|
||||
) : (
|
||||
episodes.data.Items.map(
|
||||
(
|
||||
mitem,
|
||||
mindex,
|
||||
) => {
|
||||
return (
|
||||
<Grid2
|
||||
key={
|
||||
mindex
|
||||
}
|
||||
xs={
|
||||
1
|
||||
}
|
||||
sm={
|
||||
1
|
||||
}
|
||||
md={
|
||||
1
|
||||
}
|
||||
>
|
||||
<EpisodeCard
|
||||
itemId={
|
||||
mitem.Id
|
||||
}
|
||||
itemName={`${mitem.IndexNumber}. ${mitem.Name}`}
|
||||
imageTags={
|
||||
!!mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
}
|
||||
subText={
|
||||
mitem.Overview
|
||||
}
|
||||
playedPercent={
|
||||
mitem
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
watchedStatus={
|
||||
mitem
|
||||
.UserData
|
||||
.Played
|
||||
}
|
||||
favourite={
|
||||
mitem
|
||||
.UserData
|
||||
.IsFavorite
|
||||
}
|
||||
blurhash={
|
||||
mitem.ImageBlurHashes ==
|
||||
{}
|
||||
? ""
|
||||
: !!mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
? !!mitem
|
||||
.ImageBlurHashes
|
||||
.Primary
|
||||
? mitem
|
||||
.ImageBlurHashes
|
||||
.Primary[
|
||||
mitem
|
||||
.ImageTags
|
||||
.Primary
|
||||
]
|
||||
: ""
|
||||
: ""
|
||||
}
|
||||
currentUser={
|
||||
user.data
|
||||
}
|
||||
itemTicks={
|
||||
mitem.RunTimeTicks
|
||||
}
|
||||
itemRating={
|
||||
mitem.CommunityRating
|
||||
}
|
||||
/>
|
||||
</Grid2>
|
||||
);
|
||||
},
|
||||
)
|
||||
)}
|
||||
</Grid2>
|
||||
</TabPanel>
|
||||
);
|
||||
})}
|
||||
</Grid2>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -2333,7 +2320,7 @@ const ItemDetail = () => {
|
||||
title="Cast"
|
||||
disableDecoration
|
||||
boxProps={{
|
||||
mt: 5,
|
||||
mt: 2,
|
||||
}}
|
||||
>
|
||||
{item.data.People.map((person, index) => {
|
||||
|
||||
Reference in new issue
Block a user