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 = () => {
|
||||
serverAvailable().then(async (server) => {
|
||||
if (server == true) {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (users_list_available == true) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate("/login/manual");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
createApi().then(() => {
|
||||
pingServer();
|
||||
if (serverReachable == true) {
|
||||
userSaved().then((user_available) => {
|
||||
if (user_available == true) {
|
||||
navigate("/home");
|
||||
} else {
|
||||
usersAvailable().then(
|
||||
(users_list_available) => {
|
||||
if (
|
||||
users_list_available ==
|
||||
true
|
||||
) {
|
||||
navigate("/login/users");
|
||||
} else {
|
||||
navigate(
|
||||
"/login/manual",
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigate("/setup/server");
|
||||
setChecking(false);
|
||||
@@ -262,13 +269,17 @@ function App() {
|
||||
|
||||
if (!window.api) {
|
||||
console.log("WindowAPi not present");
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
serverAvailable().then((available) => {
|
||||
if (available) {
|
||||
createApi().then(
|
||||
userSaved().then((userSavedBool) => {
|
||||
if (userSavedBool) {
|
||||
userLogin();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
const [easterEgg, setEasterEgg] = useState(false);
|
||||
const sixtyNine = () => {
|
||||
@@ -358,12 +369,10 @@ function App() {
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
@@ -387,7 +396,6 @@ function App() {
|
||||
element={<LogicalRoutes />}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path="/login"
|
||||
element={<LoginLogicalRoutes />}
|
||||
/>
|
||||
|
||||
@@ -135,6 +135,8 @@ export const Card = ({
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
sx={{ p: "1px" }}
|
||||
component="div"
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
// padding: 2px 10px;
|
||||
z-index: 10;
|
||||
// border-radius: 100px;
|
||||
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";
|
||||
|
||||
const Home = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
queryFn: async () => {
|
||||
|
||||
+450
-34
@@ -2,6 +2,9 @@
|
||||
import { useState, useEffect } from "react";
|
||||
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 CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -18,7 +21,7 @@ import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
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 { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-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 { Card } from "../../components/card/card";
|
||||
import { EpisodeCard } from "../../components/card/episodeCard";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
|
||||
import "./item.module.scss";
|
||||
@@ -46,11 +50,7 @@ function TabPanel(props) {
|
||||
aria-labelledby={`full-width-tab-${index}`}
|
||||
{...other}
|
||||
>
|
||||
{value === index && (
|
||||
<Box sx={{ p: 3 }}>
|
||||
<Typography>{children}</Typography>
|
||||
</Box>
|
||||
)}
|
||||
{value === index && <Box>{children}</Box>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -160,9 +160,10 @@ const ItemDetail = () => {
|
||||
const episodes = useQuery({
|
||||
queryKey: ["item", "episode", `season ${currentSeason + 1}`],
|
||||
queryFn: async () => {
|
||||
const result = await getTvShowsApi(window.api).getEpisodes({
|
||||
seriesId: item.data.Id,
|
||||
seasonId: seasons.data.Items[currentSeason].Id,
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
parentId: seasons.data.Items[currentSeason].Id,
|
||||
fields: [ItemFields.SeasonUserData, "Overview"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -233,31 +234,26 @@ const ItemDetail = () => {
|
||||
enabled: item.isSuccess && item.data.Type == "Person",
|
||||
networkMode: "always",
|
||||
});
|
||||
const personDataEmpty = (pitem) => {
|
||||
let result;
|
||||
switch (pitem) {
|
||||
case "Movies":
|
||||
result = personMovies.data.Items.length == 0;
|
||||
break;
|
||||
case "TV Shows":
|
||||
result = personShows.data.Items.length == 0;
|
||||
break;
|
||||
case "Books":
|
||||
result = personBooks.data.Items.length == 0;
|
||||
break;
|
||||
case "Photos":
|
||||
result = personPhotos.data.Items.length == 0;
|
||||
break;
|
||||
default:
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
console.log("Result => ", result);
|
||||
return result;
|
||||
};
|
||||
const personEpisodes = useQuery({
|
||||
queryKey: ["item", "personEpisodes"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
personIds: [id],
|
||||
includeItemTypes: [BaseItemKind.Episode],
|
||||
recursive: true,
|
||||
fields: ["SeasonUserData", "Overview"],
|
||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == "Person",
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
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) {
|
||||
return (
|
||||
@@ -610,6 +606,7 @@ const ItemDetail = () => {
|
||||
onChange={(e, newVal) => {
|
||||
setCurrentSeason(newVal);
|
||||
}}
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
{seasons.data.Items.map(
|
||||
(season, index) => {
|
||||
@@ -632,7 +629,92 @@ const ItemDetail = () => {
|
||||
index={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>
|
||||
);
|
||||
})}
|
||||
@@ -671,7 +753,8 @@ const ItemDetail = () => {
|
||||
personShows.isSuccess &&
|
||||
personMovies.isSuccess &&
|
||||
personBooks.isSuccess &&
|
||||
personPhotos.isSuccess && (
|
||||
personPhotos.isSuccess &&
|
||||
personEpisodes.isSuccess && (
|
||||
<Box>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -723,6 +806,13 @@ const ItemDetail = () => {
|
||||
(pitem ==
|
||||
"Photos" &&
|
||||
personPhotos
|
||||
.data
|
||||
.Items
|
||||
.length ==
|
||||
0) ||
|
||||
(pitem ==
|
||||
"Episodes" &&
|
||||
personEpisodes
|
||||
.data
|
||||
.Items
|
||||
.length ==
|
||||
@@ -974,6 +1064,332 @@ const ItemDetail = () => {
|
||||
)}
|
||||
</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>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -241,7 +241,15 @@ const LibraryView = () => {
|
||||
result = await getItemsApi(window.api).getItems({
|
||||
userId: user.data.Id,
|
||||
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],
|
||||
sortOrder: [sortAscending ? "Ascending" : "Descending"],
|
||||
sortBy: sortBy,
|
||||
@@ -295,7 +303,7 @@ const LibraryView = () => {
|
||||
],
|
||||
],
|
||||
queryFn: () => fetchLibItems(id),
|
||||
enabled: !!user.data,
|
||||
enabled: currentLib.isSuccess,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -307,7 +315,14 @@ const LibraryView = () => {
|
||||
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
||||
}, [viewType]);
|
||||
|
||||
const allowedSortViews = ["Movie", "Series", "MusicAlbum"];
|
||||
const disabledSortViews = [
|
||||
"MusicArtist",
|
||||
"Person",
|
||||
"Genre",
|
||||
"MusicGenre",
|
||||
"MusicGenre",
|
||||
"Studio",
|
||||
];
|
||||
const allowedFilterViews = ["movies", "tvshows", "music", "books"];
|
||||
const onlyStatusFilterViews = ["books", "music"];
|
||||
|
||||
@@ -680,7 +695,7 @@ const LibraryView = () => {
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
{allowedSortViews.includes(
|
||||
{!disabledSortViews.includes(
|
||||
currentViewType,
|
||||
) && (
|
||||
<>
|
||||
@@ -826,11 +841,6 @@ const LibraryView = () => {
|
||||
: ""
|
||||
}
|
||||
currentUser={user.data}
|
||||
onClickEvent={() => {
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
);
|
||||
}}
|
||||
></Card>
|
||||
</Grid2>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@ import svgr from "vite-plugin-svgr";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
plugins: [react(), svgr()],
|
||||
css: {
|
||||
modules: {
|
||||
|
||||
Reference in new issue
Block a user