feat(lint): use biome instead
This commit is contained in:
1 parent
dca2a31639
commit
8d68eb546d
129 files changed
+2352
-4366
No files matched your search
@@ -1,16 +1,16 @@
|
||||
/** @format */
|
||||
import React, { useEffect } from "react";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Link from "@mui/material/Link";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import Link from "@mui/material/Link";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Typography from "@mui/material/Typography";
|
||||
/** @format */
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import logo from "../../assets/logo.svg";
|
||||
|
||||
@@ -18,10 +18,10 @@ import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
|
||||
import "./about.module.scss";
|
||||
import { axiosClient, useApi } from "../../utils/store/api";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import { useCentralStore } from "../../utils/store/central";
|
||||
import "./about.module.scss";
|
||||
|
||||
const About = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
|
||||
+86
-143
@@ -1,11 +1,11 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
@@ -16,26 +16,26 @@ import {
|
||||
ItemFields,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
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 { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiClockOutline } from "../../components/icons/mdiClockOutline";
|
||||
|
||||
import { getRuntimeMusic } from "../../utils/date/time";
|
||||
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./album.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import LikeButton from "../../components/buttons/likeButton";
|
||||
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../utils/store/audioPlayback";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import "./album.module.scss";
|
||||
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
@@ -74,7 +74,7 @@ const MusicAlbumTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -99,7 +99,7 @@ const MusicAlbumTitlePage = () => {
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
let result = await getLibraryApi(api).getSimilarAlbums({
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
@@ -122,7 +122,7 @@ const MusicAlbumTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicAlbum,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicAlbum,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -227,8 +227,7 @@ const MusicAlbumTitlePage = () => {
|
||||
className="item-detail-album-track"
|
||||
style={{
|
||||
padding: "0.75em 0 ",
|
||||
background:
|
||||
"hsl(256, 100%, 4%, 60%)",
|
||||
background: "hsl(256, 100%, 4%, 60%)",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
@@ -240,7 +239,7 @@ const MusicAlbumTitlePage = () => {
|
||||
>
|
||||
#
|
||||
</Typography>
|
||||
<div></div>
|
||||
<div />
|
||||
<Typography
|
||||
variant="h6"
|
||||
style={{
|
||||
@@ -252,110 +251,76 @@ const MusicAlbumTitlePage = () => {
|
||||
</Typography>
|
||||
<MdiClockOutline />
|
||||
</div>
|
||||
{musicTracks.data.Items.map(
|
||||
(track, index) => {
|
||||
return (
|
||||
{musicTracks.data.Items.map((track, index) => {
|
||||
return (
|
||||
<div
|
||||
key={track.Id}
|
||||
className={
|
||||
currentTrackItem.Id === track.Id &&
|
||||
currentTrackItem.ParentId === track.ParentId
|
||||
? "item-detail-album-track playing"
|
||||
: "item-detail-album-track"
|
||||
}
|
||||
onClick={() => playTrack(index)}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
justifySelf: "end",
|
||||
}}
|
||||
>
|
||||
{track.IndexNumber ? track.IndexNumber : "-"}
|
||||
</Typography>
|
||||
|
||||
<LikeButton
|
||||
itemId={track.Id}
|
||||
isFavorite={track.UserData?.IsFavorite}
|
||||
queryKey={["item", id, "musicTracks"]}
|
||||
userId={user.data.Id}
|
||||
itemName={track.Name}
|
||||
color={
|
||||
currentTrackItem.Id === track.Id &&
|
||||
currentTrackItem.ParentId === track.ParentId
|
||||
? "hsl(337, 96%, 56%)"
|
||||
: "white"
|
||||
}
|
||||
/>
|
||||
|
||||
<div
|
||||
key={track.Id}
|
||||
className={
|
||||
currentTrackItem.Id ==
|
||||
track.Id &&
|
||||
currentTrackItem.ParentId ==
|
||||
track.ParentId
|
||||
? "item-detail-album-track playing"
|
||||
: "item-detail-album-track"
|
||||
}
|
||||
onClick={() =>
|
||||
playTrack(index)
|
||||
}
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
justifySelf:
|
||||
"end",
|
||||
justifySelf: "start",
|
||||
}}
|
||||
fontWeight={500}
|
||||
>
|
||||
{!!track.IndexNumber
|
||||
? track.IndexNumber
|
||||
: "-"}
|
||||
{track.Name}
|
||||
</Typography>
|
||||
|
||||
<LikeButton
|
||||
itemId={track.Id}
|
||||
isFavorite={
|
||||
track.UserData
|
||||
?.IsFavorite
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"musicTracks",
|
||||
]}
|
||||
userId={
|
||||
user.data.Id
|
||||
}
|
||||
itemName={
|
||||
track.Name
|
||||
}
|
||||
color={
|
||||
currentTrackItem.Id ==
|
||||
track.Id &&
|
||||
currentTrackItem.ParentId ==
|
||||
track.ParentId
|
||||
? "hsl(337, 96%, 56%)"
|
||||
: "white"
|
||||
}
|
||||
/>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection:
|
||||
"column",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{track.AlbumArtist === "Various Artists" && (
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
justifySelf:
|
||||
"start",
|
||||
opacity: 0.5,
|
||||
}}
|
||||
fontWeight={
|
||||
500
|
||||
}
|
||||
>
|
||||
{track.Name}
|
||||
{track.ArtistItems.map((artist) => artist.Name).join(
|
||||
", ",
|
||||
)}
|
||||
</Typography>
|
||||
{track.AlbumArtist ==
|
||||
"Various Artists" && (
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
>
|
||||
{track.ArtistItems.map(
|
||||
(
|
||||
artist,
|
||||
) =>
|
||||
artist.Name,
|
||||
).join(
|
||||
", ",
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeMusic(
|
||||
track.RunTimeTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<Typography variant="subtitle1">
|
||||
{getRuntimeMusic(track.RunTimeTicks)}
|
||||
</Typography>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</Paper>
|
||||
)
|
||||
)}
|
||||
@@ -373,58 +338,36 @@ const MusicAlbumTitlePage = () => {
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes
|
||||
?.Primary &&
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
|
||||
+57
-108
@@ -1,12 +1,12 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
@@ -17,21 +17,21 @@ import {
|
||||
ItemFields,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
import { Card } from "../../components/card/card";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./artist.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import MusicTrack from "../../components/musicTrack";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import "./artist.module.scss";
|
||||
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
@@ -63,7 +63,7 @@ const ArtistTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -98,7 +98,7 @@ const ArtistTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ const ArtistTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -134,7 +134,7 @@ const ArtistTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -151,11 +151,11 @@ const ArtistTitlePage = () => {
|
||||
artistSongs.isSuccess &&
|
||||
artistAppearances.isSuccess
|
||||
) {
|
||||
if (artistDiscography.data.TotalRecordCount != 0) {
|
||||
if (artistDiscography.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(0);
|
||||
} else if (artistSongs.data.TotalRecordCount != 0) {
|
||||
} else if (artistSongs.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(1);
|
||||
} else if (artistAppearances.data.TotalRecordCount != 0) {
|
||||
} else if (artistAppearances.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(2);
|
||||
}
|
||||
}
|
||||
@@ -246,11 +246,7 @@ const ArtistTitlePage = () => {
|
||||
<Tab
|
||||
key={index}
|
||||
label={tab.title}
|
||||
disabled={
|
||||
tab.data.data
|
||||
?.TotalRecordCount ==
|
||||
0
|
||||
}
|
||||
disabled={tab.data.data?.TotalRecordCount === 0}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -264,8 +260,7 @@ const ArtistTitlePage = () => {
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection ==
|
||||
"forward"
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
@@ -279,19 +274,15 @@ const ArtistTitlePage = () => {
|
||||
}}
|
||||
>
|
||||
{artistDiscography.isSuccess &&
|
||||
artistDiscography.data.Items.map(
|
||||
(tabitem, aindex) => {
|
||||
return (
|
||||
<ArtistAlbum
|
||||
key={aindex}
|
||||
user={
|
||||
user.data
|
||||
}
|
||||
album={tabitem}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
artistDiscography.data.Items.map((tabitem, aindex) => {
|
||||
return (
|
||||
<ArtistAlbum
|
||||
key={aindex}
|
||||
user={user.data}
|
||||
album={tabitem}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
<TabPanel value={activeArtistTab} index={1}>
|
||||
@@ -300,8 +291,7 @@ const ArtistTitlePage = () => {
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection ==
|
||||
"forward"
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
@@ -315,28 +305,16 @@ const ArtistTitlePage = () => {
|
||||
}}
|
||||
>
|
||||
{artistSongs.isSuccess &&
|
||||
artistSongs.data.Items.map(
|
||||
(tabitem) => {
|
||||
return (
|
||||
<MusicTrack
|
||||
item={tabitem}
|
||||
key={
|
||||
tabitem.Id
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"artist",
|
||||
"songs",
|
||||
]}
|
||||
userId={
|
||||
user.data
|
||||
.Id
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
artistSongs.data.Items.map((tabitem) => {
|
||||
return (
|
||||
<MusicTrack
|
||||
item={tabitem}
|
||||
key={tabitem.Id}
|
||||
queryKey={["item", id, "artist", "songs"]}
|
||||
userId={user.data.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
<TabPanel value={activeArtistTab} index={2}>
|
||||
@@ -345,8 +323,7 @@ const ArtistTitlePage = () => {
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection ==
|
||||
"forward"
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
@@ -361,54 +338,26 @@ const ArtistTitlePage = () => {
|
||||
className="grid"
|
||||
>
|
||||
{artistAppearances.isSuccess &&
|
||||
artistAppearances.data.Items.map(
|
||||
(tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={
|
||||
tabitem.Id
|
||||
}
|
||||
item={tabitem}
|
||||
cardTitle={
|
||||
tabitem.Name
|
||||
}
|
||||
imageType={
|
||||
"Primary"
|
||||
}
|
||||
cardCaption={
|
||||
tabitem.AlbumArtist
|
||||
}
|
||||
cardType={
|
||||
"square"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"artist",
|
||||
"appearences",
|
||||
]}
|
||||
userId={
|
||||
user.data
|
||||
.Id
|
||||
}
|
||||
imageBlurhash={
|
||||
!!tabitem
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
tabitem
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
tabitem
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
artistAppearances.data.Items.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
item={tabitem}
|
||||
cardTitle={tabitem.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={tabitem.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "appearences"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
</AnimatePresence>
|
||||
|
||||
+55
-107
@@ -1,10 +1,10 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
@@ -13,20 +13,20 @@ import {
|
||||
ItemFields,
|
||||
LocationType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
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 { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./boxset.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import "./boxset.module.scss";
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
@@ -57,7 +57,7 @@ const BoxSetTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -80,7 +80,7 @@ const BoxSetTitlePage = () => {
|
||||
});
|
||||
|
||||
const collectionItems = useQuery({
|
||||
queryKey: ["item", id, `collection`],
|
||||
queryKey: ["item", id, "collection"],
|
||||
queryFn: async () => {
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user.data.Id,
|
||||
@@ -123,13 +123,9 @@ const BoxSetTitlePage = () => {
|
||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
item.data.Id,
|
||||
);
|
||||
let direTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Director",
|
||||
);
|
||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
||||
setDirectors(direTp);
|
||||
let writeTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Writer",
|
||||
);
|
||||
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
|
||||
setWriters(writeTp);
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
@@ -180,11 +176,7 @@ const BoxSetTitlePage = () => {
|
||||
studios={item.data.Studios}
|
||||
/>
|
||||
{item.data.People.length > 0 && (
|
||||
<CardScroller
|
||||
title="Cast & Crew"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Cast & Crew" displayCards={8} disableDecoration>
|
||||
{item.data.People.map((person, index) => {
|
||||
return (
|
||||
<Card
|
||||
@@ -194,10 +186,7 @@ const BoxSetTitlePage = () => {
|
||||
cardCaption={person.Role}
|
||||
cardType="square"
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
person.ImageBlurHashes
|
||||
?.Primary[0]
|
||||
}
|
||||
imageBlurhash={person.ImageBlurHashes?.Primary[0]}
|
||||
overrideIcon="Person"
|
||||
disableOverlay
|
||||
/>
|
||||
@@ -206,51 +195,32 @@ const BoxSetTitlePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{collectionItems.data.TotalRecordCount > 0 && (
|
||||
<CardScroller
|
||||
title="Items"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{collectionItems.data.Items.map(
|
||||
(similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.ProductionYear
|
||||
}
|
||||
cardType={"portrait"}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
`collection`,
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes
|
||||
?.Primary &&
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<CardScroller title="Items" displayCards={8} disableDecoration>
|
||||
{collectionItems.data.Items.map((similar, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={similar.ProductionYear}
|
||||
cardType={"portrait"}
|
||||
queryKey={["item", id, "collection"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{similarItems.data.TotalRecordCount > 0 && (
|
||||
@@ -266,58 +236,36 @@ const BoxSetTitlePage = () => {
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
!!similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes
|
||||
?.Primary &&
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useState, useLayoutEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -24,14 +25,15 @@ import {
|
||||
ItemFields,
|
||||
MediaStreamType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./episode.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
@@ -74,7 +76,7 @@ const EpisodeTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -117,19 +119,19 @@ const EpisodeTitlePage = () => {
|
||||
const [subtitleTracks, setSubtitleTracks] = useState([]);
|
||||
|
||||
const filterMediaStreamVideo = (source) => {
|
||||
if (source.Type == MediaStreamType.Video) {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamAudio = (source) => {
|
||||
if (source.Type == MediaStreamType.Audio) {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamSubtitle = (source) => {
|
||||
if (source.Type == MediaStreamType.Subtitle) {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -141,15 +143,9 @@ const EpisodeTitlePage = () => {
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (item.isSuccess && !!item.data.MediaStreams) {
|
||||
let videos = item.data.MediaStreams.filter(
|
||||
filterMediaStreamVideo,
|
||||
);
|
||||
let audios = item.data.MediaStreams.filter(
|
||||
filterMediaStreamAudio,
|
||||
);
|
||||
let subs = item.data.MediaStreams.filter(
|
||||
filterMediaStreamSubtitle,
|
||||
);
|
||||
const videos = item.data.MediaStreams.filter(filterMediaStreamVideo);
|
||||
const audios = item.data.MediaStreams.filter(filterMediaStreamAudio);
|
||||
const subs = item.data.MediaStreams.filter(filterMediaStreamSubtitle);
|
||||
|
||||
setSelectedVideoTrack(videos[0]?.Index ?? null);
|
||||
setSelectedAudioTrack(audios[0]?.Index ?? null);
|
||||
@@ -174,13 +170,9 @@ const EpisodeTitlePage = () => {
|
||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
item.data.Id,
|
||||
);
|
||||
let direTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Director",
|
||||
);
|
||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
||||
setDirectors(direTp);
|
||||
let writeTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Writer",
|
||||
);
|
||||
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
|
||||
setWriters(writeTp);
|
||||
let producerTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Producer",
|
||||
@@ -878,43 +870,26 @@ const EpisodeTitlePage = () => {
|
||||
displayCards={4}
|
||||
disableDecoration
|
||||
>
|
||||
{upcomingEpisodes.data.Items.map(
|
||||
(episode) => {
|
||||
return (
|
||||
<Card
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={
|
||||
episode.SeriesName
|
||||
}
|
||||
imageType="Primary"
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
cardType="thumb"
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"episode",
|
||||
"upcomingEpisodes",
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!episode
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
episode
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
episode
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
{upcomingEpisodes.data.Items.map((episode) => {
|
||||
return (
|
||||
<Card
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={episode.SeriesName}
|
||||
imageType="Primary"
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
cardType="thumb"
|
||||
queryKey={["item", id, "episode", "upcomingEpisodes"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!episode.ImageBlurHashes?.Primary &&
|
||||
episode.ImageBlurHashes?.Primary[
|
||||
Object.keys(episode.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
<div className="item-detail-cast">
|
||||
|
||||
@@ -3,15 +3,15 @@ import React, { useEffect } from "react";
|
||||
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
|
||||
import "./favorite.module.scss";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import "./favorite.module.scss";
|
||||
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
|
||||
const FavoritePage = () => {
|
||||
@@ -21,7 +21,7 @@ const FavoritePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -149,9 +149,7 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -159,11 +157,7 @@ const FavoritePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{series.isSuccess && series.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="TV Shows"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
||||
{series.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -172,9 +166,7 @@ const FavoritePage = () => {
|
||||
imageType={"Primary"}
|
||||
cardCaption={`${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(
|
||||
item.EndDate,
|
||||
).toLocaleString([], {
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
@@ -185,9 +177,7 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -195,11 +185,7 @@ const FavoritePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{audio.isSuccess && audio.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Audio"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
||||
{audio.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -213,9 +199,7 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -223,11 +207,7 @@ const FavoritePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess && musicAlbum.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Albums"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
||||
{musicAlbum.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -242,9 +222,7 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -252,11 +230,7 @@ const FavoritePage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{book.isSuccess && book.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Books"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Books" displayCards={8} disableDecoration>
|
||||
{book.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -271,51 +245,37 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess && musicArtists.data.Items.length > 0 && (
|
||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||
{musicArtists.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicArtist"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess &&
|
||||
musicArtists.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Artists"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{musicArtists.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["favorite", "musicArtist"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && person.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="People"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="People" displayCards={8} disableDecoration>
|
||||
{person.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -329,9 +289,7 @@ const FavoritePage = () => {
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
|
||||
+132
-269
@@ -12,26 +12,26 @@ import Carousel from "../../components/carousel";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { LatestMediaSection } from "../../components/layouts/homeSection/latestMediaSection";
|
||||
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||
import { CardsSkeleton } from "../../components/skeleton/cards";
|
||||
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
|
||||
import CarouselSlide from "../../components/carouselSlide";
|
||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
import ErrorBoundary from "../../components/errorBoundary";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useSnackbar } from "notistack";
|
||||
import CarouselSlide from "../../components/carouselSlide";
|
||||
import ErrorBoundary from "../../components/errorBoundary";
|
||||
import CarouselSlideError from "../../components/errors/carousel";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
const Home = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
@@ -39,7 +39,7 @@ const Home = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -141,7 +141,7 @@ const Home = () => {
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
|
||||
let tempData = [];
|
||||
if (libraries.status == "success") {
|
||||
if (libraries.status === "success") {
|
||||
libraries.data.Items.map((lib) => {
|
||||
if (excludeTypes.includes(lib.CollectionType)) {
|
||||
return;
|
||||
@@ -149,9 +149,7 @@ const Home = () => {
|
||||
tempData = latestMediaLibs;
|
||||
if (
|
||||
!tempData.some(
|
||||
(el) =>
|
||||
JSON.stringify(el) ==
|
||||
JSON.stringify([lib.Id, lib.Name]),
|
||||
(el) => JSON.stringify(el) === JSON.stringify([lib.Id, lib.Name]),
|
||||
)
|
||||
) {
|
||||
tempData.push([lib.Id, lib.Name]);
|
||||
@@ -183,17 +181,11 @@ const Home = () => {
|
||||
) : (
|
||||
<Carousel
|
||||
content={latestMedia.data?.map((item) => (
|
||||
<CarouselSlide
|
||||
item={item}
|
||||
key={item.Id}
|
||||
/>
|
||||
<CarouselSlide item={item} key={item.Id} />
|
||||
))}
|
||||
onChange={(now) => {
|
||||
if (latestMedia.isSuccess) {
|
||||
if (
|
||||
latestMedia.data[now]
|
||||
.ParentBackdropImageTags
|
||||
) {
|
||||
if (latestMedia.data[now].ParentBackdropImageTags) {
|
||||
setAppBackdrop(
|
||||
`${api.basePath}/Items/${latestMedia.data[now].ParentBackdropItemId}/Images/Backdrop`,
|
||||
latestMedia.data[now].Id,
|
||||
@@ -221,150 +213,95 @@ const Home = () => {
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>
|
||||
Error with Carousel
|
||||
</Typography>
|
||||
<Typography>Error with Carousel</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{libraries.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Libraries"
|
||||
>
|
||||
{libraries.status == "success" &&
|
||||
libraries.data.Items.map(
|
||||
(item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Name
|
||||
}
|
||||
imageType="Primary"
|
||||
cardType="thumb"
|
||||
disableOverlay
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/library/${item.Id}`,
|
||||
)
|
||||
}
|
||||
imageBlurhash={
|
||||
!!item
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
overrideIcon={
|
||||
item.CollectionType
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<CardScroller displayCards={4} title="Libraries">
|
||||
{libraries.status === "success" &&
|
||||
libraries.data.Items.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType="Primary"
|
||||
cardType="thumb"
|
||||
disableOverlay
|
||||
onClick={() => navigate(`/library/${item.Id}`)}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
overrideIcon={item.CollectionType}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>
|
||||
Error with Libraries
|
||||
</Typography>
|
||||
<Typography>Error with Libraries</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{upNextItems.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : upNextItems.isSuccess &&
|
||||
upNextItems.data.Items.length == 0 ? (
|
||||
) : upNextItems.isSuccess && upNextItems.data.Items.length === 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Up Next"
|
||||
>
|
||||
<CardScroller displayCards={4} title="Up Next">
|
||||
{upNextItems.data.Items.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: Object.keys(
|
||||
item.ImageTags,
|
||||
).includes(
|
||||
"Thumb",
|
||||
)
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
: Object.keys(item.ImageTags).includes("Thumb")
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
? item.ParentIndexNumber ==
|
||||
0
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.ParentIndexNumber === 0
|
||||
? `${item.SeasonName} - ${item.Name}`
|
||||
: item.IndexNumberEnd
|
||||
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
||||
: `${item.IndexNumber}. ${item.Name}`
|
||||
: item.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
item.ProductionYear
|
||||
} - ${
|
||||
item.EndDate
|
||||
? new Date(
|
||||
item.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
||||
: `${item.IndexNumber}. ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={[
|
||||
"home",
|
||||
"upNext",
|
||||
]}
|
||||
queryKey={["home", "upNext"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
></Card>
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
@@ -373,187 +310,113 @@ const Home = () => {
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>
|
||||
Error with resumeItemsVideo
|
||||
</Typography>
|
||||
<Typography>Error with resumeItemsVideo</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsVideo.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsVideo.isSuccess &&
|
||||
resumeItemsVideo.data.Items.length == 0 ? (
|
||||
resumeItemsVideo.data.Items.length === 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Continue Watching"
|
||||
>
|
||||
{resumeItemsVideo.data.Items.map(
|
||||
(item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: Object.keys(
|
||||
item.ImageTags,
|
||||
).includes(
|
||||
"Thumb",
|
||||
)
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
item.ProductionYear
|
||||
} - ${
|
||||
<CardScroller displayCards={4} title="Continue Watching">
|
||||
{resumeItemsVideo.data.Items.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: Object.keys(item.ImageTags).includes("Thumb")
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(
|
||||
item.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={[
|
||||
"home",
|
||||
"resume",
|
||||
"video",
|
||||
]}
|
||||
userId={
|
||||
user.data.Id
|
||||
}
|
||||
imageBlurhash={
|
||||
!!item
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "video"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>
|
||||
Error with resumeItemsAudio
|
||||
</Typography>
|
||||
<Typography>Error with resumeItemsAudio</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsAudio.isPending ? (
|
||||
<CardsSkeleton />
|
||||
) : resumeItemsAudio.isSuccess &&
|
||||
resumeItemsAudio.data.Items.length == 0 ? (
|
||||
resumeItemsAudio.data.Items.length === 0 ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller
|
||||
displayCards={4}
|
||||
title="Continue Listening"
|
||||
>
|
||||
{resumeItemsAudio.data.Items.map(
|
||||
(item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type ==
|
||||
BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: Object.keys(
|
||||
item.ImageTags,
|
||||
).includes(
|
||||
"Thumb",
|
||||
)
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={[
|
||||
"home",
|
||||
"resume",
|
||||
"audio",
|
||||
]}
|
||||
userId={
|
||||
user.data.Id
|
||||
}
|
||||
imageBlurhash={
|
||||
item
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
item
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
},
|
||||
)}
|
||||
<CardScroller displayCards={4} title="Continue Listening">
|
||||
{resumeItemsAudio.data.Items.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: Object.keys(item.ImageTags).includes("Thumb")
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "audio"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
item.ImageBlurHashes?.Primary?.[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>
|
||||
Error with LatestMediaSections
|
||||
</Typography>
|
||||
<Typography>Error with LatestMediaSections</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{latestMediaLibs.map((lib) => {
|
||||
return (
|
||||
<LatestMediaSection
|
||||
key={lib[0]}
|
||||
latestMediaLib={lib}
|
||||
/>
|
||||
);
|
||||
return <LatestMediaSection key={lib[0]} latestMediaLib={lib} />;
|
||||
})}
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
|
||||
+164
-374
@@ -1,17 +1,18 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useState, useLayoutEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import { red, green, yellow } from "@mui/material/colors";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { green, red, yellow } from "@mui/material/colors";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
@@ -24,14 +25,15 @@ import {
|
||||
ItemFields,
|
||||
MediaStreamType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
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 { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./item.module.scss";
|
||||
|
||||
@@ -77,7 +79,7 @@ const ItemDetail = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -103,23 +105,23 @@ const ItemDetail = () => {
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
let result;
|
||||
if (item.data.Type == "Movie") {
|
||||
if (item.data.Type === "Movie") {
|
||||
result = await getLibraryApi(api).getSimilarMovies({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
} else if (item.data.Type == "Series") {
|
||||
} else if (item.data.Type === "Series") {
|
||||
result = await getLibraryApi(api).getSimilarShows({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicAlbum") {
|
||||
} else if (item.data.Type === "MusicAlbum") {
|
||||
result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicArtist") {
|
||||
} else if (item.data.Type === "MusicArtist") {
|
||||
result = await getLibraryApi(api).getSimilarArtists({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
@@ -142,19 +144,19 @@ const ItemDetail = () => {
|
||||
const [subtitleTracks, setSubtitleTracks] = useState([]);
|
||||
|
||||
const filterMediaStreamVideo = (source) => {
|
||||
if (source.Type == MediaStreamType.Video) {
|
||||
if (source.Type === MediaStreamType.Video) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamAudio = (source) => {
|
||||
if (source.Type == MediaStreamType.Audio) {
|
||||
if (source.Type === MediaStreamType.Audio) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const filterMediaStreamSubtitle = (source) => {
|
||||
if (source.Type == MediaStreamType.Subtitle) {
|
||||
if (source.Type === MediaStreamType.Subtitle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -166,15 +168,9 @@ const ItemDetail = () => {
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (item.isSuccess && !!item.data.MediaStreams) {
|
||||
let videos = item.data.MediaStreams.filter(
|
||||
filterMediaStreamVideo,
|
||||
);
|
||||
let audios = item.data.MediaStreams.filter(
|
||||
filterMediaStreamAudio,
|
||||
);
|
||||
let subs = item.data.MediaStreams.filter(
|
||||
filterMediaStreamSubtitle,
|
||||
);
|
||||
const videos = item.data.MediaStreams.filter(filterMediaStreamVideo);
|
||||
const audios = item.data.MediaStreams.filter(filterMediaStreamAudio);
|
||||
const subs = item.data.MediaStreams.filter(filterMediaStreamSubtitle);
|
||||
|
||||
setSelectedVideoTrack(videos[0]?.Index ?? null);
|
||||
setSelectedAudioTrack(audios[0]?.Index ?? null);
|
||||
@@ -201,80 +197,59 @@ const ItemDetail = () => {
|
||||
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||
item.data.Id,
|
||||
);
|
||||
let direTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Director",
|
||||
);
|
||||
const direTp = item.data.People.filter((itm) => itm.Type === "Director");
|
||||
setDirectors(direTp);
|
||||
let writeTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Writer",
|
||||
);
|
||||
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
|
||||
setWriters(writeTp);
|
||||
let producerTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Producer",
|
||||
const producerTp = item.data.People.filter(
|
||||
(itm) => itm.Type === "Producer",
|
||||
);
|
||||
setProducers(producerTp);
|
||||
let actorTp = item.data.People.filter(
|
||||
(itm) => itm.Type == "Actor",
|
||||
);
|
||||
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
|
||||
setActors(actorTp);
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
const qualityLabel = () => {
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"2160p",
|
||||
) ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("2160p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("4k")
|
||||
) {
|
||||
return <span className="material-symbols-rounded">4k</span>;
|
||||
} else if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"1080p",
|
||||
) ||
|
||||
}
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("1080p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("hd")
|
||||
) {
|
||||
return <span className="material-symbols-rounded">full_hd</span>;
|
||||
} else {
|
||||
return <span className="material-symbols-rounded">hd</span>;
|
||||
}
|
||||
return <span className="material-symbols-rounded">hd</span>;
|
||||
};
|
||||
|
||||
const atmosLabel = () => {
|
||||
if (
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"atmos",
|
||||
) &&
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"truehd",
|
||||
)
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos") &&
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
|
||||
) {
|
||||
return `TrueHD | Atmos`;
|
||||
} else if (
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"atmos",
|
||||
)
|
||||
) {
|
||||
return "Atmos";
|
||||
} else if (
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
|
||||
"truehd",
|
||||
)
|
||||
) {
|
||||
return "TrueHD";
|
||||
} else {
|
||||
return "";
|
||||
return "TrueHD | Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")) {
|
||||
return "Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")) {
|
||||
return "TrueHD";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const surroundSoundLabel = () => {
|
||||
if (audioTracks[0]?.DisplayTitle.includes("7.1")) {
|
||||
return "7.1";
|
||||
} else if (audioTracks[0]?.DisplayTitle.includes("5.1")) {
|
||||
return "5.1";
|
||||
} else {
|
||||
return "2.0";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.includes("5.1")) {
|
||||
return "5.1";
|
||||
}
|
||||
return "2.0";
|
||||
};
|
||||
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
@@ -322,9 +297,7 @@ const ItemDetail = () => {
|
||||
},
|
||||
)}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) =>
|
||||
(e.currentTarget.style.opacity = 1)
|
||||
}
|
||||
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
@@ -333,39 +306,25 @@ const ItemDetail = () => {
|
||||
<div
|
||||
className="item-hero-image-container"
|
||||
style={{
|
||||
aspectRatio:
|
||||
item.data.PrimaryImageAspectRatio ?? 1,
|
||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||
}}
|
||||
>
|
||||
{Object.keys(item.data.ImageTags).includes(
|
||||
"Primary",
|
||||
) ? (
|
||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes
|
||||
.Primary[
|
||||
item.data.ImageTags[
|
||||
"Primary"
|
||||
]
|
||||
item.data.ImageBlurHashes.Primary[
|
||||
item.data.ImageTags.Primary
|
||||
]
|
||||
}
|
||||
className="item-hero-image-blurhash"
|
||||
/>
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags[
|
||||
"Primary"
|
||||
],
|
||||
},
|
||||
)}
|
||||
onLoad={(e) =>
|
||||
(e.currentTarget.style.opacity = 1)
|
||||
}
|
||||
src={api.getItemImageUrl(item.data.Id, "Primary", {
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
})}
|
||||
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
|
||||
className="item-hero-image"
|
||||
/>
|
||||
</>
|
||||
@@ -374,28 +333,18 @@ const ItemDetail = () => {
|
||||
)}
|
||||
</div>
|
||||
<div className="item-hero-detail flex flex-column">
|
||||
{Object.keys(item.data.ImageTags).includes(
|
||||
"Logo",
|
||||
) ? (
|
||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
item.data.Id,
|
||||
"Logo",
|
||||
{
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
},
|
||||
)}
|
||||
onLoad={(e) =>
|
||||
(e.currentTarget.style.opacity = 1)
|
||||
}
|
||||
src={api.getItemImageUrl(item.data.Id, "Logo", {
|
||||
quality: 90,
|
||||
fillWidth: 592,
|
||||
fillHeight: 592,
|
||||
})}
|
||||
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
|
||||
className="item-hero-logo"
|
||||
/>
|
||||
) : (
|
||||
<Typography variant="h3">
|
||||
{item.data.Name}
|
||||
</Typography>
|
||||
<Typography variant="h3">{item.data.Name}</Typography>
|
||||
)}
|
||||
<Stack direction="row" gap={1}>
|
||||
{!!qualityLabel() && (
|
||||
@@ -403,8 +352,7 @@ const ItemDetail = () => {
|
||||
variant="filled"
|
||||
label={qualityLabel()}
|
||||
sx={{
|
||||
borderRadius:
|
||||
"8px !important",
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
@@ -415,16 +363,12 @@ const ItemDetail = () => {
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
>
|
||||
<Typography variant="caption" fontWeight={600}>
|
||||
{surroundSoundLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius:
|
||||
"8px !important",
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
@@ -435,19 +379,12 @@ const ItemDetail = () => {
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
>
|
||||
{
|
||||
videoTracks[0]
|
||||
.VideoRangeType
|
||||
}
|
||||
<Typography variant="caption" fontWeight={600}>
|
||||
{videoTracks[0].VideoRangeType}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius:
|
||||
"8px !important",
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
@@ -458,16 +395,12 @@ const ItemDetail = () => {
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
>
|
||||
<Typography variant="caption" fontWeight={600}>
|
||||
{atmosLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius:
|
||||
"8px !important",
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
@@ -490,8 +423,7 @@ const ItemDetail = () => {
|
||||
</span>
|
||||
}
|
||||
sx={{
|
||||
borderRadius:
|
||||
"8px !important",
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
@@ -505,17 +437,11 @@ const ItemDetail = () => {
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography
|
||||
style={{ opacity: "0.8" }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{item.data.ProductionYear ?? ""}
|
||||
</Typography>
|
||||
{item.data.OfficialRating && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={item.data.OfficialRating}
|
||||
/>
|
||||
<Chip variant="filled" label={item.data.OfficialRating} />
|
||||
)}
|
||||
|
||||
{item.data.CommunityRating && (
|
||||
@@ -544,11 +470,7 @@ const ItemDetail = () => {
|
||||
}}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{Math.round(
|
||||
item.data
|
||||
.CommunityRating *
|
||||
10,
|
||||
) / 10}
|
||||
{Math.round(item.data.CommunityRating * 10) / 10}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
@@ -565,18 +487,12 @@ const ItemDetail = () => {
|
||||
className="material-symbols-rounded "
|
||||
style={{
|
||||
color:
|
||||
item.data
|
||||
.CriticRating >
|
||||
50
|
||||
? green[400]
|
||||
: red[400],
|
||||
item.data.CriticRating > 50 ? green[400] : red[400],
|
||||
fontVariationSettings:
|
||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||
}}
|
||||
>
|
||||
{item.data.CriticRating > 50
|
||||
? "thumb_up"
|
||||
: "thumb_down"}
|
||||
{item.data.CriticRating > 50 ? "thumb_up" : "thumb_down"}
|
||||
</div>
|
||||
<Typography
|
||||
style={{
|
||||
@@ -590,32 +506,20 @@ const ItemDetail = () => {
|
||||
)}
|
||||
|
||||
{item.data.RunTimeTicks && (
|
||||
<Typography
|
||||
style={{ opacity: "0.8" }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{getRuntime(
|
||||
item.data.RunTimeTicks,
|
||||
)}
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{getRuntime(item.data.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
{item.data.RunTimeTicks && (
|
||||
<Typography
|
||||
style={{ opacity: "0.8" }}
|
||||
variant="subtitle1"
|
||||
>
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{endsAt(
|
||||
item.data.RunTimeTicks -
|
||||
item.data.UserData
|
||||
.PlaybackPositionTicks,
|
||||
item.data.UserData.PlaybackPositionTicks,
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{ opacity: 0.8 }}
|
||||
>
|
||||
<Typography variant="subtitle1" style={{ opacity: 0.8 }}>
|
||||
{item.data.Genres.join(", ")}
|
||||
</Typography>
|
||||
|
||||
@@ -625,38 +529,25 @@ const ItemDetail = () => {
|
||||
itemId={item.data.Id}
|
||||
itemType={item.data.Type}
|
||||
itemUserData={item.data.UserData}
|
||||
currentVideoTrack={
|
||||
selectedVideoTrack
|
||||
}
|
||||
currentAudioTrack={
|
||||
selectedAudioTrack
|
||||
}
|
||||
currentSubTrack={
|
||||
selectedSubtitleTrack
|
||||
}
|
||||
currentVideoTrack={selectedVideoTrack}
|
||||
currentAudioTrack={selectedAudioTrack}
|
||||
currentSubTrack={selectedSubtitleTrack}
|
||||
userId={user.data.Id}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="flex flex-row"
|
||||
style={{ gap: "1em" }}
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<LikeButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={
|
||||
item.data.UserData.IsFavorite
|
||||
}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
userId={user.data.Id}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isPlayed={
|
||||
item.data.UserData.Played
|
||||
}
|
||||
isPlayed={item.data.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
/>
|
||||
</div>
|
||||
@@ -675,29 +566,21 @@ const ItemDetail = () => {
|
||||
<Typography>
|
||||
{getRuntime(
|
||||
item.data.RunTimeTicks -
|
||||
item.data.UserData
|
||||
.PlaybackPositionTicks,
|
||||
item.data.UserData.PlaybackPositionTicks,
|
||||
)}{" "}
|
||||
left
|
||||
</Typography>
|
||||
<LinearProgress
|
||||
color="white"
|
||||
variant="determinate"
|
||||
value={
|
||||
item.data.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
value={item.data.UserData.PlayedPercentage}
|
||||
style={{
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<Typography
|
||||
variant="h5"
|
||||
fontStyle="italic"
|
||||
mb={1}
|
||||
>
|
||||
<Typography variant="h5" fontStyle="italic" mb={1}>
|
||||
{item.data.Taglines[0] ?? ""}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
@@ -719,20 +602,15 @@ const ItemDetail = () => {
|
||||
<>
|
||||
<TextLink
|
||||
key={writer.Id}
|
||||
variant={
|
||||
"subtitle1"
|
||||
}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${writer.Id}`}
|
||||
>
|
||||
{writer.Name}
|
||||
</TextLink>
|
||||
{index !=
|
||||
writers.length -
|
||||
1 && (
|
||||
{index !== writers.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace:
|
||||
"pre",
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
@@ -755,35 +633,26 @@ const ItemDetail = () => {
|
||||
Directed by
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{directors.map(
|
||||
(director, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={
|
||||
director.Id
|
||||
}
|
||||
variant={
|
||||
"subtitle1"
|
||||
}
|
||||
location={`/person/${director.Id}`}
|
||||
{directors.map((director, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={director.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${director.Id}`}
|
||||
>
|
||||
{director.Name}
|
||||
</TextLink>
|
||||
{index !== directors.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
{director.Name}
|
||||
</TextLink>
|
||||
{index !=
|
||||
directors.length -
|
||||
1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace:
|
||||
"pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
)}
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -803,17 +672,10 @@ const ItemDetail = () => {
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedVideoTrack}
|
||||
onChange={(e) =>
|
||||
setSelectedVideoTrack(
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onChange={(e) => setSelectedVideoTrack(e.target.value)}
|
||||
>
|
||||
{videoTracks.map((track) => (
|
||||
<MenuItem
|
||||
key={track.Index}
|
||||
value={track.Index}
|
||||
>
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
@@ -828,17 +690,10 @@ const ItemDetail = () => {
|
||||
marginBottom: "1em",
|
||||
}}
|
||||
value={selectedAudioTrack}
|
||||
onChange={(e) =>
|
||||
setSelectedAudioTrack(
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onChange={(e) => setSelectedAudioTrack(e.target.value)}
|
||||
>
|
||||
{audioTracks.map((track) => (
|
||||
<MenuItem
|
||||
key={track.Index}
|
||||
value={track.Index}
|
||||
>
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
@@ -852,20 +707,13 @@ const ItemDetail = () => {
|
||||
width: "100%",
|
||||
}}
|
||||
value={selectedSubtitleTrack}
|
||||
onChange={(e) =>
|
||||
setSelectedSubtitleTrack(
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
onChange={(e) => setSelectedSubtitleTrack(e.target.value)}
|
||||
>
|
||||
<MenuItem key={-1} value={-1}>
|
||||
No Subtitle
|
||||
</MenuItem>
|
||||
{subtitleTracks.map((track) => (
|
||||
<MenuItem
|
||||
key={track.Index}
|
||||
value={track.Index}
|
||||
>
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
))}
|
||||
@@ -908,28 +756,20 @@ const ItemDetail = () => {
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon(
|
||||
"Person",
|
||||
)}
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{actor.Name}</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
@@ -956,28 +796,20 @@ const ItemDetail = () => {
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon(
|
||||
"Person",
|
||||
)}
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{actor.Name}</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
@@ -994,9 +826,7 @@ const ItemDetail = () => {
|
||||
)}
|
||||
{directors.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">
|
||||
Directors
|
||||
</Typography>
|
||||
<Typography variant="h6">Directors</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{directors.map((actor) => (
|
||||
<NavLink
|
||||
@@ -1006,28 +836,20 @@ const ItemDetail = () => {
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon(
|
||||
"Person",
|
||||
)}
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{actor.Name}</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
@@ -1044,9 +866,7 @@ const ItemDetail = () => {
|
||||
)}
|
||||
{producers.length > 0 && (
|
||||
<div className="item-detail-cast-container">
|
||||
<Typography variant="h6">
|
||||
Producers
|
||||
</Typography>
|
||||
<Typography variant="h6">Producers</Typography>
|
||||
<div className="item-detail-cast-grid">
|
||||
{producers.map((actor) => (
|
||||
<NavLink
|
||||
@@ -1056,28 +876,20 @@ const ItemDetail = () => {
|
||||
>
|
||||
{actor.PrimaryImageTag ? (
|
||||
<img
|
||||
src={api.getItemImageUrl(
|
||||
actor.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
},
|
||||
)}
|
||||
src={api.getItemImageUrl(actor.Id, "Primary", {
|
||||
quality: 80,
|
||||
fillWidth: 200,
|
||||
fillHeight: 200,
|
||||
})}
|
||||
className="item-detail-cast-card-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="item-detail-cast-card-icon">
|
||||
{getTypeIcon(
|
||||
"Person",
|
||||
)}
|
||||
{getTypeIcon("Person")}
|
||||
</div>
|
||||
)}
|
||||
<div className="item-detail-cast-card-text">
|
||||
<Typography variant="subtitle1">
|
||||
{actor.Name}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{actor.Name}</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
@@ -1132,58 +944,36 @@ const ItemDetail = () => {
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes
|
||||
?.Primary &&
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
|
||||
+303
-680
File diff suppressed because it is too large.
Load diff
+37
-76
@@ -1,44 +1,44 @@
|
||||
/** @format */
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import React, { useState } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import { saveUser } from "../../utils/storage/user";
|
||||
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight.jsx";
|
||||
// import Icon from "mdi-material-ui";
|
||||
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline.jsx";
|
||||
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline.jsx";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight.jsx";
|
||||
|
||||
import Container from "@mui/material/Container";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import OutlinedInput from "@mui/material/OutlinedInput";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
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 LinearProgress from "@mui/material/LinearProgress";
|
||||
import { useSnackbar } from "notistack";
|
||||
import FormGroup from "@mui/material/FormGroup";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import Container from "@mui/material/Container";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import FormGroup from "@mui/material/FormGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import InputLabel from "@mui/material/InputLabel";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import OutlinedInput from "@mui/material/OutlinedInput";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Unstable_Grid2";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
||||
import { AvatarImage } from "../../components/avatar/avatar.jsx";
|
||||
import { Card } from "../../components/card/card.jsx";
|
||||
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import "./login.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice.jsx";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import "./login.module.scss";
|
||||
|
||||
export const LoginWithImage = () => {
|
||||
const { userName, userId } = useParams();
|
||||
@@ -87,12 +87,12 @@ export const LoginWithImage = () => {
|
||||
setLoading(true);
|
||||
const user = await authUser();
|
||||
sessionStorage.setItem("accessToken", user.data.AccessToken);
|
||||
if (rememberMe == true) {
|
||||
if (rememberMe === true) {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", api.basePath);
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
navigate("/home");
|
||||
};
|
||||
|
||||
const handleCheckRememberMe = (event) => {
|
||||
@@ -143,38 +143,24 @@ export const LoginWithImage = () => {
|
||||
mb={1}
|
||||
>
|
||||
<AvatarImage userId={userId} />
|
||||
<Typography
|
||||
color="textPrimary"
|
||||
textAlign="center"
|
||||
variant="h4"
|
||||
>
|
||||
<Typography color="textPrimary" textAlign="center" variant="h4">
|
||||
{userName}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid minWidth="100%">
|
||||
<FormGroup>
|
||||
<FormControl variant="outlined" fullWidth>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<InputLabel htmlFor="user-password">Password:</InputLabel>
|
||||
<OutlinedInput
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
type={password.showpass ? "text" : "password"}
|
||||
variant="outlined"
|
||||
onChange={handlePassword(
|
||||
"password",
|
||||
)}
|
||||
onChange={handlePassword("password")}
|
||||
label="Password:"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
onClick={handleShowPassword}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
@@ -191,9 +177,7 @@ export const LoginWithImage = () => {
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={
|
||||
handleCheckRememberMe
|
||||
}
|
||||
onChange={handleCheckRememberMe}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
@@ -313,9 +297,7 @@ export const UserLogin = () => {
|
||||
itemType="User"
|
||||
cardType="square"
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/login/withImg/${item.Name}/${item.Id}/`,
|
||||
)
|
||||
navigate(`/login/withImg/${item.Name}/${item.Id}/`)
|
||||
}
|
||||
overrideIcon="User"
|
||||
imageType="Primary"
|
||||
@@ -419,13 +401,13 @@ export const UserLoginManual = () => {
|
||||
setLoading(true);
|
||||
const user = await authUser();
|
||||
sessionStorage.setItem("accessToken", user.data.AccessToken);
|
||||
if (rememberMe == true) {
|
||||
if (rememberMe === true) {
|
||||
saveUser(userName, password.password);
|
||||
}
|
||||
event.emit("set-api-accessToken", api.basePath);
|
||||
// setAccessToken(user.data.AccessToken)
|
||||
setLoading(false);
|
||||
navigate(`/home`);
|
||||
navigate("/home");
|
||||
};
|
||||
|
||||
const handleCheckRememberMe = (event) => {
|
||||
@@ -463,13 +445,8 @@ export const UserLoginManual = () => {
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
>
|
||||
<InputLabel htmlFor="user-name">
|
||||
Username:
|
||||
</InputLabel>
|
||||
<FormControl sx={{ width: "100%" }} variant="outlined">
|
||||
<InputLabel htmlFor="user-name">Username:</InputLabel>
|
||||
<OutlinedInput
|
||||
fullWidth
|
||||
id="user-name"
|
||||
@@ -482,25 +459,14 @@ export const UserLoginManual = () => {
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<FormGroup>
|
||||
<FormControl
|
||||
sx={{ width: "100%" }}
|
||||
variant="outlined"
|
||||
>
|
||||
<InputLabel htmlFor="user-password">
|
||||
Password:
|
||||
</InputLabel>
|
||||
<FormControl sx={{ width: "100%" }} variant="outlined">
|
||||
<InputLabel htmlFor="user-password">Password:</InputLabel>
|
||||
<OutlinedInput
|
||||
fullWidth
|
||||
id="user-password"
|
||||
type={
|
||||
password.showpass
|
||||
? "text"
|
||||
: "password"
|
||||
}
|
||||
type={password.showpass ? "text" : "password"}
|
||||
variant="outlined"
|
||||
onChange={handlePassword(
|
||||
"password",
|
||||
)}
|
||||
onChange={handlePassword("password")}
|
||||
onKeyUp={(event) => {
|
||||
if (event.key === "Enter") {
|
||||
handleLogin();
|
||||
@@ -510,9 +476,7 @@ export const UserLoginManual = () => {
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={
|
||||
handleShowPassword
|
||||
}
|
||||
onClick={handleShowPassword}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
@@ -529,9 +493,7 @@ export const UserLoginManual = () => {
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={
|
||||
handleCheckRememberMe
|
||||
}
|
||||
onChange={handleCheckRememberMe}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
@@ -563,8 +525,7 @@ export const UserLoginManual = () => {
|
||||
</Grid>
|
||||
<Grid sx={{ width: "100%" }}>
|
||||
<Typography variant="subtitle2">
|
||||
{server.isSuccess &&
|
||||
server.data.LoginDisclaimer}
|
||||
{server.isSuccess && server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
+65
-112
@@ -1,12 +1,12 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useState, useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
@@ -18,18 +18,18 @@ import {
|
||||
ItemFields,
|
||||
LocationType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
import { Card } from "../../components/card/card";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./person.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import "./person.module.scss";
|
||||
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
@@ -68,7 +68,7 @@ const PersonTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -104,7 +104,7 @@ const PersonTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personShows = useQuery({
|
||||
@@ -121,7 +121,7 @@ const PersonTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ const PersonTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personPhotos = useQuery({
|
||||
@@ -155,7 +155,7 @@ const PersonTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personEpisodes = useQuery({
|
||||
@@ -173,7 +173,7 @@ const PersonTitlePage = () => {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -215,15 +215,15 @@ const PersonTitlePage = () => {
|
||||
personPhotos.isSuccess &&
|
||||
personEpisodes.isSuccess
|
||||
) {
|
||||
if (personMovies.data.TotalRecordCount != 0) {
|
||||
if (personMovies.data.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(0);
|
||||
} else if (personShows.data.TotalRecordCount != 0) {
|
||||
} else if (personShows.data.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(1);
|
||||
} else if (personBooks.data.TotalRecordCount != 0) {
|
||||
} else if (personBooks.data.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(2);
|
||||
} else if (personPhotos.data.TotalRecordCount != 0) {
|
||||
} else if (personPhotos.data.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(3);
|
||||
} else if (personEpisodes.data.TotalRecordCount != 0) {
|
||||
} else if (personEpisodes.data.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(4);
|
||||
}
|
||||
}
|
||||
@@ -314,11 +314,7 @@ const PersonTitlePage = () => {
|
||||
<Tab
|
||||
key={index}
|
||||
label={tab.title}
|
||||
disabled={
|
||||
tab.data.data
|
||||
?.TotalRecordCount ==
|
||||
0
|
||||
}
|
||||
disabled={tab.data.data?.TotalRecordCount === 0}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
@@ -328,33 +324,26 @@ const PersonTitlePage = () => {
|
||||
<AnimatePresence>
|
||||
{personTabs.map((tab, index) => {
|
||||
return (
|
||||
<TabPanel
|
||||
value={activePersonTab}
|
||||
index={index}
|
||||
key={tab.title}
|
||||
>
|
||||
<TabPanel value={activePersonTab} index={index} key={tab.title}>
|
||||
<motion.div
|
||||
className={`item-detail-person-cards ${
|
||||
tab.title == "Movies" ||
|
||||
tab.title ==
|
||||
"TV Shows" ||
|
||||
tab.title == "Books"
|
||||
? `col-8`
|
||||
: `col-4`
|
||||
tab.title === "Movies" ||
|
||||
tab.title === "TV Shows" ||
|
||||
tab.title === "Books"
|
||||
? "col-8"
|
||||
: "col-4"
|
||||
}`}
|
||||
key={tab.queryKey}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection ==
|
||||
"forward"
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform:
|
||||
"translate(0px)",
|
||||
transform: "translate(0px)",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
@@ -362,87 +351,51 @@ const PersonTitlePage = () => {
|
||||
}}
|
||||
>
|
||||
{tab.data.isSuccess &&
|
||||
tab.data.data.Items.map(
|
||||
(
|
||||
tabitem,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<Card
|
||||
key={
|
||||
tabitem.Id
|
||||
}
|
||||
item={
|
||||
tabitem
|
||||
}
|
||||
cardTitle={
|
||||
tabitem.Type ==
|
||||
BaseItemKind.Episode
|
||||
? tabitem.SeriesName
|
||||
: tabitem.Name
|
||||
}
|
||||
imageType={
|
||||
"Primary"
|
||||
}
|
||||
cardCaption={
|
||||
tabitem.Type ==
|
||||
BaseItemKind.Episode
|
||||
? `S${tabitem.ParentIndexNumber}:E${tabitem.IndexNumber} - ${tabitem.Name}`
|
||||
: tabitem.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
tabitem.ProductionYear
|
||||
} - ${
|
||||
!!tabitem.EndDate
|
||||
tab.data.data.Items.map((tabitem, index) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
item={tabitem}
|
||||
cardTitle={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? tabitem.SeriesName
|
||||
: tabitem.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? `S${tabitem.ParentIndexNumber}:E${tabitem.IndexNumber} - ${tabitem.Name}`
|
||||
: tabitem.Type === BaseItemKind.Series
|
||||
? `${tabitem.ProductionYear} - ${
|
||||
tabitem.EndDate
|
||||
? new Date(
|
||||
tabitem.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: tabitem.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
tabitem.Type ==
|
||||
BaseItemKind.Episode
|
||||
? "thumb"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={
|
||||
tab.queryKey
|
||||
}
|
||||
userId={
|
||||
user
|
||||
.data
|
||||
.Id
|
||||
}
|
||||
imageBlurhash={
|
||||
!!tabitem
|
||||
.ImageBlurHashes
|
||||
?.Primary &&
|
||||
tabitem
|
||||
.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
tabitem
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
},
|
||||
)}
|
||||
: tabitem.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
tabitem.Type === BaseItemKind.Episode
|
||||
? "thumb"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={tab.queryKey}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
{tab.data.isSuccess &&
|
||||
tab.data.data
|
||||
.TotalRecordCount >
|
||||
24 && (
|
||||
tab.data.data.TotalRecordCount > 24 && (
|
||||
<Typography
|
||||
variant="h6"
|
||||
style={{
|
||||
|
||||
+131
-275
@@ -1,51 +1,51 @@
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
/** @format */
|
||||
import React from "react";
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
|
||||
import Backdrop from "@mui/material/Backdrop";
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Backdrop from "@mui/material/Backdrop";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import ReactPlayer from "react-player";
|
||||
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
||||
import { MdiPlay } from "../../components/icons/mdiPlay";
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useRef, useState, useCallback, useEffect } from "react";
|
||||
import { secToTicks, ticksToSec } from "../../utils/date/time";
|
||||
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getMediaInfoApi } from "@jellyfin/sdk/lib/utils/api/media-info-api";
|
||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import "./videoPlayer.module.scss";
|
||||
import { MdiPause } from "../../components/icons/mdiPause";
|
||||
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||
import { MdiFullscreen } from "../../components/icons/mdiFullscreen";
|
||||
import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
|
||||
import { MdiPause } from "../../components/icons/mdiPause";
|
||||
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
|
||||
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
|
||||
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
|
||||
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
|
||||
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
|
||||
import "./videoPlayer.module.scss";
|
||||
|
||||
import { endsAt } from "../../utils/date/time";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { MdiCog } from "../../components/icons/mdiCog";
|
||||
import { MdiSkipNext } from "../../components/icons/mdiSkipNext";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import { ItemFields, LocationType } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import { MdiSkipPrevious } from "../../components/icons/mdiSkipPrevious";
|
||||
|
||||
import { useApi } from "../../utils/store/api";
|
||||
@@ -133,7 +133,7 @@ export const VideoPlayer = () => {
|
||||
});
|
||||
|
||||
const currentEpisodeIndex = episodes.data?.Items?.findIndex(
|
||||
(item) => item.Id == itemId,
|
||||
(item) => item.Id === itemId,
|
||||
);
|
||||
|
||||
const [currentSubtrack] = useState(subtitleStreamIndex);
|
||||
@@ -157,13 +157,11 @@ export const VideoPlayer = () => {
|
||||
const timeToStart = ticksToSec(startPosition);
|
||||
await getPlaystateApi(api).reportPlaybackStart({
|
||||
playbackStartInfo: {
|
||||
PlayMethod: mediaInfo.data?.MediaSources[0]
|
||||
.SupportsDirectPlay
|
||||
PlayMethod: mediaInfo.data?.MediaSources[0].SupportsDirectPlay
|
||||
? "DirectPlay"
|
||||
: mediaInfo.data?.MediaSources[0]
|
||||
.SupportsDirectStream
|
||||
? "DirectStream"
|
||||
: "Transcode",
|
||||
: mediaInfo.data?.MediaSources[0].SupportsDirectStream
|
||||
? "DirectStream"
|
||||
: "Transcode",
|
||||
AudioStreamIndex: audioStreamIndex,
|
||||
SubtitleStreamIndex: subtitleStreamIndex,
|
||||
userId: userId,
|
||||
@@ -181,9 +179,9 @@ export const VideoPlayer = () => {
|
||||
|
||||
const handleDisplayCurrentTime = () => {
|
||||
let time = ticksToSec(progress * itemDuration);
|
||||
let hr = Math.floor(time / 3600);
|
||||
const hr = Math.floor(time / 3600);
|
||||
time -= hr * 3600;
|
||||
let min = Math.floor(time / 60);
|
||||
const min = Math.floor(time / 60);
|
||||
time -= min * 60;
|
||||
return `${hr.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
@@ -199,9 +197,9 @@ export const VideoPlayer = () => {
|
||||
|
||||
const handleDisplayTime = (ticks) => {
|
||||
let time = ticksToSec(ticks);
|
||||
let hr = Math.floor(time / 3600);
|
||||
const hr = Math.floor(time / 3600);
|
||||
time -= hr * 3600;
|
||||
let min = Math.floor(time / 60);
|
||||
const min = Math.floor(time / 60);
|
||||
time -= min * 60;
|
||||
return `${hr.toLocaleString([], {
|
||||
minimumIntegerDigits: 2,
|
||||
@@ -231,18 +229,16 @@ export const VideoPlayer = () => {
|
||||
setMediaSourceId(episodes.data.Items[currentEpisodeIndex + 1].Id);
|
||||
|
||||
setUrl(
|
||||
`${api.basePath}/Videos/${
|
||||
episodes.data.Items[currentEpisodeIndex + 1].Id
|
||||
}/stream.
|
||||
${episodes.data.Items[currentEpisodeIndex + 1].MediaSources[0].Container}
|
||||
`${api.basePath}/Videos/${episodes.data.Items[currentEpisodeIndex + 1].Id}/stream.
|
||||
${
|
||||
episodes.data.Items[currentEpisodeIndex + 1].MediaSources[0]
|
||||
.Container
|
||||
}
|
||||
?Static=true&mediaSourceId=${
|
||||
episodes.data.Items[currentEpisodeIndex + 1].Id
|
||||
}&deviceId=${api.deviceInfo.id}&api_key=${
|
||||
api.accessToken
|
||||
}&Tag=${
|
||||
episodes.data.Items[currentEpisodeIndex + 1].MediaSources[0]
|
||||
.ETag
|
||||
}&videoStreamIndex=${0}&audioStreamIndex=${0}`,
|
||||
}&deviceId=${api.deviceInfo.id}&api_key=${api.accessToken}&Tag=${
|
||||
episodes.data.Items[currentEpisodeIndex + 1].MediaSources[0].ETag
|
||||
}&videoStreamIndex=${0}&audioStreamIndex=${0}`,
|
||||
);
|
||||
setPosition(
|
||||
episodes.data.Items[currentEpisodeIndex + 1].UserData
|
||||
@@ -250,15 +246,12 @@ export const VideoPlayer = () => {
|
||||
);
|
||||
|
||||
setSeriesId(episodes.data.Items[currentEpisodeIndex + 1].SeriesId);
|
||||
if (
|
||||
episodes.data.Items[currentEpisodeIndex + 1].ImageBlurHashes.Logo
|
||||
) {
|
||||
if (episodes.data.Items[currentEpisodeIndex + 1].ImageBlurHashes.Logo) {
|
||||
setItemName(
|
||||
<div className="video-osd-name">
|
||||
<img
|
||||
src={`${api.basePath}/Items/${
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.SeriesId
|
||||
episodes.data.Items[currentEpisodeIndex + 1].SeriesId
|
||||
}/Images/Logo`}
|
||||
className="video-osd-name-logo"
|
||||
onLoad={(e) => {
|
||||
@@ -266,20 +259,10 @@ export const VideoPlayer = () => {
|
||||
}}
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
S
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.ParentIndexNumber
|
||||
}
|
||||
S{episodes.data.Items[currentEpisodeIndex + 1].ParentIndexNumber}
|
||||
:E
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.IndexNumber
|
||||
}{" "}
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.Name
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex + 1].IndexNumber}{" "}
|
||||
{episodes.data.Items[currentEpisodeIndex + 1].Name}
|
||||
</Typography>
|
||||
</div>,
|
||||
);
|
||||
@@ -287,35 +270,20 @@ export const VideoPlayer = () => {
|
||||
setItemName(
|
||||
<div className="video-osd-name">
|
||||
<Typography variant="h6">
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.SeriesName
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex + 1].SeriesName}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
S
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.ParentIndexNumber
|
||||
}
|
||||
S{episodes.data.Items[currentEpisodeIndex + 1].ParentIndexNumber}
|
||||
:E
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.IndexNumber
|
||||
}{" "}
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex + 1]
|
||||
.Name
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex + 1].IndexNumber}{" "}
|
||||
{episodes.data.Items[currentEpisodeIndex + 1].Name}
|
||||
</Typography>
|
||||
</div>,
|
||||
);
|
||||
}
|
||||
|
||||
setItemId(episodes.data.Items[currentEpisodeIndex + 1].Id);
|
||||
setDurationStore(
|
||||
episodes.data.Items[currentEpisodeIndex + 1].RunTimeTicks,
|
||||
);
|
||||
setDurationStore(episodes.data.Items[currentEpisodeIndex + 1].RunTimeTicks);
|
||||
|
||||
// navigate("player");
|
||||
};
|
||||
@@ -335,18 +303,16 @@ export const VideoPlayer = () => {
|
||||
setMediaSourceId(episodes.data.Items[currentEpisodeIndex - 1].Id);
|
||||
|
||||
setUrl(
|
||||
`${api.basePath}/Videos/${
|
||||
episodes.data.Items[currentEpisodeIndex - 1].Id
|
||||
}/stream.
|
||||
${episodes.data.Items[currentEpisodeIndex - 1].MediaSources[0].Container}
|
||||
`${api.basePath}/Videos/${episodes.data.Items[currentEpisodeIndex - 1].Id}/stream.
|
||||
${
|
||||
episodes.data.Items[currentEpisodeIndex - 1].MediaSources[0]
|
||||
.Container
|
||||
}
|
||||
?Static=true&mediaSourceId=${
|
||||
episodes.data.Items[currentEpisodeIndex - 1].Id
|
||||
}&deviceId=${api.deviceInfo.id}&api_key=${
|
||||
api.accessToken
|
||||
}&Tag=${
|
||||
episodes.data.Items[currentEpisodeIndex - 1].MediaSources[0]
|
||||
.ETag
|
||||
}&videoStreamIndex=${0}&audioStreamIndex=${0}`,
|
||||
}&deviceId=${api.deviceInfo.id}&api_key=${api.accessToken}&Tag=${
|
||||
episodes.data.Items[currentEpisodeIndex - 1].MediaSources[0].ETag
|
||||
}&videoStreamIndex=${0}&audioStreamIndex=${0}`,
|
||||
);
|
||||
setPosition(
|
||||
episodes.data.Items[currentEpisodeIndex - 1].UserData
|
||||
@@ -354,15 +320,12 @@ export const VideoPlayer = () => {
|
||||
);
|
||||
|
||||
setSeriesId(episodes.data.Items[currentEpisodeIndex - 1].SeriesId);
|
||||
if (
|
||||
episodes.data.Items[currentEpisodeIndex - 1].ImageBlurHashes.Logo
|
||||
) {
|
||||
if (episodes.data.Items[currentEpisodeIndex - 1].ImageBlurHashes.Logo) {
|
||||
setItemName(
|
||||
<div className="video-osd-name">
|
||||
<img
|
||||
src={`${api.basePath}/Items/${
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.SeriesId
|
||||
episodes.data.Items[currentEpisodeIndex - 1].SeriesId
|
||||
}/Images/Logo`}
|
||||
className="video-osd-name-logo"
|
||||
onLoad={(e) => {
|
||||
@@ -370,20 +333,10 @@ export const VideoPlayer = () => {
|
||||
}}
|
||||
/>
|
||||
<Typography variant="subtitle1">
|
||||
S
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.ParentIndexNumber
|
||||
}
|
||||
S{episodes.data.Items[currentEpisodeIndex - 1].ParentIndexNumber}
|
||||
:E
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.IndexNumber
|
||||
}{" "}
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.Name
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex - 1].IndexNumber}{" "}
|
||||
{episodes.data.Items[currentEpisodeIndex - 1].Name}
|
||||
</Typography>
|
||||
</div>,
|
||||
);
|
||||
@@ -391,35 +344,20 @@ export const VideoPlayer = () => {
|
||||
setItemName(
|
||||
<div className="video-osd-name">
|
||||
<Typography variant="h6">
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.SeriesName
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex - 1].SeriesName}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
S
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.ParentIndexNumber
|
||||
}
|
||||
S{episodes.data.Items[currentEpisodeIndex - 1].ParentIndexNumber}
|
||||
:E
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.IndexNumber
|
||||
}{" "}
|
||||
{
|
||||
episodes.data.Items[currentEpisodeIndex - 1]
|
||||
.Name
|
||||
}
|
||||
{episodes.data.Items[currentEpisodeIndex - 1].IndexNumber}{" "}
|
||||
{episodes.data.Items[currentEpisodeIndex - 1].Name}
|
||||
</Typography>
|
||||
</div>,
|
||||
);
|
||||
}
|
||||
|
||||
setItemId(episodes.data.Items[currentEpisodeIndex - 1].Id);
|
||||
setDurationStore(
|
||||
episodes.data.Items[currentEpisodeIndex - 1].RunTimeTicks,
|
||||
);
|
||||
setDurationStore(episodes.data.Items[currentEpisodeIndex - 1].RunTimeTicks);
|
||||
|
||||
// navigate("player");
|
||||
};
|
||||
@@ -428,7 +366,7 @@ export const VideoPlayer = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (showControls) {
|
||||
let timeout = setTimeout(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 5000);
|
||||
return () => {
|
||||
@@ -440,14 +378,10 @@ export const VideoPlayer = () => {
|
||||
const handleKeyPress = useCallback((event) => {
|
||||
switch (event.key) {
|
||||
case "ArrowRight":
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() + 15,
|
||||
);
|
||||
playerRef.current.seekTo(playerRef.current.getCurrentTime() + 15);
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() - 15,
|
||||
);
|
||||
playerRef.current.seekTo(playerRef.current.getCurrentTime() - 15);
|
||||
break;
|
||||
case " ":
|
||||
setIsPlaying((state) => !state);
|
||||
@@ -551,12 +485,11 @@ export const VideoPlayer = () => {
|
||||
}
|
||||
await getPlaystateApi(api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
PlayMethod: mediaInfo.data?.MediaSources[0]
|
||||
.SupportsDirectPlay
|
||||
PlayMethod: mediaInfo.data?.MediaSources[0].SupportsDirectPlay
|
||||
? "DirectPlay"
|
||||
: mediaInfo.data?.MediaSources[0].SupportsDirectStream
|
||||
? "DirectStream"
|
||||
: "Transcode",
|
||||
? "DirectStream"
|
||||
: "Transcode",
|
||||
ItemId: itemId,
|
||||
IsMuted: isMuted,
|
||||
PositionTicks: secToTicks(e.playedSeconds),
|
||||
@@ -571,7 +504,7 @@ export const VideoPlayer = () => {
|
||||
PlaySessionId: mediaInfo.data?.PlaySessionId,
|
||||
},
|
||||
});
|
||||
if (Math.round(e.playedSeconds) == ticksToSec(itemDuration)) {
|
||||
if (Math.round(e.playedSeconds) === ticksToSec(itemDuration)) {
|
||||
handleOnEnd();
|
||||
}
|
||||
};
|
||||
@@ -640,11 +573,7 @@ export const VideoPlayer = () => {
|
||||
<CircularProgress />
|
||||
</div>
|
||||
<Backdrop
|
||||
className={
|
||||
showControls
|
||||
? "video-osd video-osd-visible"
|
||||
: "video-osd"
|
||||
}
|
||||
className={showControls ? "video-osd video-osd-visible" : "video-osd"}
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
@@ -686,9 +615,7 @@ export const VideoPlayer = () => {
|
||||
justifyContent="center"
|
||||
gap={2}
|
||||
>
|
||||
<Typography variant="h6">
|
||||
{handleDisplayCurrentTime()}
|
||||
</Typography>
|
||||
<Typography variant="h6">{handleDisplayCurrentTime()}</Typography>
|
||||
<Slider
|
||||
value={currentTime ? currentTime : 0}
|
||||
step={0.01}
|
||||
@@ -698,16 +625,12 @@ export const VideoPlayer = () => {
|
||||
setCurrentTime(newVal);
|
||||
}}
|
||||
onChangeCommitted={(e, newVal) => {
|
||||
playerRef.current.seekTo(
|
||||
ticksToSec(newVal),
|
||||
);
|
||||
playerRef.current.seekTo(ticksToSec(newVal));
|
||||
setCurrentTime(newVal);
|
||||
setIsSeeking(false);
|
||||
}}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
handleDisplayTime(value)
|
||||
}
|
||||
valueLabelFormat={(value) => handleDisplayTime(value)}
|
||||
// size="medium"
|
||||
sx={{
|
||||
"& .MuiSlider-valueLabel": {
|
||||
@@ -718,14 +641,11 @@ export const VideoPlayer = () => {
|
||||
padding: 1,
|
||||
borderRadius: "10px",
|
||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||
boxShadow:
|
||||
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform:
|
||||
"translatey(-120%) scale(0)",
|
||||
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform: "translatey(-120%) scale(0)",
|
||||
"&:before": { display: "none" },
|
||||
"&.MuiSlider-valueLabelOpen": {
|
||||
transform:
|
||||
"translateY(-120%) scale(1)",
|
||||
transform: "translateY(-120%) scale(1)",
|
||||
},
|
||||
"& > *": {
|
||||
transform: "rotate(0deg)",
|
||||
@@ -752,65 +672,46 @@ export const VideoPlayer = () => {
|
||||
onClick={handlePlayPrevEpisode}
|
||||
disabled={
|
||||
seriesId
|
||||
? episodes.isPending ||
|
||||
currentEpisodeIndex == 0
|
||||
? episodes.isPending || currentEpisodeIndex === 0
|
||||
: true
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">skip_previous</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() - 15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">fast_rewind</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={() => setIsPlaying((state) => !state)}>
|
||||
<div className="material-symbols-rounded">
|
||||
skip_previous
|
||||
{isPlaying ? "pause" : "play_arrow"}
|
||||
</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() -
|
||||
15,
|
||||
playerRef.current.getCurrentTime() + 15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
fast_rewind
|
||||
</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
setIsPlaying((state) => !state)
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
{isPlaying
|
||||
? "pause"
|
||||
: "play_arrow"}
|
||||
</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() +
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
fast_forward
|
||||
</div>
|
||||
<div className="material-symbols-rounded">fast_forward</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={handlePlayNextEpisode}
|
||||
disabled={
|
||||
seriesId
|
||||
? episodes.isPending ||
|
||||
episodes.data
|
||||
?.TotalRecordCount ==
|
||||
currentEpisodeIndex +
|
||||
1
|
||||
episodes.data?.TotalRecordCount ===
|
||||
currentEpisodeIndex + 1
|
||||
: true
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
skip_next
|
||||
</div>
|
||||
<div className="material-symbols-rounded">skip_next</div>
|
||||
</IconButton>
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(itemDuration - currentTime)}
|
||||
@@ -826,12 +727,9 @@ export const VideoPlayer = () => {
|
||||
<Menu
|
||||
anchorEl={speedMenuEl}
|
||||
open={speedMenuState}
|
||||
onClose={() =>
|
||||
setSpeedMenuEl(null)
|
||||
}
|
||||
onClose={() => setSpeedMenuEl(null)}
|
||||
MenuListProps={{
|
||||
"aria-labelledby":
|
||||
"lock-button",
|
||||
"aria-labelledby": "lock-button",
|
||||
role: "listbox",
|
||||
}}
|
||||
anchorOrigin={{
|
||||
@@ -846,70 +744,45 @@ export const VideoPlayer = () => {
|
||||
mb: 20,
|
||||
}}
|
||||
>
|
||||
{availableSpeeds.map(
|
||||
(sspeed, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={sspeed}
|
||||
selected={
|
||||
index ===
|
||||
speed
|
||||
}
|
||||
onClick={() => {
|
||||
setSpeed(
|
||||
index,
|
||||
);
|
||||
setSpeedMenuEl(
|
||||
null,
|
||||
);
|
||||
}}
|
||||
sx={{
|
||||
width: 160,
|
||||
}}
|
||||
>
|
||||
{sspeed}x
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
{availableSpeeds.map((sspeed, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={sspeed}
|
||||
selected={index === speed}
|
||||
onClick={() => {
|
||||
setSpeed(index);
|
||||
setSpeedMenuEl(null);
|
||||
}}
|
||||
sx={{
|
||||
width: 160,
|
||||
}}
|
||||
>
|
||||
{sspeed}x
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</Menu>
|
||||
<IconButton
|
||||
onClick={(e) =>
|
||||
setSpeedMenuEl(
|
||||
e.currentTarget,
|
||||
)
|
||||
}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
pace
|
||||
</div>
|
||||
<IconButton onClick={(e) => setSpeedMenuEl(e.currentTarget)}>
|
||||
<div className="material-symbols-rounded">pace</div>
|
||||
</IconButton>
|
||||
</Box>
|
||||
<IconButton
|
||||
sx={{
|
||||
ml: 0.1,
|
||||
}}
|
||||
onClick={() =>
|
||||
setIsMuted((state) => !state)
|
||||
}
|
||||
onClick={() => setIsMuted((state) => !state)}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
{isMuted
|
||||
? "volume_mute"
|
||||
: "volume_up"}
|
||||
{isMuted ? "volume_mute" : "volume_up"}
|
||||
</div>
|
||||
</IconButton>
|
||||
<Slider
|
||||
value={isMuted ? 0 : volume * 100}
|
||||
step={1}
|
||||
max={100}
|
||||
onChange={(e, newVal) =>
|
||||
setVolume(newVal / 100)
|
||||
}
|
||||
onChange={(e, newVal) => setVolume(newVal / 100)}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
Math.floor(value)
|
||||
}
|
||||
valueLabelFormat={(value) => Math.floor(value)}
|
||||
size="small"
|
||||
sx={{
|
||||
mr: 1,
|
||||
@@ -918,27 +791,21 @@ export const VideoPlayer = () => {
|
||||
"& .MuiSlider-valueLabel": {
|
||||
lineHeight: 1.2,
|
||||
fontSize: 24,
|
||||
background:
|
||||
"rgb(0 0 0 / 0.5)",
|
||||
background: "rgb(0 0 0 / 0.5)",
|
||||
backdropFilter: "blur(5px)",
|
||||
padding: 1,
|
||||
borderRadius: "10px",
|
||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||
boxShadow:
|
||||
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform:
|
||||
"translatey(-120%) scale(0)",
|
||||
boxShadow: "0 0 10px rgb(0 0 0 / 0.4) ",
|
||||
transform: "translatey(-120%) scale(0)",
|
||||
"&:before": {
|
||||
display: "none",
|
||||
},
|
||||
"&.MuiSlider-valueLabelOpen":
|
||||
{
|
||||
transform:
|
||||
"translateY(-120%) scale(1)",
|
||||
},
|
||||
"&.MuiSlider-valueLabelOpen": {
|
||||
transform: "translateY(-120%) scale(1)",
|
||||
},
|
||||
"& > *": {
|
||||
transform:
|
||||
"rotate(0deg)",
|
||||
transform: "rotate(0deg)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
@@ -953,22 +820,14 @@ export const VideoPlayer = () => {
|
||||
sx={{ padding: 2 }}
|
||||
>
|
||||
<Stack direction="row">
|
||||
<Typography variant="h6">
|
||||
Subtitle
|
||||
</Typography>
|
||||
<Typography variant="h6">Subtitle</Typography>
|
||||
</Stack>
|
||||
</Menu>
|
||||
<IconButton
|
||||
onClick={(e) =>
|
||||
setSettingsMenuEl(
|
||||
e.currentTarget,
|
||||
)
|
||||
}
|
||||
onClick={(e) => setSettingsMenuEl(e.currentTarget)}
|
||||
disabled
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
settings
|
||||
</div>
|
||||
<div className="material-symbols-rounded">settings</div>
|
||||
</IconButton>
|
||||
</Box>
|
||||
<IconButton
|
||||
@@ -982,15 +841,12 @@ export const VideoPlayer = () => {
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={async () => {
|
||||
let fstate =
|
||||
await appWindow.isFullscreen();
|
||||
const fstate = await appWindow.isFullscreen();
|
||||
setAppFullScreen(!fstate);
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
{appFullscreen
|
||||
? "fullscreen_exit"
|
||||
: "fullscreen"}
|
||||
{appFullscreen ? "fullscreen_exit" : "fullscreen"}
|
||||
</div>
|
||||
</IconButton>
|
||||
</Stack>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import PropTypes from "prop-types";
|
||||
/** @format */
|
||||
import React, { useEffect } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
@@ -8,22 +8,22 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getPlaylistsApi } from "@jellyfin/sdk/lib/utils/api/playlists-api";
|
||||
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 Hero from "../../components/layouts/item/hero";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import Hero from "../../components/layouts/item/hero";
|
||||
|
||||
import "./playlist.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import MusicTrack from "../../components/musicTrack";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
import "./playlist.module.scss";
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
@@ -61,7 +61,7 @@ const PlaylistTitlePage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -86,7 +86,7 @@ const PlaylistTitlePage = () => {
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
let result = await getLibraryApi(api).getSimilarAlbums({
|
||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
@@ -192,58 +192,36 @@ const PlaylistTitlePage = () => {
|
||||
item={similar}
|
||||
seriesId={similar.SeriesId}
|
||||
cardTitle={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? similar.SeriesName
|
||||
: similar.Name
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
similar.Type ==
|
||||
BaseItemKind.Episode
|
||||
similar.Type === BaseItemKind.Episode
|
||||
? `S${similar.ParentIndexNumber}:E${similar.IndexNumber} - ${similar.Name}`
|
||||
: similar.Type ==
|
||||
BaseItemKind.Series
|
||||
? `${
|
||||
similar.ProductionYear
|
||||
} - ${
|
||||
similar.EndDate
|
||||
? new Date(
|
||||
similar.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
similar.Type === BaseItemKind.MusicAlbum ||
|
||||
similar.Type === BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
]}
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!similar.ImageBlurHashes
|
||||
?.Primary &&
|
||||
similar.ImageBlurHashes
|
||||
?.Primary[
|
||||
Object.keys(
|
||||
similar
|
||||
.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
!!similar.ImageBlurHashes?.Primary &&
|
||||
similar.ImageBlurHashes?.Primary[
|
||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
|
||||
+78
-177
@@ -1,9 +1,9 @@
|
||||
/** @format */
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import TextField from "@mui/material/TextField";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||
|
||||
@@ -16,13 +16,13 @@ import { EmptyNotice } from "../../components/notices/emptyNotice/emptyNotice";
|
||||
|
||||
import useDebounce from "../../utils/hooks/useDebounce";
|
||||
|
||||
import "./search.module.scss";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { Card } from "../../components/card/card";
|
||||
import { CardScroller } from "../../components/cardScroller/cardScroller";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import "./search.module.scss";
|
||||
|
||||
const SearchPage = () => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
@@ -33,7 +33,7 @@ const SearchPage = () => {
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
let usr = await getUserApi(api).getCurrentUser();
|
||||
const usr = await getUserApi(api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
networkMode: "always",
|
||||
@@ -193,12 +193,9 @@ const SearchPage = () => {
|
||||
<CircularProgress
|
||||
style={{
|
||||
position: "absolute",
|
||||
transition:
|
||||
"opacity 250ms",
|
||||
transition: "opacity 250ms",
|
||||
opacity:
|
||||
Boolean(
|
||||
searchTerm,
|
||||
) &&
|
||||
Boolean(searchTerm) &&
|
||||
(movies.isPending ||
|
||||
series.isPending ||
|
||||
audio.isPending ||
|
||||
@@ -226,11 +223,7 @@ const SearchPage = () => {
|
||||
}}
|
||||
>
|
||||
{movies.isSuccess && movies.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Movies"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Movies" displayCards={8} disableDecoration>
|
||||
{movies.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -239,20 +232,12 @@ const SearchPage = () => {
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"Movie",
|
||||
searchParam,
|
||||
]}
|
||||
queryKey={["search", "items", "Movie", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -260,43 +245,27 @@ const SearchPage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{series.isSuccess && series.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="TV Shows"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="TV Shows" displayCards={8} disableDecoration>
|
||||
{series.data.Items.map((item, index) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={`${
|
||||
item.ProductionYear
|
||||
} - ${
|
||||
!!item.EndDate
|
||||
? new Date(
|
||||
item.EndDate,
|
||||
).toLocaleString([], {
|
||||
cardCaption={`${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`}
|
||||
cardType="portrait"
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"Series",
|
||||
searchParam,
|
||||
]}
|
||||
queryKey={["search", "items", "Series", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -304,11 +273,7 @@ const SearchPage = () => {
|
||||
</CardScroller>
|
||||
)}
|
||||
{audio.isSuccess && audio.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Audio"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Audio" displayCards={8} disableDecoration>
|
||||
{audio.data.Items.map((item, index) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -317,69 +282,43 @@ const SearchPage = () => {
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="square"
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"Audio",
|
||||
searchParam,
|
||||
]}
|
||||
queryKey={["search", "items", "Audio", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess && musicAlbum.data.Items.length > 0 && (
|
||||
<CardScroller title="Albums" displayCards={8} disableDecoration>
|
||||
{musicAlbum.data.Items.map((item, index) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
seriesId={item.SeriesId}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicAlbum", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess &&
|
||||
musicAlbum.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Albums"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{musicAlbum.data.Items.map((item, index) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
seriesId={item.SeriesId}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"MusicAlbum",
|
||||
searchParam,
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{book.isSuccess && book.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Books"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="Books" displayCards={8} disableDecoration>
|
||||
{book.data.Items.map((item, index) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -389,68 +328,42 @@ const SearchPage = () => {
|
||||
cardCaption={item.ProductionYear}
|
||||
disableOverlay
|
||||
cardType={"portrait"}
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"Book",
|
||||
searchParam,
|
||||
]}
|
||||
queryKey={["search", "items", "Book", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess && musicArtists.data.Items.length > 0 && (
|
||||
<CardScroller title="Artists" displayCards={8} disableDecoration>
|
||||
{musicArtists.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicArtists", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess &&
|
||||
musicArtists.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="Artists"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{musicArtists.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"MusicArtists",
|
||||
searchParam,
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes
|
||||
?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && person.data.Items.length > 0 && (
|
||||
<CardScroller
|
||||
title="People"
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
<CardScroller title="People" displayCards={8} disableDecoration>
|
||||
{person.data.Items.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
@@ -459,20 +372,12 @@ const SearchPage = () => {
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={[
|
||||
"search",
|
||||
"items",
|
||||
"Person",
|
||||
searchParam,
|
||||
]}
|
||||
queryKey={["search", "items", "Person", searchParam]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(
|
||||
item.ImageBlurHashes
|
||||
.Primary,
|
||||
)[0]
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
@@ -488,23 +393,19 @@ const SearchPage = () => {
|
||||
book.isSuccess &&
|
||||
musicArtists.isSuccess &&
|
||||
person.isSuccess &&
|
||||
movies.data.Items.length == 0 &&
|
||||
series.data.Items.length == 0 &&
|
||||
audio.data.Items.length == 0 &&
|
||||
musicAlbum.data.Items.length == 0 &&
|
||||
book.data.Items.length == 0 &&
|
||||
musicArtists.data.Items.length == 0 &&
|
||||
person.data.Items.length == 0 && (
|
||||
movies.data.Items.length === 0 &&
|
||||
series.data.Items.length === 0 &&
|
||||
audio.data.Items.length === 0 &&
|
||||
musicAlbum.data.Items.length === 0 &&
|
||||
book.data.Items.length === 0 &&
|
||||
musicArtists.data.Items.length === 0 &&
|
||||
person.data.Items.length === 0 && (
|
||||
<div
|
||||
style={{
|
||||
height: "calc(100vh - 12em)",
|
||||
}}
|
||||
>
|
||||
<EmptyNotice
|
||||
extraMsg={
|
||||
"Try using different search terms."
|
||||
}
|
||||
/>
|
||||
<EmptyNotice extraMsg={"Try using different search terms."} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+227
-481
File diff suppressed because it is too large.
Load diff
@@ -5,31 +5,28 @@ import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { setDefaultServer, setServer } from "../../../utils/storage/servers";
|
||||
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Container from "@mui/material/Container";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
// MUI
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
import Container from "@mui/material/Container";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
|
||||
import { mdiChevronRight } from "@mdi/js";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import { yellow } from "@mui/material/colors";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { MdiInformation } from "../../../components/icons/mdiInformation.jsx";
|
||||
import { createApi, useApi } from "../../../utils/store/api";
|
||||
// SCSS
|
||||
import "./server.module.scss";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { createApi, useApi } from "../../../utils/store/api";
|
||||
import { MdiInformation } from "../../../components/icons/mdiInformation.jsx";
|
||||
import { yellow } from "@mui/material/colors";
|
||||
|
||||
export const ServerSetup = () => {
|
||||
|
||||
const [jellyfin] = useApi((state) => [
|
||||
state.jellyfin,
|
||||
]);
|
||||
const [jellyfin] = useApi((state) => [state.jellyfin]);
|
||||
|
||||
const [serverIp, setServerIp] = useState("");
|
||||
|
||||
@@ -37,13 +34,10 @@ export const ServerSetup = () => {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
||||
const checkServer = useMutation({
|
||||
mutationFn: async () => {
|
||||
const servers =
|
||||
await jellyfin.discovery.getRecommendedServerCandidates(
|
||||
serverIp,
|
||||
);
|
||||
await jellyfin.discovery.getRecommendedServerCandidates(serverIp);
|
||||
const bestServer = jellyfin.discovery.findBestServer(servers);
|
||||
return bestServer;
|
||||
},
|
||||
@@ -69,12 +63,9 @@ export const ServerSetup = () => {
|
||||
onSettled: (bestServer) => {
|
||||
console.log(bestServer);
|
||||
if (!bestServer) {
|
||||
enqueueSnackbar(
|
||||
`Provided server address is not a Jellyfin server.`,
|
||||
{
|
||||
variant: "error",
|
||||
},
|
||||
);
|
||||
enqueueSnackbar("Provided server address is not a Jellyfin server.", {
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -118,7 +109,7 @@ export const ServerSetup = () => {
|
||||
onChange={(event) => {
|
||||
setServerIp(event.target.value);
|
||||
}}
|
||||
></TextField>
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
|
||||
<LoadingButton
|
||||
@@ -128,7 +119,7 @@ export const ServerSetup = () => {
|
||||
loading={checkServer.isPending}
|
||||
endIcon={
|
||||
<SvgIcon>
|
||||
<path d={mdiChevronRight}></path>
|
||||
<path d={mdiChevronRight} />
|
||||
</SvgIcon>
|
||||
}
|
||||
loadingPosition="end"
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/** @format */
|
||||
import React, { useState } from "react";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
|
||||
import "./serverList.module.scss";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { AppBarBackOnly } from "../../../components/appBar/backOnly";
|
||||
import {
|
||||
delServer,
|
||||
getAllServers,
|
||||
getDefaultServer,
|
||||
setDefaultServer,
|
||||
} from "../../../utils/storage/servers";
|
||||
import { AppBarBackOnly } from "../../../components/appBar/backOnly";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { delUser } from "../../../utils/storage/user";
|
||||
import "./serverList.module.scss";
|
||||
|
||||
const ServerList = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -37,11 +36,11 @@ const ServerList = () => {
|
||||
const handleServerChange = useMutation({
|
||||
mutationFn: async () => {
|
||||
await delUser();
|
||||
console.log(serverState)
|
||||
console.log(serverState);
|
||||
await setDefaultServer(serverState);
|
||||
},
|
||||
onSuccess: async () => {
|
||||
navigate("/login/index")
|
||||
navigate("/login/index");
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error(error);
|
||||
@@ -53,8 +52,8 @@ const ServerList = () => {
|
||||
|
||||
const handleDelete = async (serverId) => {
|
||||
await delServer(serverId);
|
||||
|
||||
if (serverId == defaultServer.data) {
|
||||
|
||||
if (serverId === defaultServer.data) {
|
||||
await delUser();
|
||||
await servers.refetch();
|
||||
|
||||
@@ -67,7 +66,7 @@ const ServerList = () => {
|
||||
|
||||
servers.refetch();
|
||||
defaultServer.refetch();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="server-list">
|
||||
@@ -110,15 +109,12 @@ const ServerList = () => {
|
||||
}}
|
||||
>
|
||||
{server.systemInfo.ServerName}
|
||||
{server.id ==
|
||||
defaultServer.data && (
|
||||
{server.id === defaultServer.data && (
|
||||
<Chip
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={
|
||||
600
|
||||
}
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
Current
|
||||
@@ -149,8 +145,7 @@ const ServerList = () => {
|
||||
}}
|
||||
fontWeight={300}
|
||||
>
|
||||
Version:{" "}
|
||||
{server.systemInfo.Version}
|
||||
Version: {server.systemInfo.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="server-list-item-buttons">
|
||||
@@ -162,13 +157,9 @@ const ServerList = () => {
|
||||
setServerState(server.id);
|
||||
handleServerChange.mutate();
|
||||
}}
|
||||
disabled={
|
||||
handleServerChange.isPending
|
||||
}
|
||||
disabled={handleServerChange.isPending}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
start
|
||||
</div>
|
||||
<div className="material-symbols-rounded">start</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
style={{
|
||||
@@ -176,16 +167,12 @@ const ServerList = () => {
|
||||
|
||||
color: red[400],
|
||||
}}
|
||||
disabled={
|
||||
handleServerChange.isPending
|
||||
}
|
||||
disabled={handleServerChange.isPending}
|
||||
onClick={() => {
|
||||
handleDelete(server.id);
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
delete_forever
|
||||
</div>
|
||||
<div className="material-symbols-rounded">delete_forever</div>
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user