Combine item pages and update them #26
This commit is contained in:
7 files changed
+212
-439
No files matched your search
+3
-8
@@ -45,8 +45,7 @@ import {
|
|||||||
UserLoginManual,
|
UserLoginManual,
|
||||||
} from "./routes/login/root";
|
} from "./routes/login/root";
|
||||||
import LibraryView from "./routes/library/root.jsx";
|
import LibraryView from "./routes/library/root.jsx";
|
||||||
import ItemMovie from "./routes/item/Movie/root.jsx";
|
import ItemDetail from "./routes/item/root.jsx";
|
||||||
import ItemSeries from "./routes/item/Series/root.jsx";
|
|
||||||
|
|
||||||
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
import { SideMenu } from "./components/menu/sidemenu.jsx";
|
||||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||||
@@ -355,12 +354,8 @@ function App() {
|
|||||||
element={<LibraryView />}
|
element={<LibraryView />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/item/Movie/:id"
|
path="/item/:id"
|
||||||
element={<ItemMovie />}
|
element={<ItemDetail />}
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/item/Series/:id"
|
|
||||||
element={<ItemSeries />}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Logical Routes */}
|
{/* Logical Routes */}
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ import Typography from "@mui/material/Typography";
|
|||||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||||
|
|
||||||
import "./cardScroller.module.scss";
|
import "./cardScroller.module.scss";
|
||||||
export const CardScroller = ({ children, displayCards, title }) => {
|
export const CardScroller = ({
|
||||||
|
children,
|
||||||
|
displayCards,
|
||||||
|
title,
|
||||||
|
headingProps,
|
||||||
|
}) => {
|
||||||
const responsive = {
|
const responsive = {
|
||||||
superLargeDesktop: {
|
superLargeDesktop: {
|
||||||
// the naming can be any, depends on you.
|
// the naming can be any, depends on you.
|
||||||
@@ -50,6 +55,7 @@ export const CardScroller = ({ children, displayCards, title }) => {
|
|||||||
variant="h4"
|
variant="h4"
|
||||||
color="textPrimary"
|
color="textPrimary"
|
||||||
className="card-scroller-heading"
|
className="card-scroller-heading"
|
||||||
|
{...headingProps}
|
||||||
>
|
>
|
||||||
<div className="card-scroller-heading-decoration"></div>{" "}
|
<div className="card-scroller-heading-decoration"></div>{" "}
|
||||||
{title}
|
{title}
|
||||||
@@ -88,4 +94,5 @@ export const CardScroller = ({ children, displayCards, title }) => {
|
|||||||
CardScroller.propTypes = {
|
CardScroller.propTypes = {
|
||||||
displayCards: PropTypes.number.isRequired,
|
displayCards: PropTypes.number.isRequired,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
|
headingProps: PropTypes.any,
|
||||||
};
|
};
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/** @format */
|
|
||||||
|
|
||||||
.item-detail {
|
|
||||||
&-backdrop {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: inherit;
|
|
||||||
height: 100%;
|
|
||||||
z-index: -2;
|
|
||||||
opacity: 0.1;
|
|
||||||
}
|
|
||||||
&-header {
|
|
||||||
display: flex;
|
|
||||||
gap: 2em;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: flex-end;
|
|
||||||
position: relative;
|
|
||||||
&-backdrop {
|
|
||||||
position: absolute;
|
|
||||||
width: 100vw;
|
|
||||||
height: 150%;
|
|
||||||
top: -88px;
|
|
||||||
width: 100vw;
|
|
||||||
right: 0;
|
|
||||||
left: -24px;
|
|
||||||
z-index: -1;
|
|
||||||
filter: brightness(0.5);
|
|
||||||
mask-image: linear-gradient(0deg, transparent, black);
|
|
||||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
position: absolute;
|
|
||||||
transition: opacity $transition-time-default;
|
|
||||||
&-blurhash {
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
&-container {
|
|
||||||
width: 15%;
|
|
||||||
position: relative;
|
|
||||||
aspect-ratio: 0.666;
|
|
||||||
border-radius: $border-radius-default;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
|
||||||
}
|
|
||||||
&-icon-container {
|
|
||||||
background: $clr-gradient-dark;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,344 +0,0 @@
|
|||||||
/** @format */
|
|
||||||
import { useState, useEffect } from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Chip from "@mui/material/Chip";
|
|
||||||
import Divider from "@mui/material/Divider";
|
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
|
||||||
import { showAppBar, showBackButton } from "../../../utils/slice/appBar";
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
|
||||||
import { useParams } from "react-router-dom";
|
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
|
||||||
import { getRuntimeFull } from "../../../utils/date/time";
|
|
||||||
import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection";
|
|
||||||
|
|
||||||
import { Card } from "../../../components/card/card";
|
|
||||||
import { CardScroller } from "../../../components/cardScroller/cardScroller";
|
|
||||||
|
|
||||||
import "./Series.module.scss";
|
|
||||||
|
|
||||||
const ItemSeries = () => {
|
|
||||||
const { id } = useParams();
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
|
||||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
|
||||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!appBarVisiblity) {
|
|
||||||
dispatch(showAppBar());
|
|
||||||
}
|
|
||||||
dispatch(showBackButton());
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const user = useQuery({
|
|
||||||
queryKey: ["user"],
|
|
||||||
queryFn: async () => {
|
|
||||||
let usr = await getUserApi(window.api).getCurrentUser();
|
|
||||||
return usr.data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = useQuery({
|
|
||||||
queryKey: ["item, Series", id],
|
|
||||||
queryFn: async () => {
|
|
||||||
const result = await getUserLibraryApi(window.api).getItem({
|
|
||||||
userId: user.data.Id,
|
|
||||||
itemId: id,
|
|
||||||
});
|
|
||||||
return result.data;
|
|
||||||
},
|
|
||||||
enabled: !!user.data,
|
|
||||||
});
|
|
||||||
if (item.isLoading) {
|
|
||||||
return (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
height: "100vh",
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CircularProgress />
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (item.isSuccess) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Box className="item-detail-backdrop">
|
|
||||||
{item.data.BackdropImageTags.length != 0 && (
|
|
||||||
<Blurhash
|
|
||||||
hash={
|
|
||||||
item.data.ImageBlurHashes.Backdrop[
|
|
||||||
item.data.BackdropImageTags[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
resolutionX={64}
|
|
||||||
resolutionY={96}
|
|
||||||
style={{
|
|
||||||
aspectRatio: "0.666",
|
|
||||||
}}
|
|
||||||
className="item-detail-image-blurhash"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Box
|
|
||||||
recomponent="main"
|
|
||||||
className="scrollY"
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
pt: 11,
|
|
||||||
px: 3,
|
|
||||||
pb: 3,
|
|
||||||
position: "relative",
|
|
||||||
flexFlow: "column",
|
|
||||||
gap: 5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box className="item-detail-header">
|
|
||||||
<Box className="item-detail-header-backdrop">
|
|
||||||
{item.data.BackdropImageTags.length != 0 && (
|
|
||||||
<img
|
|
||||||
src={
|
|
||||||
window.api.basePath +
|
|
||||||
"/Items/" +
|
|
||||||
item.data.Id +
|
|
||||||
"/Images/Backdrop"
|
|
||||||
}
|
|
||||||
style={{
|
|
||||||
opacity: backdropImageLoaded
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
className="item-detail-image"
|
|
||||||
onLoad={() =>
|
|
||||||
setBackdropImageLoaded(true)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{item.data.BackdropImageTags.length != 0 && (
|
|
||||||
<Blurhash
|
|
||||||
hash={
|
|
||||||
item.data.ImageBlurHashes
|
|
||||||
.Backdrop[
|
|
||||||
item.data
|
|
||||||
.BackdropImageTags[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
resolutionX={64}
|
|
||||||
resolutionY={96}
|
|
||||||
style={{
|
|
||||||
aspectRatio: "0.666",
|
|
||||||
}}
|
|
||||||
className="item-detail-image-blurhash"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Box
|
|
||||||
sx={{ fontSize: "4em" }}
|
|
||||||
className="item-detail-image-icon-container"
|
|
||||||
>
|
|
||||||
{TypeIconCollectionCard[item.data.Type]}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
<Box className="item-detail-image-container">
|
|
||||||
{!!item.data.ImageTags.Primary && (
|
|
||||||
<img
|
|
||||||
src={
|
|
||||||
window.api.basePath +
|
|
||||||
"/Items/" +
|
|
||||||
item.data.Id +
|
|
||||||
"/Images/Primary"
|
|
||||||
}
|
|
||||||
style={{
|
|
||||||
opacity: primageImageLoaded
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
className="item-detail-image"
|
|
||||||
onLoad={() =>
|
|
||||||
setPrimaryImageLoaded(true)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{!!item.data.ImageBlurHashes.Primary && (
|
|
||||||
<Blurhash
|
|
||||||
hash={
|
|
||||||
item.data.ImageBlurHashes
|
|
||||||
.Primary[
|
|
||||||
item.data.ImageTags
|
|
||||||
.Primary
|
|
||||||
]
|
|
||||||
}
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
resolutionX={64}
|
|
||||||
resolutionY={96}
|
|
||||||
style={{
|
|
||||||
aspectRatio: 0.666,
|
|
||||||
}}
|
|
||||||
className="item-detail-image-blurhash"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="item-detail-image-icon-container">
|
|
||||||
{TypeIconCollectionCard[item.data.Type]}
|
|
||||||
</div>
|
|
||||||
</Box>
|
|
||||||
<Box className="item-detail-info-container">
|
|
||||||
<Box
|
|
||||||
className="item-detail-title-name"
|
|
||||||
sx={{ mb: 2 }}
|
|
||||||
>
|
|
||||||
<Typography variant="h3">
|
|
||||||
{item.data.Name}
|
|
||||||
</Typography>
|
|
||||||
{!!item.data.UserData
|
|
||||||
.PlayedPercentage && (
|
|
||||||
<LinearProgress
|
|
||||||
variant="determinate"
|
|
||||||
value={
|
|
||||||
item.data.UserData
|
|
||||||
.PlayedPercentage
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
borderRadius: 1000,
|
|
||||||
width: "75%",
|
|
||||||
mt: 1,
|
|
||||||
mb: 1,
|
|
||||||
}}
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Typography
|
|
||||||
variant="subtitle1"
|
|
||||||
color="gray"
|
|
||||||
>
|
|
||||||
{item.data.OriginalTitle}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
gap={2}
|
|
||||||
divider={
|
|
||||||
<Divider
|
|
||||||
variant="middle"
|
|
||||||
flexItem
|
|
||||||
orientation="vertical"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
ex={{ alignItems: "center" }}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
sx={{ flexGrow: 0 }}
|
|
||||||
variant="subtitle1"
|
|
||||||
>
|
|
||||||
{item.data.ProductionYear}
|
|
||||||
</Typography>
|
|
||||||
<Chip
|
|
||||||
variant="outlined"
|
|
||||||
label={
|
|
||||||
!!item.data.OfficialRating
|
|
||||||
? item.data
|
|
||||||
.OfficialRating
|
|
||||||
: "Not Rated"
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
gap: "0.25em",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
className="item-detail-info-rating"
|
|
||||||
>
|
|
||||||
{!!item.data.CommunityRating ? (
|
|
||||||
<>
|
|
||||||
<MdiStarHalfFull />
|
|
||||||
<Typography variant="subtitle1">
|
|
||||||
{Math.round(
|
|
||||||
item.data
|
|
||||||
.CommunityRating *
|
|
||||||
10,
|
|
||||||
) / 10}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Typography variant="subtitle1">
|
|
||||||
No Community Rating
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
<Typography variant="subtitle1">
|
|
||||||
{getRuntimeFull(
|
|
||||||
item.data.RunTimeTicks,
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
<Box className="item-media-container">
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
gap={1}
|
|
||||||
alignItems="center"
|
|
||||||
>
|
|
||||||
<Typography variant="h5">Genre</Typography>
|
|
||||||
{item.data.Genres.map((genre, index) => {
|
|
||||||
return (
|
|
||||||
<Chip
|
|
||||||
key={index}
|
|
||||||
variant="filled"
|
|
||||||
label={genre}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Stack>
|
|
||||||
</Box>
|
|
||||||
<Typography variant="body1">
|
|
||||||
{item.data.Overview}
|
|
||||||
</Typography>
|
|
||||||
<CardScroller displayCards={8} title="Cast">
|
|
||||||
{item.data.People.map((person, index) => {
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
key={index}
|
|
||||||
itemName={person.Name}
|
|
||||||
itemId={person.Id}
|
|
||||||
// imageTags={false}
|
|
||||||
imageTags={
|
|
||||||
!!person.PrimaryImageTag
|
|
||||||
}
|
|
||||||
iconType="Person"
|
|
||||||
subText={person.Role}
|
|
||||||
cardOrientation="sqaure"
|
|
||||||
currentUser={user.data}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</CardScroller>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (item.isError) {
|
|
||||||
return <h1>{"Something went wrong :("}</h1>;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ItemSeries;
|
|
||||||
File renamed without changes.
@@ -8,28 +8,35 @@ import Stack from "@mui/material/Stack";
|
|||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import Tabs from "@mui/material/Tabs";
|
||||||
|
import Tab from "@mui/material/Tab";
|
||||||
|
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
import { showAppBar, showBackButton } from "../../../utils/slice/appBar";
|
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
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 { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
|
||||||
import { getRuntimeFull } from "../../../utils/date/time";
|
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 { CardScroller } from "../../../components/cardScroller/cardScroller";
|
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||||
|
|
||||||
import "./Movie.module.scss";
|
import "./item.module.scss";
|
||||||
|
|
||||||
const ItemMovie = () => {
|
const ItemDetail = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const [isMovie, setIsMovie] = useState(false);
|
||||||
|
const [isSeries, setIsSeries] = useState(false);
|
||||||
|
const [isMusicItem, setIsMusicItem] = useState(false);
|
||||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||||
@@ -50,7 +57,7 @@ const ItemMovie = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item,Movie", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getUserLibraryApi(window.api).getItem({
|
const result = await getUserLibraryApi(window.api).getItem({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
@@ -60,7 +67,54 @@ const ItemMovie = () => {
|
|||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
});
|
});
|
||||||
if (item.isLoading) {
|
|
||||||
|
const similarItems = useQuery({
|
||||||
|
queryKey: ["item", "similarItem", id],
|
||||||
|
queryFn: async () => {
|
||||||
|
let result;
|
||||||
|
if (item.data.Type == "Movie") {
|
||||||
|
result = await getLibraryApi(window.api).getSimilarMovies({
|
||||||
|
userId: user.data.Id,
|
||||||
|
itemId: item.data.Id,
|
||||||
|
});
|
||||||
|
} else if (item.data.Type == "Series") {
|
||||||
|
result = await getLibraryApi(window.api).getSimilarShows({
|
||||||
|
userId: user.data.Id,
|
||||||
|
itemId: item.data.Id,
|
||||||
|
});
|
||||||
|
} else if (item.data.Type == "MusicAlbum") {
|
||||||
|
result = await getLibraryApi(window.api).getSimilarAlbums({
|
||||||
|
userId: user.data.Id,
|
||||||
|
itemId: item.data.Id,
|
||||||
|
});
|
||||||
|
} else if (item.data.Type == "MusicArtist") {
|
||||||
|
result = await getLibraryApi(window.api).getSimilarArtists({
|
||||||
|
userId: user.data.Id,
|
||||||
|
itemId: item.data.Id,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
result = await getLibraryApi(window.api).getSimilarItems({
|
||||||
|
userId: user.data.Id,
|
||||||
|
itemId: item.data.Id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess,
|
||||||
|
});
|
||||||
|
|
||||||
|
const seasons = useQuery({
|
||||||
|
queryKey: ["item", "seasons", id],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getTvShowsApi(window.api).getSeasons({
|
||||||
|
seriesId: item.data.Id,
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (item.isLoading || similarItems.isLoading) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -75,7 +129,7 @@ const ItemMovie = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && similarItems.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box className="item-detail-backdrop">
|
<Box className="item-detail-backdrop">
|
||||||
@@ -107,10 +161,10 @@ const ItemMovie = () => {
|
|||||||
pb: 3,
|
pb: 3,
|
||||||
position: "relative",
|
position: "relative",
|
||||||
flexFlow: "column",
|
flexFlow: "column",
|
||||||
gap: 5,
|
gap: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box className="item-detail-header">
|
<Box className="item-detail-header" mb={5}>
|
||||||
<Box className="item-detail-header-backdrop">
|
<Box className="item-detail-header-backdrop">
|
||||||
{item.data.BackdropImageTags.length != 0 && (
|
{item.data.BackdropImageTags.length != 0 && (
|
||||||
<img
|
<img
|
||||||
@@ -157,7 +211,14 @@ const ItemMovie = () => {
|
|||||||
{TypeIconCollectionCard[item.data.Type]}
|
{TypeIconCollectionCard[item.data.Type]}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className="item-detail-image-container">
|
<Box
|
||||||
|
className="item-detail-image-container"
|
||||||
|
sx={
|
||||||
|
item.data.Type.includes("Music") && {
|
||||||
|
aspectRatio: "1",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
{!!item.data.ImageTags.Primary && (
|
{!!item.data.ImageTags.Primary && (
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
@@ -244,12 +305,14 @@ const ItemMovie = () => {
|
|||||||
}
|
}
|
||||||
ex={{ alignItems: "center" }}
|
ex={{ alignItems: "center" }}
|
||||||
>
|
>
|
||||||
|
{item.data.ProductionYear && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{ flexGrow: 0 }}
|
sx={{ flexGrow: 0 }}
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
>
|
>
|
||||||
{item.data.ProductionYear}
|
{item.data.ProductionYear}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
<Chip
|
<Chip
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label={
|
label={
|
||||||
@@ -284,22 +347,28 @@ const ItemMovie = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
{!!item.data.RunTimeTicks && (
|
||||||
<Typography variant="subtitle1">
|
<Typography variant="subtitle1">
|
||||||
{getRuntimeFull(
|
{getRuntimeFull(
|
||||||
item.data.RunTimeTicks,
|
item.data.RunTimeTicks,
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
{item.data.Genres != 0 && (
|
||||||
<Box className="item-media-container">
|
<Box className="item-media-container">
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={1}
|
gap={1}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
<Typography variant="h5">Genre</Typography>
|
<Typography variant="h5">
|
||||||
{item.data.Genres.map((genre, index) => {
|
Genre
|
||||||
|
</Typography>
|
||||||
|
{item.data.Genres.map(
|
||||||
|
(genre, index) => {
|
||||||
return (
|
return (
|
||||||
<Chip
|
<Chip
|
||||||
key={index}
|
key={index}
|
||||||
@@ -307,13 +376,23 @@ const ItemMovie = () => {
|
|||||||
label={genre}
|
label={genre}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
},
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography variant="body1">
|
)}
|
||||||
|
<Typography variant="body1" mt={3} mb={5}>
|
||||||
{item.data.Overview}
|
{item.data.Overview}
|
||||||
</Typography>
|
</Typography>
|
||||||
<CardScroller displayCards={8} title="Cast">
|
{item.data.People.length != 0 && (
|
||||||
|
<CardScroller
|
||||||
|
headingProps={{
|
||||||
|
variant: "h5",
|
||||||
|
fontSize: "1.8em",
|
||||||
|
}}
|
||||||
|
displayCards={8}
|
||||||
|
title="Cast"
|
||||||
|
>
|
||||||
{item.data.People.map((person, index) => {
|
{item.data.People.map((person, index) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@@ -332,13 +411,112 @@ const ItemMovie = () => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
|
)}
|
||||||
|
{seasons.isSuccess && (
|
||||||
|
<Box>
|
||||||
|
<Tabs value={0}>
|
||||||
|
{seasons.data.Items.map(
|
||||||
|
(season, index) => {
|
||||||
|
return (
|
||||||
|
<Tab
|
||||||
|
label={season.Name}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Tabs>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
{similarItems.data.Items.length != 0 && (
|
||||||
|
<CardScroller
|
||||||
|
headingProps={{
|
||||||
|
variant: "h5",
|
||||||
|
fontSize: "1.8em",
|
||||||
|
}}
|
||||||
|
displayCards={8}
|
||||||
|
title={`More Like This`}
|
||||||
|
>
|
||||||
|
{similarItems.data.Items.map(
|
||||||
|
(simItem, index) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={index}
|
||||||
|
itemName={simItem.Name}
|
||||||
|
itemId={simItem.Id}
|
||||||
|
// imageTags={false}
|
||||||
|
imageTags={
|
||||||
|
!!simItem.ImageTags
|
||||||
|
.Primary
|
||||||
|
}
|
||||||
|
iconType={simItem.Type}
|
||||||
|
subText={
|
||||||
|
simItem.ProductionYear
|
||||||
|
}
|
||||||
|
playedPercent={
|
||||||
|
!!simItem.UserData
|
||||||
|
? simItem
|
||||||
|
.UserData
|
||||||
|
.PlayedPercentage
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
cardOrientation={
|
||||||
|
simItem.Type ==
|
||||||
|
"MusicArtist" ||
|
||||||
|
simItem.Type ==
|
||||||
|
"MusicAlbum" ||
|
||||||
|
simItem.Type ==
|
||||||
|
"MusicGenre" ||
|
||||||
|
simItem.Type ==
|
||||||
|
"Playlist"
|
||||||
|
? "square"
|
||||||
|
: "portait"
|
||||||
|
}
|
||||||
|
currentUser={user.data}
|
||||||
|
blurhash={
|
||||||
|
simItem.ImageBlurHashes ==
|
||||||
|
{}
|
||||||
|
? ""
|
||||||
|
: !!simItem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
? !!simItem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary
|
||||||
|
? simItem
|
||||||
|
.ImageBlurHashes
|
||||||
|
.Primary[
|
||||||
|
simItem
|
||||||
|
.ImageTags
|
||||||
|
.Primary
|
||||||
|
]
|
||||||
|
: ""
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
watchedStatus={
|
||||||
|
!!simItem.UserData
|
||||||
|
? simItem
|
||||||
|
.UserData
|
||||||
|
.Played
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
watchedCount={
|
||||||
|
!!simItem.UserData &&
|
||||||
|
simItem.UserData
|
||||||
|
.UnplayedItemCount
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isError) {
|
if (item.isError || similarItems.isError) {
|
||||||
return <h1>{"Something went wrong :("}</h1>;
|
return <h1>{"Something went wrong :("}</h1>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ItemMovie;
|
export default ItemDetail;
|
||||||
@@ -827,7 +827,7 @@ const LibraryView = () => {
|
|||||||
currentUser={user.data}
|
currentUser={user.data}
|
||||||
onClickEvent={() => {
|
onClickEvent={() => {
|
||||||
navigate(
|
navigate(
|
||||||
`/item/${item.Type}/${item.Id}`,
|
`/item/${item.Id}`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
></Card>
|
></Card>
|
||||||
|
|||||||
Reference in new issue
Block a user