Update itemDetail page and fix few stuff #26
This commit is contained in:
13 files changed
+735
-55
No files matched your search
Generated
+21
@@ -29,6 +29,7 @@
|
|||||||
"react-blurhash": "^0.3.0",
|
"react-blurhash": "^0.3.0",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-konami-code": "^2.3.0",
|
||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.3",
|
"react-multi-carousel": "^2.8.3",
|
||||||
"react-parallax": "^3.5.1",
|
"react-parallax": "^3.5.1",
|
||||||
@@ -2867,6 +2868,18 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
||||||
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-konami-code": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-konami-code/-/react-konami-code-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-9x90HnzstiMXs2kFS9cYsb5a+ojKEB/iC24uzNKCoE9znorLJwUcy98tjsiW2i5AHB05GuqIMTzV5RaDpVSThw==",
|
||||||
|
"dependencies": {
|
||||||
|
"prop-types": "^15.8.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">= 16.8.0",
|
||||||
|
"react-dom": ">= 16.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-material-ui-carousel": {
|
"node_modules/react-material-ui-carousel": {
|
||||||
"version": "3.4.2",
|
"version": "3.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-material-ui-carousel/-/react-material-ui-carousel-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-material-ui-carousel/-/react-material-ui-carousel-3.4.2.tgz",
|
||||||
@@ -5121,6 +5134,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
||||||
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
||||||
},
|
},
|
||||||
|
"react-konami-code": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-konami-code/-/react-konami-code-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-9x90HnzstiMXs2kFS9cYsb5a+ojKEB/iC24uzNKCoE9znorLJwUcy98tjsiW2i5AHB05GuqIMTzV5RaDpVSThw==",
|
||||||
|
"requires": {
|
||||||
|
"prop-types": "^15.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-material-ui-carousel": {
|
"react-material-ui-carousel": {
|
||||||
"version": "3.4.2",
|
"version": "3.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-material-ui-carousel/-/react-material-ui-carousel-3.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-material-ui-carousel/-/react-material-ui-carousel-3.4.2.tgz",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"react-blurhash": "^0.3.0",
|
"react-blurhash": "^0.3.0",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-konami-code": "^2.3.0",
|
||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.3",
|
"react-multi-carousel": "^2.8.3",
|
||||||
"react-parallax": "^3.5.1",
|
"react-parallax": "^3.5.1",
|
||||||
|
|||||||
+22
@@ -1,6 +1,9 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
|
import Konami from "react-konami-code";
|
||||||
|
|
||||||
import { ThemeProvider } from "@mui/material/styles";
|
import { ThemeProvider } from "@mui/material/styles";
|
||||||
import { SnackbarProvider } from "notistack";
|
import { SnackbarProvider } from "notistack";
|
||||||
import {
|
import {
|
||||||
@@ -267,6 +270,10 @@ function App() {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const [easterEgg, setEasterEgg] = useState(false);
|
||||||
|
const sixtyNine = () => {
|
||||||
|
setEasterEgg(true);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
@@ -284,6 +291,21 @@ function App() {
|
|||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Konami resetDelay={1000} action={sixtyNine}></Konami>
|
||||||
|
<Dialog
|
||||||
|
open={easterEgg}
|
||||||
|
onClose={() => setEasterEgg(false)}
|
||||||
|
>
|
||||||
|
<iframe
|
||||||
|
width="560"
|
||||||
|
height="315"
|
||||||
|
src="https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&autoplay=1"
|
||||||
|
title="EasterEgg"
|
||||||
|
frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
></iframe>
|
||||||
|
</Dialog>
|
||||||
{/* Show Dialog if server not reachable */}
|
{/* Show Dialog if server not reachable */}
|
||||||
<Dialog
|
<Dialog
|
||||||
open={!serverReachable}
|
open={!serverReachable}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export const AppBar = () => {
|
|||||||
let usr = await getUserApi(window.api).getCurrentUser();
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
return usr.data;
|
return usr.data;
|
||||||
},
|
},
|
||||||
|
enabled: visible,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const trigger = useScrollTrigger({
|
const trigger = useScrollTrigger({
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import MuiCard from "@mui/material/Card";
|
import MuiCard from "@mui/material/Card";
|
||||||
import CardContent from "@mui/material/CardContent";
|
import CardContent from "@mui/material/CardContent";
|
||||||
@@ -46,6 +48,7 @@ export const Card = ({
|
|||||||
currentUser,
|
currentUser,
|
||||||
favourite,
|
favourite,
|
||||||
}) => {
|
}) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [imgLoading, setImgLoading] = useState(true);
|
const [imgLoading, setImgLoading] = useState(true);
|
||||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||||
@@ -132,7 +135,13 @@ export const Card = ({
|
|||||||
{...cardProps}
|
{...cardProps}
|
||||||
>
|
>
|
||||||
<CardActionArea
|
<CardActionArea
|
||||||
onClick={!!onClickEvent ? onClickEvent : () => {}}
|
onClick={
|
||||||
|
!!onClickEvent
|
||||||
|
? onClickEvent
|
||||||
|
: () => {
|
||||||
|
navigate(`/item/${itemId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
className="card-media-container"
|
className="card-media-container"
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export const SideMenu = ({}) => {
|
|||||||
return usr.data;
|
return usr.data;
|
||||||
},
|
},
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
let libraries = useQuery({
|
let libraries = useQuery({
|
||||||
queryKey: ["libraries"],
|
queryKey: ["libraries"],
|
||||||
@@ -81,6 +82,7 @@ export const SideMenu = ({}) => {
|
|||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
const handleDrawerOpen = () => {};
|
const handleDrawerOpen = () => {};
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -133,7 +135,6 @@ export const SideMenu = ({}) => {
|
|||||||
background: backdrop
|
background: backdrop
|
||||||
? theme.palette.background.paper
|
? theme.palette.background.paper
|
||||||
: "transparent",
|
: "transparent",
|
||||||
borderLeft: "1px solid white",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DrawerHeader
|
<DrawerHeader
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ 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 () => {
|
||||||
@@ -67,6 +69,7 @@ const Home = () => {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useQuery({
|
||||||
@@ -75,6 +78,7 @@ const Home = () => {
|
|||||||
let usr = await getUserApi(window.api).getCurrentUser();
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
return usr.data;
|
return usr.data;
|
||||||
},
|
},
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const libraries = useQuery({
|
const libraries = useQuery({
|
||||||
@@ -86,6 +90,7 @@ const Home = () => {
|
|||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const latestMedia = useQuery({
|
const latestMedia = useQuery({
|
||||||
@@ -101,6 +106,7 @@ const Home = () => {
|
|||||||
return media.data;
|
return media.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeItemsVideo = useQuery({
|
const resumeItemsVideo = useQuery({
|
||||||
@@ -117,6 +123,7 @@ const Home = () => {
|
|||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeItemsAudio = useQuery({
|
const resumeItemsAudio = useQuery({
|
||||||
@@ -133,6 +140,7 @@ const Home = () => {
|
|||||||
return resumeItems.data;
|
return resumeItems.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const upNextItems = useQuery({
|
const upNextItems = useQuery({
|
||||||
@@ -145,6 +153,7 @@ const Home = () => {
|
|||||||
return upNext.data;
|
return upNext.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||||
@@ -188,6 +197,11 @@ const Home = () => {
|
|||||||
dispatch(showAppBar());
|
dispatch(showAppBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.isPaused) {
|
||||||
|
user.refetch();
|
||||||
|
console.log(user.isError);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
@@ -451,7 +465,11 @@ const Home = () => {
|
|||||||
endIcon={
|
endIcon={
|
||||||
<MdiChevronRight />
|
<MdiChevronRight />
|
||||||
}
|
}
|
||||||
disabled
|
onClick={() =>
|
||||||
|
navigate(
|
||||||
|
`/item/${item.Id}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
More info
|
More info
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -16,18 +16,23 @@
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex-wrap: wrap;
|
||||||
&-backdrop {
|
&-backdrop {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 150%;
|
height: 135%;
|
||||||
top: -88px;
|
top: -88px;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: -24px;
|
left: -24px;
|
||||||
z-index: -1;
|
z-index: -2;
|
||||||
filter: brightness(0.5);
|
filter: brightness(0.7);
|
||||||
mask-image: linear-gradient(0deg, transparent, black);
|
mask-image: linear-gradient(0deg, transparent, black 75%);
|
||||||
-webkit-mask-image: linear-gradient(0deg, transparent, black);
|
-webkit-mask-image: linear-gradient(
|
||||||
|
0deg,
|
||||||
|
transparent,
|
||||||
|
black 75%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-image {
|
&-image {
|
||||||
@@ -41,6 +46,7 @@
|
|||||||
}
|
}
|
||||||
&-container {
|
&-container {
|
||||||
width: 15%;
|
width: 15%;
|
||||||
|
flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
aspect-ratio: 0.666;
|
aspect-ratio: 0.666;
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
@@ -60,4 +66,7 @@
|
|||||||
z-index: -2;
|
z-index: -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&-title-logo {
|
||||||
|
max-width: 75%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+584
-27
@@ -1,5 +1,6 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -10,16 +11,19 @@ import Divider from "@mui/material/Divider";
|
|||||||
import LinearProgress from "@mui/material/LinearProgress";
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
import Tabs from "@mui/material/Tabs";
|
import Tabs from "@mui/material/Tabs";
|
||||||
import Tab from "@mui/material/Tab";
|
import Tab from "@mui/material/Tab";
|
||||||
|
import Grid2 from "@mui/material/Unstable_Grid2";
|
||||||
|
|
||||||
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, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
import { BaseItemKind } 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";
|
||||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||||
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-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";
|
||||||
@@ -31,9 +35,43 @@ import { CardScroller } from "../../components/cardScroller/cardScroller";
|
|||||||
|
|
||||||
import "./item.module.scss";
|
import "./item.module.scss";
|
||||||
|
|
||||||
|
function TabPanel(props) {
|
||||||
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="tabpanel"
|
||||||
|
hidden={value !== index}
|
||||||
|
id={`full-width-tabpanel-${index}`}
|
||||||
|
aria-labelledby={`full-width-tab-${index}`}
|
||||||
|
{...other}
|
||||||
|
>
|
||||||
|
{value === index && (
|
||||||
|
<Box sx={{ p: 3 }}>
|
||||||
|
<Typography>{children}</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TabPanel.propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
|
index: PropTypes.number.isRequired,
|
||||||
|
value: PropTypes.number.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
function a11yProps(index) {
|
||||||
|
return {
|
||||||
|
id: `full-width-tab-${index}`,
|
||||||
|
"aria-controls": `full-width-tabpanel-${index}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const ItemDetail = () => {
|
const ItemDetail = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const navigate = useNavigate();
|
||||||
const [isMovie, setIsMovie] = useState(false);
|
const [isMovie, setIsMovie] = useState(false);
|
||||||
const [isSeries, setIsSeries] = useState(false);
|
const [isSeries, setIsSeries] = useState(false);
|
||||||
const [isMusicItem, setIsMusicItem] = useState(false);
|
const [isMusicItem, setIsMusicItem] = useState(false);
|
||||||
@@ -54,6 +92,7 @@ const ItemDetail = () => {
|
|||||||
let usr = await getUserApi(window.api).getCurrentUser();
|
let usr = await getUserApi(window.api).getCurrentUser();
|
||||||
return usr.data;
|
return usr.data;
|
||||||
},
|
},
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
@@ -66,6 +105,7 @@ const ItemDetail = () => {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
@@ -101,6 +141,7 @@ const ItemDetail = () => {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const seasons = useQuery({
|
const seasons = useQuery({
|
||||||
@@ -111,9 +152,113 @@ const ItemDetail = () => {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess && item.data.Type == "Series",
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [currentSeason, setCurrentSeason] = useState(0);
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: seasons.isSuccess,
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
|
||||||
|
const personShows = useQuery({
|
||||||
|
queryKey: ["item", "personShows"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getItemsApi(window.api).getItems({
|
||||||
|
userId: user.data.Id,
|
||||||
|
personIds: [id],
|
||||||
|
includeItemTypes: [BaseItemKind.Series],
|
||||||
|
recursive: true,
|
||||||
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
|
sortOrder: ["Descending"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess && item.data.Type == "Person",
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
const personMovies = useQuery({
|
||||||
|
queryKey: ["item", "personMovies"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getItemsApi(window.api).getItems({
|
||||||
|
userId: user.data.Id,
|
||||||
|
personIds: [id],
|
||||||
|
includeItemTypes: [BaseItemKind.Movie],
|
||||||
|
recursive: true,
|
||||||
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
|
sortOrder: ["Descending"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess && item.data.Type == "Person",
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
const personBooks = useQuery({
|
||||||
|
queryKey: ["item", "personBooks"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getItemsApi(window.api).getItems({
|
||||||
|
userId: user.data.Id,
|
||||||
|
personIds: [id],
|
||||||
|
includeItemTypes: [BaseItemKind.Book],
|
||||||
|
recursive: true,
|
||||||
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
|
sortOrder: ["Descending"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
enabled: item.isSuccess && item.data.Type == "Person",
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
|
const personPhotos = useQuery({
|
||||||
|
queryKey: ["item", "personPhotos"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getItemsApi(window.api).getItems({
|
||||||
|
userId: user.data.Id,
|
||||||
|
personIds: [id],
|
||||||
|
includeItemTypes: [BaseItemKind.Photo],
|
||||||
|
recursive: true,
|
||||||
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
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 [activePersonTab, setActivePersonTab] = useState(0);
|
||||||
|
const personTabs = ["Movies", "TV Shows", "Books", "Photos"];
|
||||||
|
|
||||||
if (item.isLoading || similarItems.isLoading) {
|
if (item.isLoading || similarItems.isLoading) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -128,8 +273,7 @@ const ItemDetail = () => {
|
|||||||
<CircularProgress />
|
<CircularProgress />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
} else if (item.isSuccess && similarItems.isSuccess) {
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box className="item-detail-backdrop">
|
<Box className="item-detail-backdrop">
|
||||||
@@ -147,6 +291,7 @@ const ItemDetail = () => {
|
|||||||
style={{
|
style={{
|
||||||
aspectRatio: "0.666",
|
aspectRatio: "0.666",
|
||||||
}}
|
}}
|
||||||
|
punch={1}
|
||||||
className="item-detail-image-blurhash"
|
className="item-detail-image-blurhash"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -164,7 +309,7 @@ const ItemDetail = () => {
|
|||||||
gap: 1,
|
gap: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box className="item-detail-header" mb={5}>
|
<Box className="item-detail-header" mb={0}>
|
||||||
<Box className="item-detail-header-backdrop">
|
<Box className="item-detail-header-backdrop">
|
||||||
{item.data.BackdropImageTags.length != 0 && (
|
{item.data.BackdropImageTags.length != 0 && (
|
||||||
<img
|
<img
|
||||||
@@ -211,12 +356,26 @@ const ItemDetail = () => {
|
|||||||
{TypeIconCollectionCard[item.data.Type]}
|
{TypeIconCollectionCard[item.data.Type]}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
className="item-detail-info-container"
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
gap: 3,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "flex-end",
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
className="item-detail-image-container"
|
className="item-detail-image-container"
|
||||||
sx={
|
sx={
|
||||||
item.data.Type.includes("Music") && {
|
item.data.Type.includes("Music")
|
||||||
|
? {
|
||||||
aspectRatio: "1",
|
aspectRatio: "1",
|
||||||
}
|
}
|
||||||
|
: {}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{!!item.data.ImageTags.Primary && (
|
{!!item.data.ImageTags.Primary && (
|
||||||
@@ -225,7 +384,7 @@ const ItemDetail = () => {
|
|||||||
window.api.basePath +
|
window.api.basePath +
|
||||||
"/Items/" +
|
"/Items/" +
|
||||||
item.data.Id +
|
item.data.Id +
|
||||||
"/Images/Primary"
|
"/Images/Primary?quality=10"
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
opacity: primageImageLoaded
|
opacity: primageImageLoaded
|
||||||
@@ -234,11 +393,14 @@ const ItemDetail = () => {
|
|||||||
}}
|
}}
|
||||||
className="item-detail-image"
|
className="item-detail-image"
|
||||||
onLoad={() =>
|
onLoad={() =>
|
||||||
setPrimaryImageLoaded(true)
|
setPrimaryImageLoaded(
|
||||||
|
true,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!!item.data.ImageBlurHashes.Primary && (
|
{!!item.data.ImageBlurHashes
|
||||||
|
.Primary && (
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes
|
item.data.ImageBlurHashes
|
||||||
@@ -258,16 +420,38 @@ const ItemDetail = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="item-detail-image-icon-container">
|
<div className="item-detail-image-icon-container">
|
||||||
{TypeIconCollectionCard[item.data.Type]}
|
{
|
||||||
|
TypeIconCollectionCard[
|
||||||
|
item.data.Type
|
||||||
|
]
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className="item-detail-info-container">
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
className="item-detail-title-name"
|
className="item-detail-title-name"
|
||||||
sx={{ mb: 2 }}
|
sx={{ mb: 1 }}
|
||||||
>
|
>
|
||||||
<Typography variant="h3">
|
<Typography
|
||||||
{item.data.Name}
|
variant="h3"
|
||||||
|
sx={{ width: "30%" }}
|
||||||
|
textOverflow="ellipsis"
|
||||||
|
whiteSpace="nowrap"
|
||||||
|
>
|
||||||
|
{!!item.data.ImageTags
|
||||||
|
.Logo ? (
|
||||||
|
<img
|
||||||
|
className="item-detail-title-logo"
|
||||||
|
src={`${window.api.basePath}/Items/${item.data.Id}/Images/Logo?quality=80&tag=${item.data.ImageTags.Logo}`}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
item.data.Name
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
{!!item.data.UserData
|
{!!item.data.UserData
|
||||||
.PlayedPercentage && (
|
.PlayedPercentage && (
|
||||||
@@ -303,20 +487,27 @@ const ItemDetail = () => {
|
|||||||
orientation="vertical"
|
orientation="vertical"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
ex={{ alignItems: "center" }}
|
sx={{
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ProductionYear && (
|
{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={
|
||||||
!!item.data.OfficialRating
|
!!item.data
|
||||||
|
.OfficialRating
|
||||||
? item.data
|
? item.data
|
||||||
.OfficialRating
|
.OfficialRating
|
||||||
: "Not Rated"
|
: "Not Rated"
|
||||||
@@ -330,7 +521,8 @@ const ItemDetail = () => {
|
|||||||
}}
|
}}
|
||||||
className="item-detail-info-rating"
|
className="item-detail-info-rating"
|
||||||
>
|
>
|
||||||
{!!item.data.CommunityRating ? (
|
{!!item.data
|
||||||
|
.CommunityRating ? (
|
||||||
<>
|
<>
|
||||||
<MdiStarHalfFull />
|
<MdiStarHalfFull />
|
||||||
<Typography variant="subtitle1">
|
<Typography variant="subtitle1">
|
||||||
@@ -350,13 +542,27 @@ const ItemDetail = () => {
|
|||||||
{!!item.data.RunTimeTicks && (
|
{!!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>
|
||||||
|
<Box
|
||||||
|
className="item-detail-tagline"
|
||||||
|
sx={{ width: "100%" }}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
fontStyle="italic"
|
||||||
|
sx={{ opacity: 0.8 }}
|
||||||
|
>
|
||||||
|
{item.data.Taglines[0]}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
{item.data.Genres != 0 && (
|
{item.data.Genres != 0 && (
|
||||||
<Box className="item-media-container">
|
<Box className="item-media-container">
|
||||||
<Stack
|
<Stack
|
||||||
@@ -381,9 +587,57 @@ const ItemDetail = () => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Typography variant="body1" mt={3} mb={5}>
|
{!!item.data.Overview && (
|
||||||
|
<Box mt={3}>
|
||||||
|
<Typography variant="h5" mb={1}>
|
||||||
|
Overview
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="body1"
|
||||||
|
sx={{ opacity: 0.8 }}
|
||||||
|
mb={5}
|
||||||
|
>
|
||||||
{item.data.Overview}
|
{item.data.Overview}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
{seasons.isSuccess && (
|
||||||
|
<Box>
|
||||||
|
<Tabs
|
||||||
|
variant="scrollable"
|
||||||
|
scrollButtons="auto"
|
||||||
|
value={currentSeason}
|
||||||
|
onChange={(e, newVal) => {
|
||||||
|
setCurrentSeason(newVal);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{seasons.data.Items.map(
|
||||||
|
(season, index) => {
|
||||||
|
return (
|
||||||
|
<Tab
|
||||||
|
label={season.Name}
|
||||||
|
{...a11yProps(
|
||||||
|
index,
|
||||||
|
)}
|
||||||
|
key={index}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Tabs>
|
||||||
|
{seasons.data.Items.map((season, index) => {
|
||||||
|
return (
|
||||||
|
<TabPanel
|
||||||
|
value={currentSeason}
|
||||||
|
index={index}
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
Item {index}
|
||||||
|
</TabPanel>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
{item.data.People.length != 0 && (
|
{item.data.People.length != 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
headingProps={{
|
headingProps={{
|
||||||
@@ -412,21 +666,320 @@ const ItemDetail = () => {
|
|||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{seasons.isSuccess && (
|
|
||||||
|
{item.data.Type == "Person" &&
|
||||||
|
personShows.isSuccess &&
|
||||||
|
personMovies.isSuccess &&
|
||||||
|
personBooks.isSuccess &&
|
||||||
|
personPhotos.isSuccess && (
|
||||||
<Box>
|
<Box>
|
||||||
<Tabs value={0}>
|
<Box
|
||||||
{seasons.data.Items.map(
|
sx={{
|
||||||
(season, index) => {
|
borderBottom: 1,
|
||||||
|
borderColor: "divider",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tabs
|
||||||
|
value={activePersonTab}
|
||||||
|
onChange={(e, newVal) =>
|
||||||
|
setActivePersonTab(
|
||||||
|
newVal,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
aria-label="person-tabs"
|
||||||
|
>
|
||||||
|
{personTabs.map(
|
||||||
|
(pitem, index) => {
|
||||||
return (
|
return (
|
||||||
<Tab
|
<Tab
|
||||||
label={season.Name}
|
label={
|
||||||
|
pitem
|
||||||
|
}
|
||||||
|
{...a11yProps(
|
||||||
|
index,
|
||||||
|
)}
|
||||||
|
disabled={
|
||||||
|
(pitem ==
|
||||||
|
"Movies" &&
|
||||||
|
personMovies
|
||||||
|
.data
|
||||||
|
.Items
|
||||||
|
.length ==
|
||||||
|
0) ||
|
||||||
|
(pitem ==
|
||||||
|
"TV Shows" &&
|
||||||
|
personShows
|
||||||
|
.data
|
||||||
|
.Items
|
||||||
|
.length ==
|
||||||
|
0) ||
|
||||||
|
(pitem ==
|
||||||
|
"Books" &&
|
||||||
|
personBooks
|
||||||
|
.data
|
||||||
|
.Items
|
||||||
|
.length ==
|
||||||
|
0) ||
|
||||||
|
(pitem ==
|
||||||
|
"Photos" &&
|
||||||
|
personPhotos
|
||||||
|
.data
|
||||||
|
.Items
|
||||||
|
.length ==
|
||||||
|
0)
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
key={
|
||||||
|
index
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
{personTabs.map((pitem, index) => {
|
||||||
|
return (
|
||||||
|
<TabPanel
|
||||||
|
value={activePersonTab}
|
||||||
|
index={index}
|
||||||
|
key={index}
|
||||||
|
>
|
||||||
|
{pitem == "Movies" && (
|
||||||
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 2,
|
||||||
|
sm: 4,
|
||||||
|
md: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{personMovies.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 == "TV Shows" && (
|
||||||
|
<Grid2
|
||||||
|
container
|
||||||
|
columns={{
|
||||||
|
xs: 4,
|
||||||
|
sm: 6,
|
||||||
|
md: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{personShows.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>
|
||||||
|
)}
|
||||||
|
</TabPanel>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
{similarItems.data.Items.length != 0 && (
|
{similarItems.data.Items.length != 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
headingProps={{
|
headingProps={{
|
||||||
@@ -504,6 +1057,11 @@ const ItemDetail = () => {
|
|||||||
simItem.UserData
|
simItem.UserData
|
||||||
.UnplayedItemCount
|
.UnplayedItemCount
|
||||||
}
|
}
|
||||||
|
onClickEvent={() => {
|
||||||
|
navigate(
|
||||||
|
`/item/${simItem.Id}`,
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -513,8 +1071,7 @@ const ItemDetail = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
} else if (item.isError || similarItems.isError) {
|
||||||
if (item.isError || similarItems.isError) {
|
|
||||||
return <h1>{"Something went wrong :("}</h1>;
|
return <h1>{"Something went wrong :("}</h1>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ const LibraryView = () => {
|
|||||||
],
|
],
|
||||||
queryFn: () => fetchLibItems(id),
|
queryFn: () => fetchLibItems(id),
|
||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCurrentViewType = (e) => {
|
const handleCurrentViewType = (e) => {
|
||||||
@@ -754,7 +755,7 @@ const LibraryView = () => {
|
|||||||
) : (
|
) : (
|
||||||
<Grid2
|
<Grid2
|
||||||
container
|
container
|
||||||
columns={{ xs: 3, sm: 5, md: 8 }}
|
columns={{ xs: 2, sm: 4, md: 8 }}
|
||||||
>
|
>
|
||||||
{items.data.Items.map((item, index) => {
|
{items.data.Items.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
+53
-17
@@ -5,6 +5,9 @@ import { useQuery } from "@tanstack/react-query";
|
|||||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||||
|
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { showSidemenu } from "../../utils/slice/sidemenu.js";
|
||||||
|
|
||||||
import { getServer } from "../../utils/storage/servers.js";
|
import { getServer } from "../../utils/storage/servers.js";
|
||||||
import { saveUser } from "../../utils/storage/user.js";
|
import { saveUser } from "../../utils/storage/user.js";
|
||||||
|
|
||||||
@@ -23,6 +26,8 @@ import InputLabel from "@mui/material/InputLabel";
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import FormGroup from "@mui/material/FormGroup";
|
import FormGroup from "@mui/material/FormGroup";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
@@ -42,6 +47,7 @@ import "./login.module.scss";
|
|||||||
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
||||||
|
|
||||||
export const LoginWithImage = () => {
|
export const LoginWithImage = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const { userName, userId } = useParams();
|
const { userName, userId } = useParams();
|
||||||
|
|
||||||
const [password, setPassword] = useState({
|
const [password, setPassword] = useState({
|
||||||
@@ -91,6 +97,7 @@ export const LoginWithImage = () => {
|
|||||||
}
|
}
|
||||||
event.emit("set-api-accessToken", window.api.basePath);
|
event.emit("set-api-accessToken", window.api.basePath);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
dispatch(showSidemenu());
|
||||||
navigate(`/home`);
|
navigate(`/home`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,7 +108,15 @@ export const LoginWithImage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBarBackOnly />
|
<AppBarBackOnly />
|
||||||
<Container maxWidth="xs" className="centered">
|
<Container
|
||||||
|
maxWidth="xs"
|
||||||
|
sx={{
|
||||||
|
height: "100vh",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
direction="column"
|
direction="column"
|
||||||
@@ -222,47 +237,52 @@ export const UserLogin = () => {
|
|||||||
queryKey: ["login", "users"],
|
queryKey: ["login", "users"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const users = await getUserApi(window.api).getPublicUsers();
|
const users = await getUserApi(window.api).getPublicUsers();
|
||||||
// console.log(users.data);
|
console.log(users.data);
|
||||||
return users.data;
|
return users.data;
|
||||||
// return {};
|
// return {};
|
||||||
},
|
},
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBarBackOnly />
|
<AppBarBackOnly />
|
||||||
<Container maxWidth="md" className="centered">
|
<Container
|
||||||
|
maxWidth="md"
|
||||||
|
sx={{
|
||||||
|
height: "100vh",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||||
Users
|
Users
|
||||||
</Typography> */}
|
</Typography> */}
|
||||||
{users.isLoading ? (
|
{users.isLoading ? (
|
||||||
<CardsSkeleton />
|
<CardsSkeleton />
|
||||||
) : (
|
) : (
|
||||||
<CardScroller displayCards={5} title="Users">
|
<Grid container direction="row">
|
||||||
{users.data.map((item, index) => {
|
{users.data.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
//
|
|
||||||
<Link
|
|
||||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
|
||||||
key={item.Id}
|
|
||||||
className="userCard"
|
|
||||||
index={index}
|
|
||||||
>
|
|
||||||
<Card
|
<Card
|
||||||
key={index}
|
key={index}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
imageTags={
|
imageTags={!!item.PrimaryImageTag}
|
||||||
!!item.PrimaryImageTag
|
|
||||||
}
|
|
||||||
// cardType="sqaure"
|
// cardType="sqaure"
|
||||||
iconType="Person"
|
iconType="Person"
|
||||||
cardOrientation="sqaure"
|
cardOrientation="sqaure"
|
||||||
|
onClickEvent={navigate(
|
||||||
|
`/login/withImg/${item.Name}/${item.Id}/`,
|
||||||
|
)}
|
||||||
|
cardProps={{
|
||||||
|
sx: { width: "33%" },
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Link>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
<div className="buttons">
|
<div className="buttons">
|
||||||
<Button
|
<Button
|
||||||
@@ -290,6 +310,7 @@ export const UserLoginManual = () => {
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [rememberMe, setRememberMe] = useState(true);
|
const [rememberMe, setRememberMe] = useState(true);
|
||||||
|
|
||||||
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
@@ -307,6 +328,7 @@ export const UserLoginManual = () => {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !window.api,
|
enabled: !window.api,
|
||||||
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleUsername = (event) => {
|
const handleUsername = (event) => {
|
||||||
@@ -353,6 +375,7 @@ export const UserLoginManual = () => {
|
|||||||
event.emit("set-api-accessToken", window.api.basePath);
|
event.emit("set-api-accessToken", window.api.basePath);
|
||||||
// setAccessToken(user.data.AccessToken)
|
// setAccessToken(user.data.AccessToken)
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
dispatch(showSidemenu());
|
||||||
navigate(`/home`);
|
navigate(`/home`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -362,14 +385,27 @@ export const UserLoginManual = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{server.isLoading && <LinearProgress />}
|
||||||
<AppBarBackOnly />
|
<AppBarBackOnly />
|
||||||
<Container maxWidth="xs" className="centered">
|
<Container
|
||||||
|
maxWidth="xs"
|
||||||
|
sx={{
|
||||||
|
height: "100vh",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
spacing={2}
|
spacing={2}
|
||||||
direction="column"
|
direction="column"
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
sx={{
|
||||||
|
opacity: server.isLoading ? 0 : 1,
|
||||||
|
transition: "opacity 200ms",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||||
<Typography variant="h3" color="textPrimary">
|
<Typography variant="h3" color="textPrimary">
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Cookies, useCookies } from "react-cookie";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@ import "./server.module.scss";
|
|||||||
export const ServerList = () => {
|
export const ServerList = () => {
|
||||||
const [renderServerList, setRenderServerList] = useState(false);
|
const [renderServerList, setRenderServerList] = useState(false);
|
||||||
const [serverListRender, setServerListRender] = useState([]);
|
const [serverListRender, setServerListRender] = useState([]);
|
||||||
const cookies = new Cookies();
|
|
||||||
|
|
||||||
const currentServer = cookies.get("currentServer");
|
const currentServer = cookies.get("currentServer");
|
||||||
const serverList = cookies.get("servers");
|
const serverList = cookies.get("servers");
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ body {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow-y: visible;
|
overflow-y: visible;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
min-height: 100vh;
|
||||||
|
// display: flex;
|
||||||
|
// flex-direction: column;
|
||||||
|
// justify-content: center;
|
||||||
|
// align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.centered {
|
.centered {
|
||||||
|
|||||||
Reference in new issue
Block a user