Update itemDetail page and fix few stuff #26
This commit is contained in:
13 files changed
+875
-195
No files matched your search
+22
@@ -1,6 +1,9 @@
|
||||
/** @format */
|
||||
|
||||
import React, { useState } from "react";
|
||||
|
||||
import Konami from "react-konami-code";
|
||||
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import {
|
||||
@@ -267,6 +270,10 @@ function App() {
|
||||
}),
|
||||
);
|
||||
}
|
||||
const [easterEgg, setEasterEgg] = useState(false);
|
||||
const sixtyNine = () => {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
@@ -284,6 +291,21 @@ function App() {
|
||||
<CircularProgress />
|
||||
</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 */}
|
||||
<Dialog
|
||||
open={!serverReachable}
|
||||
|
||||
@@ -42,6 +42,8 @@ export const AppBar = () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: visible,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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";
|
||||
@@ -46,6 +48,7 @@ export const Card = ({
|
||||
currentUser,
|
||||
favourite,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const [imgLoading, setImgLoading] = useState(true);
|
||||
const [isWatched, setIsWatched] = useState(watchedStatus);
|
||||
const [isFavourite, setIsFavourite] = useState(favourite);
|
||||
@@ -132,7 +135,13 @@ export const Card = ({
|
||||
{...cardProps}
|
||||
>
|
||||
<CardActionArea
|
||||
onClick={!!onClickEvent ? onClickEvent : () => {}}
|
||||
onClick={
|
||||
!!onClickEvent
|
||||
? onClickEvent
|
||||
: () => {
|
||||
navigate(`/item/${itemId}`);
|
||||
}
|
||||
}
|
||||
>
|
||||
<Box
|
||||
className="card-media-container"
|
||||
|
||||
@@ -71,6 +71,7 @@ export const SideMenu = ({}) => {
|
||||
return usr.data;
|
||||
},
|
||||
enabled: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
@@ -81,6 +82,7 @@ export const SideMenu = ({}) => {
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
const dispatch = useDispatch();
|
||||
@@ -133,7 +135,6 @@ export const SideMenu = ({}) => {
|
||||
background: backdrop
|
||||
? theme.palette.background.paper
|
||||
: "transparent",
|
||||
borderLeft: "1px solid white",
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
|
||||
@@ -52,6 +52,8 @@ 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 () => {
|
||||
@@ -67,6 +69,7 @@ const Home = () => {
|
||||
return true;
|
||||
},
|
||||
enabled: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const user = useQuery({
|
||||
@@ -75,6 +78,7 @@ const Home = () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const libraries = useQuery({
|
||||
@@ -86,6 +90,7 @@ const Home = () => {
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const latestMedia = useQuery({
|
||||
@@ -101,6 +106,7 @@ const Home = () => {
|
||||
return media.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
@@ -117,6 +123,7 @@ const Home = () => {
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const resumeItemsAudio = useQuery({
|
||||
@@ -133,6 +140,7 @@ const Home = () => {
|
||||
return resumeItems.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const upNextItems = useQuery({
|
||||
@@ -145,6 +153,7 @@ const Home = () => {
|
||||
return upNext.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||
@@ -188,6 +197,11 @@ const Home = () => {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
|
||||
if (user.isPaused) {
|
||||
user.refetch();
|
||||
console.log(user.isError);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -451,7 +465,11 @@ const Home = () => {
|
||||
endIcon={
|
||||
<MdiChevronRight />
|
||||
}
|
||||
disabled
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/item/${item.Id}`,
|
||||
)
|
||||
}
|
||||
>
|
||||
More info
|
||||
</Button>
|
||||
|
||||
@@ -16,18 +16,23 @@
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
flex-wrap: wrap;
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 150%;
|
||||
height: 135%;
|
||||
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);
|
||||
z-index: -2;
|
||||
filter: brightness(0.7);
|
||||
mask-image: linear-gradient(0deg, transparent, black 75%);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
0deg,
|
||||
transparent,
|
||||
black 75%
|
||||
);
|
||||
}
|
||||
}
|
||||
&-image {
|
||||
@@ -41,6 +46,7 @@
|
||||
}
|
||||
&-container {
|
||||
width: 15%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
aspect-ratio: 0.666;
|
||||
border-radius: $border-radius-default;
|
||||
@@ -60,4 +66,7 @@
|
||||
z-index: -2;
|
||||
}
|
||||
}
|
||||
&-title-logo {
|
||||
max-width: 75%;
|
||||
}
|
||||
}
|
||||
+716
-159
@@ -1,5 +1,6 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
@@ -10,16 +11,19 @@ import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Grid2 from "@mui/material/Unstable_Grid2";
|
||||
|
||||
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 { 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 { 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 { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
|
||||
@@ -31,9 +35,43 @@ import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
|
||||
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 { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const [isMovie, setIsMovie] = useState(false);
|
||||
const [isSeries, setIsSeries] = useState(false);
|
||||
const [isMusicItem, setIsMusicItem] = useState(false);
|
||||
@@ -54,6 +92,7 @@ const ItemDetail = () => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const item = useQuery({
|
||||
@@ -66,6 +105,7 @@ const ItemDetail = () => {
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const similarItems = useQuery({
|
||||
@@ -101,6 +141,7 @@ const ItemDetail = () => {
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const seasons = useQuery({
|
||||
@@ -111,9 +152,113 @@ const ItemDetail = () => {
|
||||
});
|
||||
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) {
|
||||
return (
|
||||
<Box
|
||||
@@ -128,8 +273,7 @@ const ItemDetail = () => {
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && similarItems.isSuccess) {
|
||||
} else if (item.isSuccess && similarItems.isSuccess) {
|
||||
return (
|
||||
<>
|
||||
<Box className="item-detail-backdrop">
|
||||
@@ -147,6 +291,7 @@ const ItemDetail = () => {
|
||||
style={{
|
||||
aspectRatio: "0.666",
|
||||
}}
|
||||
punch={1}
|
||||
className="item-detail-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
@@ -164,7 +309,7 @@ const ItemDetail = () => {
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header" mb={5}>
|
||||
<Box className="item-detail-header" mb={0}>
|
||||
<Box className="item-detail-header-backdrop">
|
||||
{item.data.BackdropImageTags.length != 0 && (
|
||||
<img
|
||||
@@ -211,150 +356,211 @@ const ItemDetail = () => {
|
||||
{TypeIconCollectionCard[item.data.Type]}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
className="item-detail-image-container"
|
||||
sx={
|
||||
item.data.Type.includes("Music") && {
|
||||
aspectRatio: "1",
|
||||
}
|
||||
}
|
||||
className="item-detail-info-container"
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: 3,
|
||||
flexDirection: "row",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "flex-start",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{!!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
|
||||
<Box
|
||||
className="item-detail-image-container"
|
||||
sx={
|
||||
item.data.Type.includes("Music")
|
||||
? {
|
||||
aspectRatio: "1",
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
{!!item.data.ImageTags.Primary && (
|
||||
<img
|
||||
src={
|
||||
window.api.basePath +
|
||||
"/Items/" +
|
||||
item.data.Id +
|
||||
"/Images/Primary?quality=10"
|
||||
}
|
||||
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
|
||||
]
|
||||
}
|
||||
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>
|
||||
</div>
|
||||
</Box>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
divider={
|
||||
<Divider
|
||||
variant="middle"
|
||||
flexItem
|
||||
orientation="vertical"
|
||||
/>
|
||||
}
|
||||
ex={{ alignItems: "center" }}
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
}}
|
||||
>
|
||||
{item.data.ProductionYear && (
|
||||
<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"
|
||||
className="item-detail-title-name"
|
||||
sx={{ mb: 1 }}
|
||||
>
|
||||
{!!item.data.CommunityRating ? (
|
||||
<>
|
||||
<MdiStarHalfFull />
|
||||
<Typography variant="subtitle1">
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="subtitle1">
|
||||
No Community Rating
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
{!!item.data.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data.RunTimeTicks,
|
||||
<Typography
|
||||
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>
|
||||
)}
|
||||
</Stack>
|
||||
{!!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"
|
||||
/>
|
||||
}
|
||||
sx={{
|
||||
alignItems: "center",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{item.data.ProductionYear && (
|
||||
<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>
|
||||
{!!item.data.RunTimeTicks && (
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeFull(
|
||||
item.data
|
||||
.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
</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 && (
|
||||
@@ -381,9 +587,57 @@ const ItemDetail = () => {
|
||||
</Stack>
|
||||
</Box>
|
||||
)}
|
||||
<Typography variant="body1" mt={3} mb={5}>
|
||||
{item.data.Overview}
|
||||
</Typography>
|
||||
{!!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}
|
||||
</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 && (
|
||||
<CardScroller
|
||||
headingProps={{
|
||||
@@ -412,21 +666,320 @@ const ItemDetail = () => {
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{seasons.isSuccess && (
|
||||
<Box>
|
||||
<Tabs value={0}>
|
||||
{seasons.data.Items.map(
|
||||
(season, index) => {
|
||||
return (
|
||||
<Tab
|
||||
label={season.Name}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Tabs>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{item.data.Type == "Person" &&
|
||||
personShows.isSuccess &&
|
||||
personMovies.isSuccess &&
|
||||
personBooks.isSuccess &&
|
||||
personPhotos.isSuccess && (
|
||||
<Box>
|
||||
<Box
|
||||
sx={{
|
||||
borderBottom: 1,
|
||||
borderColor: "divider",
|
||||
}}
|
||||
>
|
||||
<Tabs
|
||||
value={activePersonTab}
|
||||
onChange={(e, newVal) =>
|
||||
setActivePersonTab(
|
||||
newVal,
|
||||
)
|
||||
}
|
||||
aria-label="person-tabs"
|
||||
>
|
||||
{personTabs.map(
|
||||
(pitem, index) => {
|
||||
return (
|
||||
<Tab
|
||||
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>
|
||||
</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 && (
|
||||
<CardScroller
|
||||
headingProps={{
|
||||
@@ -504,6 +1057,11 @@ const ItemDetail = () => {
|
||||
simItem.UserData
|
||||
.UnplayedItemCount
|
||||
}
|
||||
onClickEvent={() => {
|
||||
navigate(
|
||||
`/item/${simItem.Id}`,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
@@ -513,8 +1071,7 @@ const ItemDetail = () => {
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (item.isError || similarItems.isError) {
|
||||
} else if (item.isError || similarItems.isError) {
|
||||
return <h1>{"Something went wrong :("}</h1>;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -296,6 +296,7 @@ const LibraryView = () => {
|
||||
],
|
||||
queryFn: () => fetchLibItems(id),
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleCurrentViewType = (e) => {
|
||||
@@ -754,7 +755,7 @@ const LibraryView = () => {
|
||||
) : (
|
||||
<Grid2
|
||||
container
|
||||
columns={{ xs: 3, sm: 5, md: 8 }}
|
||||
columns={{ xs: 2, sm: 4, md: 8 }}
|
||||
>
|
||||
{items.data.Items.map((item, index) => {
|
||||
return (
|
||||
|
||||
+61
-25
@@ -5,6 +5,9 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate, useParams, Link } from "react-router-dom";
|
||||
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 { saveUser } from "../../utils/storage/user.js";
|
||||
|
||||
@@ -23,6 +26,8 @@ import InputLabel from "@mui/material/InputLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Button from "@mui/material/Button";
|
||||
import Box from "@mui/material/Box";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import { useSnackbar } from "notistack";
|
||||
import FormGroup from "@mui/material/FormGroup";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
@@ -42,6 +47,7 @@ import "./login.module.scss";
|
||||
import { CardsSkeleton } from "../../components/skeleton/cards.jsx";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { userName, userId } = useParams();
|
||||
|
||||
const [password, setPassword] = useState({
|
||||
@@ -91,6 +97,7 @@ export const LoginWithImage = () => {
|
||||
}
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
setLoading(false);
|
||||
dispatch(showSidemenu());
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
@@ -101,7 +108,15 @@ export const LoginWithImage = () => {
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
@@ -222,47 +237,52 @@ export const UserLogin = () => {
|
||||
queryKey: ["login", "users"],
|
||||
queryFn: async () => {
|
||||
const users = await getUserApi(window.api).getPublicUsers();
|
||||
// console.log(users.data);
|
||||
console.log(users.data);
|
||||
return users.data;
|
||||
// return {};
|
||||
},
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="md" className="centered">
|
||||
<Container
|
||||
maxWidth="md"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{/* <Typography variant="h3" sx={{ marginBottom: "1em" }}>
|
||||
Users
|
||||
</Typography> */}
|
||||
{users.isLoading ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller displayCards={5} title="Users">
|
||||
<Grid container direction="row">
|
||||
{users.data.map((item, index) => {
|
||||
return (
|
||||
//
|
||||
<Link
|
||||
to={`/login/withImg/${item.Name}/${item.Id}/`}
|
||||
key={item.Id}
|
||||
className="userCard"
|
||||
index={index}
|
||||
>
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={
|
||||
!!item.PrimaryImageTag
|
||||
}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
/>
|
||||
</Link>
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemId={item.Id}
|
||||
imageTags={!!item.PrimaryImageTag}
|
||||
// cardType="sqaure"
|
||||
iconType="Person"
|
||||
cardOrientation="sqaure"
|
||||
onClickEvent={navigate(
|
||||
`/login/withImg/${item.Name}/${item.Id}/`,
|
||||
)}
|
||||
cardProps={{
|
||||
sx: { width: "33%" },
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</Grid>
|
||||
)}
|
||||
<div className="buttons">
|
||||
<Button
|
||||
@@ -290,6 +310,7 @@ export const UserLoginManual = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rememberMe, setRememberMe] = useState(true);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
@@ -307,6 +328,7 @@ export const UserLoginManual = () => {
|
||||
return result.data;
|
||||
},
|
||||
enabled: !window.api,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const handleUsername = (event) => {
|
||||
@@ -353,6 +375,7 @@ export const UserLoginManual = () => {
|
||||
event.emit("set-api-accessToken", window.api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
dispatch(showSidemenu());
|
||||
navigate(`/home`);
|
||||
};
|
||||
|
||||
@@ -362,14 +385,27 @@ export const UserLoginManual = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{server.isLoading && <LinearProgress />}
|
||||
<AppBarBackOnly />
|
||||
<Container maxWidth="xs" className="centered">
|
||||
<Container
|
||||
maxWidth="xs"
|
||||
sx={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
spacing={2}
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
sx={{
|
||||
opacity: server.isLoading ? 0 : 1,
|
||||
transition: "opacity 200ms",
|
||||
}}
|
||||
>
|
||||
<Grid item xl={5} md={6} sx={{ marginBottom: "1em" }}>
|
||||
<Typography variant="h3" color="textPrimary">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { Cookies, useCookies } from "react-cookie";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
@@ -31,7 +30,6 @@ import "./server.module.scss";
|
||||
export const ServerList = () => {
|
||||
const [renderServerList, setRenderServerList] = useState(false);
|
||||
const [serverListRender, setServerListRender] = useState([]);
|
||||
const cookies = new Cookies();
|
||||
|
||||
const currentServer = cookies.get("currentServer");
|
||||
const serverList = cookies.get("servers");
|
||||
|
||||
@@ -38,6 +38,11 @@ body {
|
||||
position: relative;
|
||||
overflow-y: visible;
|
||||
overflow-x: hidden;
|
||||
min-height: 100vh;
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
}
|
||||
|
||||
.centered {
|
||||
|
||||
Reference in new issue
Block a user