Fix few things
This commit is contained in:
11 files changed
+38
-113
No files matched your search
@@ -98,6 +98,7 @@ const MusicAlbumTitlePage = () => {
|
||||
let result = await getLibraryApi(window.api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -232,9 +233,6 @@ const MusicAlbumTitlePage = () => {
|
||||
justifySelf: "start",
|
||||
}}
|
||||
fontWeight={400}
|
||||
onClick={() => {
|
||||
console.log("Hvnrjn");
|
||||
}}
|
||||
>
|
||||
Name
|
||||
</Typography>
|
||||
|
||||
@@ -132,43 +132,6 @@ const ArtistTitlePage = () => {
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
let result;
|
||||
if (item.data.Type == "Movie") {
|
||||
result = await getLibraryApi(window.api).getSimilarMovies({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "Series") {
|
||||
result = await getLibraryApi(window.api).getSimilarShows({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicAlbum") {
|
||||
result = await getLibraryApi(window.api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicArtist") {
|
||||
result = await getLibraryApi(window.api).getSimilarArtists({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else {
|
||||
result = await getLibraryApi(window.api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
}
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess,
|
||||
networkMode: "always",
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
|
||||
const artistDiscography = useQuery({
|
||||
queryKey: ["item", id, "artist", "discography"],
|
||||
queryFn: async () => {
|
||||
@@ -266,7 +229,7 @@ const ArtistTitlePage = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
if (item.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -281,7 +244,7 @@ const ArtistTitlePage = () => {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && similarItems.isSuccess) {
|
||||
if (item.isSuccess) {
|
||||
return (
|
||||
<div
|
||||
className="scrollY"
|
||||
@@ -489,7 +452,7 @@ const ArtistTitlePage = () => {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (item.isError || similarItems.isError) {
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -101,33 +101,11 @@ const BoxSetTitlePage = () => {
|
||||
const similarItems = useQuery({
|
||||
queryKey: ["item", id, "similarItem"],
|
||||
queryFn: async () => {
|
||||
let result;
|
||||
if (item.data.Type == "Movie") {
|
||||
result = await getLibraryApi(window.api).getSimilarMovies({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "Series") {
|
||||
result = await getLibraryApi(window.api).getSimilarShows({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicAlbum") {
|
||||
result = await getLibraryApi(window.api).getSimilarAlbums({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else if (item.data.Type == "MusicArtist") {
|
||||
result = await getLibraryApi(window.api).getSimilarArtists({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
} else {
|
||||
result = await getLibraryApi(window.api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
});
|
||||
}
|
||||
const result = await getLibraryApi(window.api).getSimilarItems({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess,
|
||||
@@ -240,39 +218,13 @@ const BoxSetTitlePage = () => {
|
||||
}
|
||||
imageType={"Primary"}
|
||||
cardCaption={
|
||||
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(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
}
|
||||
cardType={
|
||||
similar.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
similar.Type ==
|
||||
BaseItemKind.Audio
|
||||
? "square"
|
||||
: "portrait"
|
||||
similar.ProductionYear
|
||||
}
|
||||
cardType={"portrait"}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
"similarItem",
|
||||
`collection`,
|
||||
]}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
@@ -139,6 +139,7 @@ const ItemDetail = () => {
|
||||
result = await getLibraryApi(window.api).getSimilarMovies({
|
||||
userId: user.data.Id,
|
||||
itemId: item.data.Id,
|
||||
limit: 16,
|
||||
});
|
||||
} else if (item.data.Type == "Series") {
|
||||
result = await getLibraryApi(window.api).getSimilarShows({
|
||||
@@ -566,6 +567,8 @@ const ItemDetail = () => {
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
const backdropRef = useRef(null);
|
||||
|
||||
if (item.isLoading || similarItems.isLoading) {
|
||||
return (
|
||||
<Box
|
||||
@@ -591,6 +594,7 @@ const ItemDetail = () => {
|
||||
flexDirection: "column",
|
||||
gap: "0.5em",
|
||||
}}
|
||||
ref={backdropRef}
|
||||
>
|
||||
<Hero
|
||||
item={item.data}
|
||||
@@ -601,6 +605,7 @@ const ItemDetail = () => {
|
||||
videoTracks={videoTracks}
|
||||
audioTracks={audioTracks}
|
||||
subtitleTracks={subtitleTracks}
|
||||
backdropRef={backdropRef}
|
||||
/>
|
||||
{item.data.People.length > 0 && (
|
||||
<CardScroller
|
||||
|
||||
Reference in new issue
Block a user