Start adding episdoe cards #26
This commit is contained in:
9 files changed
+1089
-2469
No files matched your search
Generated
+285
-2394
File diff suppressed because it is too large.
Load diff
+36
-28
@@ -213,24 +213,31 @@ function App() {
|
|||||||
const LogicalRoutes = () => {
|
const LogicalRoutes = () => {
|
||||||
serverAvailable().then(async (server) => {
|
serverAvailable().then(async (server) => {
|
||||||
if (server == true) {
|
if (server == true) {
|
||||||
pingServer();
|
createApi().then(() => {
|
||||||
if (serverReachable == true) {
|
pingServer();
|
||||||
userSaved().then((user_available) => {
|
if (serverReachable == true) {
|
||||||
if (user_available == true) {
|
userSaved().then((user_available) => {
|
||||||
navigate("/home");
|
if (user_available == true) {
|
||||||
} else {
|
navigate("/home");
|
||||||
usersAvailable().then(
|
} else {
|
||||||
(users_list_available) => {
|
usersAvailable().then(
|
||||||
if (users_list_available == true) {
|
(users_list_available) => {
|
||||||
navigate("/login/users");
|
if (
|
||||||
} else {
|
users_list_available ==
|
||||||
navigate("/login/manual");
|
true
|
||||||
}
|
) {
|
||||||
},
|
navigate("/login/users");
|
||||||
);
|
} else {
|
||||||
}
|
navigate(
|
||||||
});
|
"/login/manual",
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
navigate("/setup/server");
|
navigate("/setup/server");
|
||||||
setChecking(false);
|
setChecking(false);
|
||||||
@@ -262,13 +269,17 @@ function App() {
|
|||||||
|
|
||||||
if (!window.api) {
|
if (!window.api) {
|
||||||
console.log("WindowAPi not present");
|
console.log("WindowAPi not present");
|
||||||
createApi().then(
|
serverAvailable().then((available) => {
|
||||||
userSaved().then((userSavedBool) => {
|
if (available) {
|
||||||
if (userSavedBool) {
|
createApi().then(
|
||||||
userLogin();
|
userSaved().then((userSavedBool) => {
|
||||||
}
|
if (userSavedBool) {
|
||||||
}),
|
userLogin();
|
||||||
);
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const [easterEgg, setEasterEgg] = useState(false);
|
const [easterEgg, setEasterEgg] = useState(false);
|
||||||
const sixtyNine = () => {
|
const sixtyNine = () => {
|
||||||
@@ -358,12 +369,10 @@ function App() {
|
|||||||
element={<ServerList />}
|
element={<ServerList />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
|
||||||
path="/login/withImg/:userName/:userId/"
|
path="/login/withImg/:userName/:userId/"
|
||||||
element={<LoginWithImage />}
|
element={<LoginWithImage />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
|
||||||
path="/login/users"
|
path="/login/users"
|
||||||
element={<UserLogin />}
|
element={<UserLogin />}
|
||||||
/>
|
/>
|
||||||
@@ -387,7 +396,6 @@ function App() {
|
|||||||
element={<LogicalRoutes />}
|
element={<LogicalRoutes />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
|
||||||
path="/login"
|
path="/login"
|
||||||
element={<LoginLogicalRoutes />}
|
element={<LoginLogicalRoutes />}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ export const Card = ({
|
|||||||
{...cardProps}
|
{...cardProps}
|
||||||
>
|
>
|
||||||
<CardActionArea
|
<CardActionArea
|
||||||
|
sx={{ p: "1px" }}
|
||||||
|
component="div"
|
||||||
onClick={
|
onClick={
|
||||||
!!onClickEvent
|
!!onClickEvent
|
||||||
? onClickEvent
|
? onClickEvent
|
||||||
|
|||||||
@@ -77,7 +77,6 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
// padding: 2px 10px;
|
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
// border-radius: 100px;
|
// border-radius: 100px;
|
||||||
background: $clr-gradient-default;
|
background: $clr-gradient-default;
|
||||||
|
|||||||
@@ -0,0 +1,297 @@
|
|||||||
|
/** @format */
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
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 {
|
||||||
|
MediaCollectionTypeIconCollectionCard,
|
||||||
|
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";
|
||||||
|
|
||||||
|
export const EpisodeCard = ({
|
||||||
|
itemName,
|
||||||
|
itemId,
|
||||||
|
imageTags,
|
||||||
|
subText = "",
|
||||||
|
playedPercent,
|
||||||
|
cardProps,
|
||||||
|
onClickEvent,
|
||||||
|
watchedStatus,
|
||||||
|
blurhash,
|
||||||
|
currentUser,
|
||||||
|
favourite,
|
||||||
|
showName,
|
||||||
|
episodeLocation,
|
||||||
|
}) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [imgLoading, setImgLoading] = useState(true);
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(result.data);
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(result.data.IsFavorite);
|
||||||
|
setIsFavourite(result.data.IsFavorite);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MuiCard
|
||||||
|
className="card landscape"
|
||||||
|
sx={{
|
||||||
|
background: "transparent",
|
||||||
|
borderRadius: borderRadiusDefault,
|
||||||
|
mr: 1,
|
||||||
|
}}
|
||||||
|
elevation={0}
|
||||||
|
{...cardProps}
|
||||||
|
>
|
||||||
|
<CardActionArea
|
||||||
|
sx={{ p: "1px" }}
|
||||||
|
component="div"
|
||||||
|
onClick={
|
||||||
|
!!onClickEvent
|
||||||
|
? onClickEvent
|
||||||
|
: () => {
|
||||||
|
navigate(`/item/${itemId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<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,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="card-media-image-container"
|
||||||
|
style={{ opacity: imgLoading ? 0 : 1 }}
|
||||||
|
>
|
||||||
|
{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={() => setImgLoading(false)}
|
||||||
|
className="card-image"
|
||||||
|
></CardMedia>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{!!blurhash && (
|
||||||
|
<Blurhash
|
||||||
|
hash={blurhash}
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
resolutionX={512}
|
||||||
|
resolutionY={910}
|
||||||
|
style={{
|
||||||
|
aspectRatio: "1.777",
|
||||||
|
}}
|
||||||
|
className="card-image-blurhash"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="card-image-icon-container">
|
||||||
|
{TypeIconCollectionCard["Episode"]}
|
||||||
|
</div>
|
||||||
|
{!!playedPercent && (
|
||||||
|
<LinearProgress
|
||||||
|
variant="determinate"
|
||||||
|
value={playedPercent}
|
||||||
|
sx={{
|
||||||
|
width: "90%",
|
||||||
|
position: "absolute",
|
||||||
|
left: "5%",
|
||||||
|
bottom: "5%",
|
||||||
|
borderRadius: "100px",
|
||||||
|
height: "5px",
|
||||||
|
}}
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
<Box
|
||||||
|
className="card-media-overlay"
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "flex-end",
|
||||||
|
justifyContent: "flex-end",
|
||||||
|
p: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ButtonGroup>
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
handleMarkAsPlayOrUnMarkAsPlay();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiCheck
|
||||||
|
sx={{
|
||||||
|
color: isWatched
|
||||||
|
? green[200]
|
||||||
|
: "white",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
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%"
|
||||||
|
>
|
||||||
|
{`${showName} - ${episodeLocation}`}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<Typography
|
||||||
|
gutterBottom={false}
|
||||||
|
variant="h6"
|
||||||
|
component="div"
|
||||||
|
color="white"
|
||||||
|
fontWeight={500}
|
||||||
|
textAlign="left"
|
||||||
|
noWrap
|
||||||
|
width="fit-content"
|
||||||
|
maxWidth="100%"
|
||||||
|
sx={{
|
||||||
|
opacity: !!showName ? 0.75 : 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{itemName}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
gutterBottom
|
||||||
|
variant="body2"
|
||||||
|
component="div"
|
||||||
|
color="white"
|
||||||
|
textAlign="left"
|
||||||
|
width="fit-content"
|
||||||
|
maxWidth="100%"
|
||||||
|
sx={{ opacity: 0.5 }}
|
||||||
|
>
|
||||||
|
{subText}
|
||||||
|
</Typography>
|
||||||
|
</CardContent>
|
||||||
|
</CardActionArea>
|
||||||
|
</MuiCard>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
@@ -52,8 +52,6 @@ import { formateDate } from "../../utils/date/formateDate";
|
|||||||
import { getRuntime } from "../../utils/date/time";
|
import { getRuntime } from "../../utils/date/time";
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const queryClient = useQueryClient();
|
|
||||||
|
|
||||||
const authUser = useQuery({
|
const authUser = useQuery({
|
||||||
queryKey: ["home", "authenticateUser"],
|
queryKey: ["home", "authenticateUser"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
|||||||
+450
-34
@@ -2,6 +2,9 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
import CardMedia from "@mui/material/CardMedia";
|
||||||
|
import CardContent from "@mui/material/CardContent";
|
||||||
|
import MuiCard from "@mui/material/Card";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
@@ -18,7 +21,7 @@ import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useParams, useNavigate } from "react-router-dom";
|
import { useParams, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-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 { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
@@ -31,6 +34,7 @@ import { getRuntimeFull } from "../../utils/date/time";
|
|||||||
import { TypeIconCollectionCard } from "../../components/utils/iconsCollection";
|
import { TypeIconCollectionCard } from "../../components/utils/iconsCollection";
|
||||||
|
|
||||||
import { Card } from "../../components/card/card";
|
import { Card } from "../../components/card/card";
|
||||||
|
import { EpisodeCard } from "../../components/card/episodeCard";
|
||||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||||
|
|
||||||
import "./item.module.scss";
|
import "./item.module.scss";
|
||||||
@@ -46,11 +50,7 @@ function TabPanel(props) {
|
|||||||
aria-labelledby={`full-width-tab-${index}`}
|
aria-labelledby={`full-width-tab-${index}`}
|
||||||
{...other}
|
{...other}
|
||||||
>
|
>
|
||||||
{value === index && (
|
{value === index && <Box>{children}</Box>}
|
||||||
<Box sx={{ p: 3 }}>
|
|
||||||
<Typography>{children}</Typography>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -160,9 +160,10 @@ const ItemDetail = () => {
|
|||||||
const episodes = useQuery({
|
const episodes = useQuery({
|
||||||
queryKey: ["item", "episode", `season ${currentSeason + 1}`],
|
queryKey: ["item", "episode", `season ${currentSeason + 1}`],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getTvShowsApi(window.api).getEpisodes({
|
const result = await getItemsApi(window.api).getItems({
|
||||||
seriesId: item.data.Id,
|
userId: user.data.Id,
|
||||||
seasonId: seasons.data.Items[currentSeason].Id,
|
parentId: seasons.data.Items[currentSeason].Id,
|
||||||
|
fields: [ItemFields.SeasonUserData, "Overview"],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -233,31 +234,26 @@ const ItemDetail = () => {
|
|||||||
enabled: item.isSuccess && item.data.Type == "Person",
|
enabled: item.isSuccess && item.data.Type == "Person",
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
const personDataEmpty = (pitem) => {
|
const personEpisodes = useQuery({
|
||||||
let result;
|
queryKey: ["item", "personEpisodes"],
|
||||||
switch (pitem) {
|
queryFn: async () => {
|
||||||
case "Movies":
|
const result = await getItemsApi(window.api).getItems({
|
||||||
result = personMovies.data.Items.length == 0;
|
userId: user.data.Id,
|
||||||
break;
|
personIds: [id],
|
||||||
case "TV Shows":
|
includeItemTypes: [BaseItemKind.Episode],
|
||||||
result = personShows.data.Items.length == 0;
|
recursive: true,
|
||||||
break;
|
fields: ["SeasonUserData", "Overview"],
|
||||||
case "Books":
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
result = personBooks.data.Items.length == 0;
|
});
|
||||||
break;
|
return result.data;
|
||||||
case "Photos":
|
},
|
||||||
result = personPhotos.data.Items.length == 0;
|
enabled: item.isSuccess && item.data.Type == "Person",
|
||||||
break;
|
networkMode: "always",
|
||||||
default:
|
});
|
||||||
result = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console.log("Result => ", result);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const [activePersonTab, setActivePersonTab] = useState(0);
|
const [activePersonTab, setActivePersonTab] = useState(0);
|
||||||
const personTabs = ["Movies", "TV Shows", "Books", "Photos"];
|
|
||||||
|
const personTabs = ["Movies", "TV Shows", "Books", "Photos", "Episodes"];
|
||||||
|
|
||||||
if (item.isLoading || similarItems.isLoading) {
|
if (item.isLoading || similarItems.isLoading) {
|
||||||
return (
|
return (
|
||||||
@@ -610,6 +606,7 @@ const ItemDetail = () => {
|
|||||||
onChange={(e, newVal) => {
|
onChange={(e, newVal) => {
|
||||||
setCurrentSeason(newVal);
|
setCurrentSeason(newVal);
|
||||||
}}
|
}}
|
||||||
|
sx={{ mb: 2 }}
|
||||||
>
|
>
|
||||||
{seasons.data.Items.map(
|
{seasons.data.Items.map(
|
||||||
(season, index) => {
|
(season, index) => {
|
||||||
@@ -632,7 +629,92 @@ const ItemDetail = () => {
|
|||||||
index={index}
|
index={index}
|
||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
Item {index}
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 2,
|
||||||
|
sm: 3,
|
||||||
|
md: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{episodes.isSuccess &&
|
||||||
|
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
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid2>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Grid2>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -671,7 +753,8 @@ const ItemDetail = () => {
|
|||||||
personShows.isSuccess &&
|
personShows.isSuccess &&
|
||||||
personMovies.isSuccess &&
|
personMovies.isSuccess &&
|
||||||
personBooks.isSuccess &&
|
personBooks.isSuccess &&
|
||||||
personPhotos.isSuccess && (
|
personPhotos.isSuccess &&
|
||||||
|
personEpisodes.isSuccess && (
|
||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -723,6 +806,13 @@ const ItemDetail = () => {
|
|||||||
(pitem ==
|
(pitem ==
|
||||||
"Photos" &&
|
"Photos" &&
|
||||||
personPhotos
|
personPhotos
|
||||||
|
.data
|
||||||
|
.Items
|
||||||
|
.length ==
|
||||||
|
0) ||
|
||||||
|
(pitem ==
|
||||||
|
"Episodes" &&
|
||||||
|
personEpisodes
|
||||||
.data
|
.data
|
||||||
.Items
|
.Items
|
||||||
.length ==
|
.length ==
|
||||||
@@ -974,6 +1064,332 @@ const ItemDetail = () => {
|
|||||||
)}
|
)}
|
||||||
</Grid2>
|
</Grid2>
|
||||||
)}
|
)}
|
||||||
|
{pitem == "Books" && (
|
||||||
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 4,
|
||||||
|
sm: 6,
|
||||||
|
md: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{personBooks.data.Items.map(
|
||||||
|
(
|
||||||
|
mitem,
|
||||||
|
mindex,
|
||||||
|
) => {
|
||||||
|
return (
|
||||||
|
<Grid2
|
||||||
|
key={
|
||||||
|
mindex
|
||||||
|
}
|
||||||
|
xs={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
sm={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
md={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
itemName={
|
||||||
|
mitem.Name
|
||||||
|
}
|
||||||
|
itemId={
|
||||||
|
mitem.Id
|
||||||
|
}
|
||||||
|
imageTags={
|
||||||
|
!!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
}
|
||||||
|
subText={
|
||||||
|
mitem.ProductionYear
|
||||||
|
}
|
||||||
|
iconType={
|
||||||
|
mitem.Type
|
||||||
|
}
|
||||||
|
playedPercent={
|
||||||
|
!!mitem.UserData
|
||||||
|
? mitem
|
||||||
|
.UserData
|
||||||
|
.PlayedPercentage
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
cardOrientation={
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicArtist" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicAlbum" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicGenre" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"Playlist"
|
||||||
|
? "square"
|
||||||
|
: "portait"
|
||||||
|
}
|
||||||
|
watchedStatus={
|
||||||
|
!!mitem.UserData
|
||||||
|
? mitem
|
||||||
|
.UserData
|
||||||
|
.Played
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
watchedCount={
|
||||||
|
!!mitem.UserData &&
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.UnplayedItemCount
|
||||||
|
}
|
||||||
|
blurhash={
|
||||||
|
mitem.ImageBlurHashes ==
|
||||||
|
{}
|
||||||
|
? ""
|
||||||
|
: !!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
? !!mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary
|
||||||
|
? mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary[
|
||||||
|
mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
]
|
||||||
|
: ""
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
currentUser={
|
||||||
|
user.data
|
||||||
|
}
|
||||||
|
onClickEvent={() => {
|
||||||
|
navigate(
|
||||||
|
`/item/${mitem.Id}`,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
></Card>
|
||||||
|
</Grid2>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Grid2>
|
||||||
|
)}
|
||||||
|
{pitem == "Photos" && (
|
||||||
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 4,
|
||||||
|
sm: 6,
|
||||||
|
md: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{personPhotos.data.Items.map(
|
||||||
|
(
|
||||||
|
mitem,
|
||||||
|
mindex,
|
||||||
|
) => {
|
||||||
|
return (
|
||||||
|
<Grid2
|
||||||
|
key={
|
||||||
|
mindex
|
||||||
|
}
|
||||||
|
xs={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
sm={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
md={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
itemName={
|
||||||
|
mitem.Name
|
||||||
|
}
|
||||||
|
itemId={
|
||||||
|
mitem.Id
|
||||||
|
}
|
||||||
|
imageTags={
|
||||||
|
!!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
}
|
||||||
|
subText={
|
||||||
|
mitem.ProductionYear
|
||||||
|
}
|
||||||
|
iconType={
|
||||||
|
mitem.Type
|
||||||
|
}
|
||||||
|
playedPercent={
|
||||||
|
!!mitem.UserData
|
||||||
|
? mitem
|
||||||
|
.UserData
|
||||||
|
.PlayedPercentage
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
cardOrientation={
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicArtist" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicAlbum" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"MusicGenre" ||
|
||||||
|
mitem.Type ==
|
||||||
|
"Playlist"
|
||||||
|
? "square"
|
||||||
|
: "portait"
|
||||||
|
}
|
||||||
|
watchedStatus={
|
||||||
|
!!mitem.UserData
|
||||||
|
? mitem
|
||||||
|
.UserData
|
||||||
|
.Played
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
watchedCount={
|
||||||
|
!!mitem.UserData &&
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.UnplayedItemCount
|
||||||
|
}
|
||||||
|
blurhash={
|
||||||
|
mitem.ImageBlurHashes ==
|
||||||
|
{}
|
||||||
|
? ""
|
||||||
|
: !!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
? !!mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary
|
||||||
|
? mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary[
|
||||||
|
mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
]
|
||||||
|
: ""
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
currentUser={
|
||||||
|
user.data
|
||||||
|
}
|
||||||
|
onClickEvent={() => {
|
||||||
|
navigate(
|
||||||
|
`/item/${mitem.Id}`,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
></Card>
|
||||||
|
</Grid2>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Grid2>
|
||||||
|
)}
|
||||||
|
{pitem == "Episodes" && (
|
||||||
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 2,
|
||||||
|
sm: 3,
|
||||||
|
md: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{personEpisodes.data.Items.map(
|
||||||
|
(
|
||||||
|
mitem,
|
||||||
|
mindex,
|
||||||
|
) => {
|
||||||
|
return (
|
||||||
|
<Grid2
|
||||||
|
key={
|
||||||
|
mindex
|
||||||
|
}
|
||||||
|
xs={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
sm={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
md={
|
||||||
|
1
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<EpisodeCard
|
||||||
|
itemId={
|
||||||
|
mitem.Id
|
||||||
|
}
|
||||||
|
itemName={
|
||||||
|
mitem.Name
|
||||||
|
}
|
||||||
|
imageTags={
|
||||||
|
!!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
}
|
||||||
|
subText={
|
||||||
|
mitem.Overview
|
||||||
|
}
|
||||||
|
playedPercent={
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.PlayedPercentage
|
||||||
|
}
|
||||||
|
watchedStatus={
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.Played
|
||||||
|
}
|
||||||
|
watchedCount={
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.PlayCount
|
||||||
|
}
|
||||||
|
blurhash={
|
||||||
|
mitem.ImageBlurHashes ==
|
||||||
|
{}
|
||||||
|
? ""
|
||||||
|
: !!mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
? !!mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary
|
||||||
|
? mitem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary[
|
||||||
|
mitem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
]
|
||||||
|
: ""
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
currentUser={
|
||||||
|
user.data
|
||||||
|
}
|
||||||
|
favourite={
|
||||||
|
mitem
|
||||||
|
.UserData
|
||||||
|
.IsFavorite
|
||||||
|
}
|
||||||
|
showName={
|
||||||
|
mitem.SeriesName
|
||||||
|
}
|
||||||
|
episodeLocation={`S${mitem.ParentIndexNumber}:E${mitem.IndexNumber}`}
|
||||||
|
/>
|
||||||
|
</Grid2>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Grid2>
|
||||||
|
)}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -241,7 +241,15 @@ const LibraryView = () => {
|
|||||||
result = await getItemsApi(window.api).getItems({
|
result = await getItemsApi(window.api).getItems({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: libraryId,
|
parentId: libraryId,
|
||||||
recursive: true,
|
recursive:
|
||||||
|
currentLib.data.Items[0].CollectionType ===
|
||||||
|
"homevideos" ||
|
||||||
|
currentLib.data.Items[0].Type === "Folder" ||
|
||||||
|
(currentLib.data.Items[0].Type ===
|
||||||
|
"CollectionFolder" &&
|
||||||
|
!("CollectionType" in currentLib.data.Items[0]))
|
||||||
|
? undefined
|
||||||
|
: true,
|
||||||
includeItemTypes: [currentViewType],
|
includeItemTypes: [currentViewType],
|
||||||
sortOrder: [sortAscending ? "Ascending" : "Descending"],
|
sortOrder: [sortAscending ? "Ascending" : "Descending"],
|
||||||
sortBy: sortBy,
|
sortBy: sortBy,
|
||||||
@@ -295,7 +303,7 @@ const LibraryView = () => {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
queryFn: () => fetchLibItems(id),
|
queryFn: () => fetchLibItems(id),
|
||||||
enabled: !!user.data,
|
enabled: currentLib.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -307,7 +315,14 @@ const LibraryView = () => {
|
|||||||
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
||||||
}, [viewType]);
|
}, [viewType]);
|
||||||
|
|
||||||
const allowedSortViews = ["Movie", "Series", "MusicAlbum"];
|
const disabledSortViews = [
|
||||||
|
"MusicArtist",
|
||||||
|
"Person",
|
||||||
|
"Genre",
|
||||||
|
"MusicGenre",
|
||||||
|
"MusicGenre",
|
||||||
|
"Studio",
|
||||||
|
];
|
||||||
const allowedFilterViews = ["movies", "tvshows", "music", "books"];
|
const allowedFilterViews = ["movies", "tvshows", "music", "books"];
|
||||||
const onlyStatusFilterViews = ["books", "music"];
|
const onlyStatusFilterViews = ["books", "music"];
|
||||||
|
|
||||||
@@ -680,7 +695,7 @@ const LibraryView = () => {
|
|||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{allowedSortViews.includes(
|
{!disabledSortViews.includes(
|
||||||
currentViewType,
|
currentViewType,
|
||||||
) && (
|
) && (
|
||||||
<>
|
<>
|
||||||
@@ -826,11 +841,6 @@ const LibraryView = () => {
|
|||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
currentUser={user.data}
|
currentUser={user.data}
|
||||||
onClickEvent={() => {
|
|
||||||
navigate(
|
|
||||||
`/item/${item.Id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
></Card>
|
></Card>
|
||||||
</Grid2>
|
</Grid2>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import svgr from "vite-plugin-svgr";
|
|||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "./",
|
|
||||||
plugins: [react(), svgr()],
|
plugins: [react(), svgr()],
|
||||||
css: {
|
css: {
|
||||||
modules: {
|
modules: {
|
||||||
|
|||||||
Reference in new issue
Block a user