refactor: move more files to ts
This commit is contained in:
5 files changed
+258
-244
No files matched your search
@@ -204,14 +204,14 @@ const PlayButton = ({
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
result.data.Items?.[index]?.Id &&
|
result.data.Items?.[index].Id &&
|
||||||
result.data.Items?.[index].MediaSources?.[0]?.Id
|
result.data.Items?.[index].MediaSources?.[0]?.Id
|
||||||
) {
|
) {
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
audioStreamIndex: currentAudioTrack,
|
audioStreamIndex: currentAudioTrack,
|
||||||
subtitleStreamIndex:
|
subtitleStreamIndex:
|
||||||
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
itemId: result.data.Items?.[index].Id ?? "",
|
itemId: result.data.Items[index].Id ?? "",
|
||||||
startTimeTicks:
|
startTimeTicks:
|
||||||
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -226,6 +226,10 @@ const PlayButton = ({
|
|||||||
itemId: result.data.Items?.[index].Id ?? "",
|
itemId: result.data.Items?.[index].Id ?? "",
|
||||||
})
|
})
|
||||||
)?.data;
|
)?.data;
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`No media source id provieded for the episode. Return values are seriesId = ${result.data.Items?.[index].Id}, mediaSourceId = ${result.data.Items?.[index].MediaSources?.[0]?.Id}, index = ${index}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Playlist:
|
case BaseItemKind.Playlist:
|
||||||
@@ -267,6 +271,25 @@ const PlayButton = ({
|
|||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
sortBy: ["IndexNumber"],
|
sortBy: ["IndexNumber"],
|
||||||
});
|
});
|
||||||
|
if (
|
||||||
|
result.data.Items?.[index]?.Id &&
|
||||||
|
result.data.Items?.[index].MediaSources?.[0]?.Id
|
||||||
|
) {
|
||||||
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
|
audioStreamIndex: currentAudioTrack,
|
||||||
|
subtitleStreamIndex:
|
||||||
|
currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||||
|
itemId: result.data.Items?.[index].Id ?? "",
|
||||||
|
startTimeTicks:
|
||||||
|
result.data.Items?.[0].UserData?.PlaybackPositionTicks,
|
||||||
|
userId: userId,
|
||||||
|
mediaSourceId:
|
||||||
|
result.data.Items?.[index].MediaSources?.[0].Id ?? "",
|
||||||
|
playbackInfoDto: {
|
||||||
|
DeviceProfile: playbackProfile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Photo:
|
case BaseItemKind.Photo:
|
||||||
{
|
{
|
||||||
@@ -383,6 +406,11 @@ const PlayButton = ({
|
|||||||
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
result?.item.Items[episodeIndex].IndexNumber ?? 0
|
||||||
} ${result?.item.Items[episodeIndex].Name}`;
|
} ${result?.item.Items[episodeIndex].Name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (itemType === "BoxSet") {
|
||||||
|
itemName = result.item.Items[0].Name;
|
||||||
|
}
|
||||||
|
|
||||||
// Subtitle
|
// Subtitle
|
||||||
const subtitle = getSubtitle(
|
const subtitle = getSubtitle(
|
||||||
currentSubTrack,
|
currentSubTrack,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useLayoutEffect, useMemo, useRef } from "react";
|
import React, { useLayoutEffect, useMemo } from "react";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -26,8 +26,10 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
|||||||
import "./album.scss";
|
import "./album.scss";
|
||||||
|
|
||||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||||
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import TagChip from "@/components/tagChip";
|
import TagChip from "@/components/tagChip";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { Chip } from "@mui/material";
|
import { Chip } from "@mui/material";
|
||||||
import { Link, createFileRoute } from "@tanstack/react-router";
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
@@ -39,20 +41,14 @@ export const Route = createFileRoute("/_api/album/$id")({
|
|||||||
|
|
||||||
function MusicAlbumTitlePage() {
|
function MusicAlbumTitlePage() {
|
||||||
const { id } = Route.useParams();
|
const { id } = Route.useParams();
|
||||||
const api = Route.useRouteContext().api;
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
if (!api) {
|
|
||||||
throw new Error("API not found", {
|
|
||||||
cause:
|
|
||||||
"API is not set in the context, maybe it is not initialized before the component is rendered.",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const user = useCentralStore((s) => s.currentUser);
|
const user = useCentralStore((s) => s.currentUser);
|
||||||
|
|
||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
@@ -67,7 +63,7 @@ function MusicAlbumTitlePage() {
|
|||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", id, "similarItem"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (item.data?.Id) {
|
if (api && item.data?.Id) {
|
||||||
const result = await getLibraryApi(api).getSimilarAlbums({
|
const result = await getLibraryApi(api).getSimilarAlbums({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data?.Id,
|
itemId: item.data?.Id,
|
||||||
@@ -75,6 +71,7 @@ function MusicAlbumTitlePage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess,
|
enabled: item.isSuccess,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
@@ -84,6 +81,7 @@ function MusicAlbumTitlePage() {
|
|||||||
const musicTracks = useQuery({
|
const musicTracks = useQuery({
|
||||||
queryKey: ["item", "musicTracks", id],
|
queryKey: ["item", "musicTracks", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data?.Id,
|
parentId: item.data?.Id,
|
||||||
@@ -93,7 +91,7 @@ function MusicAlbumTitlePage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicAlbum,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicAlbum,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -117,14 +115,12 @@ function MusicAlbumTitlePage() {
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess) {
|
||||||
setAppBackdrop(
|
setAppBackdrop(
|
||||||
`${api?.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`,
|
`${api?.basePath}/Items/${item.data?.ParentBackdropItemId}/Images/Backdrop`,
|
||||||
item.data.Id,
|
item.data?.Id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [item.isSuccess]);
|
}, [item.isSuccess]);
|
||||||
|
|
||||||
const pageRef = useRef(null);
|
|
||||||
|
|
||||||
if (item.isPending || similarItems.isPending) {
|
if (item.isPending || similarItems.isPending) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -140,47 +136,46 @@ function MusicAlbumTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div key={id} className="scrollY padded-top item item-album">
|
||||||
key={id}
|
|
||||||
className="scrollY padded-top item item-album"
|
|
||||||
ref={pageRef}
|
|
||||||
>
|
|
||||||
<div className="item-info">
|
<div className="item-info">
|
||||||
<Typography className="item-info-name" variant="h3">
|
<Typography className="item-info-name" variant="h3">
|
||||||
{item.data.Name}
|
{item.data?.Name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className="flex flex-align-center item-info-album-info">
|
<div className="flex flex-align-center item-info-album-info">
|
||||||
{/* @ts-ignore - Using Link as component */}
|
{/* @ts-ignore - Using Link as component */}
|
||||||
<Chip
|
<Link
|
||||||
component={Link}
|
|
||||||
to="/artist/$id"
|
to="/artist/$id"
|
||||||
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
|
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
|
||||||
className="flex flex-align-center"
|
>
|
||||||
style={{
|
<Chip
|
||||||
color: "white",
|
// component={Link}
|
||||||
textDecoration: "none",
|
className="flex flex-align-center"
|
||||||
}}
|
style={{
|
||||||
icon={
|
color: "white",
|
||||||
<span
|
textDecoration: "none",
|
||||||
className="material-symbols-rounded"
|
}}
|
||||||
style={{
|
icon={
|
||||||
opacity: 0.7,
|
<span
|
||||||
}}
|
className="material-symbols-rounded fill"
|
||||||
>
|
style={{
|
||||||
artist
|
paddingLeft: "0.25em",
|
||||||
</span>
|
}}
|
||||||
}
|
>
|
||||||
label={item.data.AlbumArtist}
|
artist
|
||||||
/>
|
</span>
|
||||||
|
}
|
||||||
|
label={item.data.AlbumArtist}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{item.data.ProductionYear}
|
{item.data.ProductionYear}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||||
? `${musicTracks.data?.TotalRecordCount} songs`
|
? `${musicTracks.data?.TotalRecordCount} songs`
|
||||||
: "1 song"}
|
: "Single"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography className="opacity-07">
|
<Typography className="opacity-07">
|
||||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||||
@@ -262,9 +257,9 @@ function MusicAlbumTitlePage() {
|
|||||||
className="item-info-sidebar-image"
|
className="item-info-sidebar-image"
|
||||||
alt={item.data.Name ?? "Album"}
|
alt={item.data.Name ?? "Album"}
|
||||||
src={
|
src={
|
||||||
item.data.Id &&
|
api &&
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
item.data.Id,
|
item.data.Id ?? "",
|
||||||
"Primary",
|
"Primary",
|
||||||
{
|
{
|
||||||
tag: item.data.ImageTags.Primary,
|
tag: item.data.ImageTags.Primary,
|
||||||
@@ -287,34 +282,11 @@ function MusicAlbumTitlePage() {
|
|||||||
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-column item-info-sidebar-artist-container">
|
<div className="item-info-sidebar-overview">
|
||||||
{item.data.ArtistItems?.map((artist) => (
|
<ShowMoreText
|
||||||
<Link
|
content={item.data.Overview ?? ""}
|
||||||
to="/artist/$id"
|
collapsedLines={4}
|
||||||
params={{ id: artist.Id ?? "" }}
|
/>
|
||||||
className="item-info-sidebar-artist"
|
|
||||||
key={artist.Id}
|
|
||||||
>
|
|
||||||
<div className="item-info-sidebar-artist-image-container">
|
|
||||||
<img
|
|
||||||
className="item-info-sidebar-artist-image"
|
|
||||||
alt={artist.Name ?? "Artist"}
|
|
||||||
src={
|
|
||||||
artist.Id &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
artist.Id,
|
|
||||||
"Primary",
|
|
||||||
{
|
|
||||||
quality: 90,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<span className="material-symbols-rounded">artist</span>
|
|
||||||
</div>
|
|
||||||
<Typography>{artist.Name}</Typography>
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
document.body,
|
document.body,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ $border-radius: 20px;
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
max-height: 100vh;
|
// max-height: 100vh;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 30vw;
|
width: 30vw;
|
||||||
@@ -89,6 +89,11 @@ $border-radius: 20px;
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&-overview {
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 28vh;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-detail-album {
|
.item-detail-album {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, {
|
||||||
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
|
useState,
|
||||||
|
useEffect,
|
||||||
|
useLayoutEffect,
|
||||||
|
useRef,
|
||||||
|
type ReactNode,
|
||||||
|
} from "react";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -17,7 +22,6 @@ import {
|
|||||||
SortOrder,
|
SortOrder,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
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 { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
@@ -26,7 +30,6 @@ import LikeButton from "@/components/buttons/likeButton";
|
|||||||
import { Card } from "@/components/card/card";
|
import { Card } from "@/components/card/card";
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
|
|
||||||
import meshBg from "@/assets/herobg.png";
|
|
||||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||||
import MusicTrack from "@/components/musicTrack";
|
import MusicTrack from "@/components/musicTrack";
|
||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
@@ -40,7 +43,14 @@ import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
|||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
|
type TabPanelProp = {
|
||||||
|
children: ReactNode;
|
||||||
|
index: number;
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
function TabPanel(props: TabPanelProp) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -57,12 +67,6 @@ function TabPanel(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/artist/$id")({
|
export const Route = createFileRoute("/_api/artist/$id")({
|
||||||
component: ArtistTitlePage,
|
component: ArtistTitlePage,
|
||||||
});
|
});
|
||||||
@@ -76,10 +80,10 @@ function ArtistTitlePage() {
|
|||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
fields: [ItemFields.Crew],
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -91,8 +95,9 @@ function ArtistTitlePage() {
|
|||||||
const artistDiscography = useQuery({
|
const artistDiscography = useQuery({
|
||||||
queryKey: ["item", id, "artist", "discography"],
|
queryKey: ["item", id, "artist", "discography"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
albumArtistIds: [item.data.Id],
|
albumArtistIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -102,14 +107,16 @@ function ArtistTitlePage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistSongs = useQuery({
|
const artistSongs = useQuery({
|
||||||
queryKey: ["item", id, "artist", "songs"],
|
queryKey: ["item", id, "artist", "songs"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
|
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
artistIds: [item.data.Id],
|
artistIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Ascending],
|
sortOrder: [SortOrder.Ascending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -119,15 +126,16 @@ function ArtistTitlePage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistAppearances = useQuery({
|
const artistAppearances = useQuery({
|
||||||
queryKey: ["item", id, "artist", "appearences"],
|
queryKey: ["item", id, "artist", "appearences"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
contributingArtistIds: [item.data.Id],
|
contributingArtistIds: [item.data?.Id ?? ""],
|
||||||
excludeItemIds: [item.data.Id],
|
excludeItemIds: [item.data?.Id ?? ""],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
sortOrder: [SortOrder.Descending],
|
sortOrder: [SortOrder.Descending],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -136,7 +144,7 @@ function ArtistTitlePage() {
|
|||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
|
enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
|
||||||
});
|
});
|
||||||
|
|
||||||
const artistTabs = [
|
const artistTabs = [
|
||||||
@@ -150,7 +158,10 @@ function ArtistTitlePage() {
|
|||||||
if (
|
if (
|
||||||
artistDiscography.isSuccess &&
|
artistDiscography.isSuccess &&
|
||||||
artistSongs.isSuccess &&
|
artistSongs.isSuccess &&
|
||||||
artistAppearances.isSuccess
|
artistAppearances.isSuccess &&
|
||||||
|
artistDiscography.data &&
|
||||||
|
artistSongs.data &&
|
||||||
|
artistAppearances.data
|
||||||
) {
|
) {
|
||||||
if (artistDiscography.data.TotalRecordCount !== 0) {
|
if (artistDiscography.data.TotalRecordCount !== 0) {
|
||||||
setActiveArtistTab(0);
|
setActiveArtistTab(0);
|
||||||
@@ -170,9 +181,9 @@ function ArtistTitlePage() {
|
|||||||
|
|
||||||
const { setBackdrop } = useBackdropStore();
|
const { setBackdrop } = useBackdropStore();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
`${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
`${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`,
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -200,7 +211,7 @@ function ArtistTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess) {
|
if (item.isSuccess && item.data) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -220,17 +231,20 @@ function ArtistTitlePage() {
|
|||||||
<div className="item-hero flex flex-row">
|
<div className="item-hero flex flex-row">
|
||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data?.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Backdrop",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data?.Id ?? "",
|
||||||
tag: item.data.BackdropImageTags[0],
|
"Backdrop",
|
||||||
},
|
{
|
||||||
)}
|
tag: item.data.BackdropImageTags?.[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -243,53 +257,59 @@ function ArtistTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary ? (
|
||||||
<>
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
] ?? ""
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Primary",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.Id ?? "",
|
||||||
quality: 90,
|
"Primary",
|
||||||
tag: item.data.ImageTags.Primary,
|
{
|
||||||
},
|
quality: 90,
|
||||||
)}
|
tag: item.data.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "MusicArtist")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail flex flex-column">
|
<div className="item-hero-detail flex flex-column">
|
||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Logo",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.Id ?? "",
|
||||||
quality: 90,
|
"Logo",
|
||||||
fillWidth: 592,
|
{
|
||||||
fillHeight: 592,
|
quality: 90,
|
||||||
},
|
fillWidth: 592,
|
||||||
)}
|
fillHeight: 592,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
@@ -323,7 +343,11 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls?.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink
|
||||||
|
url={url.Url ?? ""}
|
||||||
|
name={url.Name ?? ""}
|
||||||
|
key={url.Url}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -333,22 +357,22 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.PremiereDate && (
|
{item.data.PremiereDate && (
|
||||||
<>
|
<div>
|
||||||
<Typography variant="h5">Born</Typography>
|
<Typography variant="h5">Born</Typography>
|
||||||
<Typography sx={{ opacity: 0.8 }}>
|
<Typography sx={{ opacity: 0.8 }}>
|
||||||
{new Date(item.data.PremiereDate).toDateString()}
|
{new Date(item.data.PremiereDate).toDateString()}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
{item.data.EndDate && (
|
{item.data.EndDate && (
|
||||||
<>
|
<div>
|
||||||
<Typography variant="h5" mt={2}>
|
<Typography variant="h5" mt={2}>
|
||||||
Death
|
Death
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{ opacity: 0.8 }}>
|
<Typography sx={{ opacity: 0.8 }}>
|
||||||
{new Date(item.data.EndDate).toDateString()}
|
{new Date(item.data.EndDate).toDateString()}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -357,7 +381,7 @@ function ArtistTitlePage() {
|
|||||||
<Tabs
|
<Tabs
|
||||||
variant="scrollable"
|
variant="scrollable"
|
||||||
value={activeArtistTab}
|
value={activeArtistTab}
|
||||||
onChange={(e, newVal) => {
|
onChange={(_, newVal) => {
|
||||||
if (newVal > activeArtistTab) {
|
if (newVal > activeArtistTab) {
|
||||||
setAnimationDirection("forward");
|
setAnimationDirection("forward");
|
||||||
} else if (newVal < activeArtistTab) {
|
} else if (newVal < activeArtistTab) {
|
||||||
@@ -398,8 +422,8 @@ function ArtistTitlePage() {
|
|||||||
ease: "anticipate",
|
ease: "anticipate",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistDiscography.isSuccess &&
|
{user &&
|
||||||
artistDiscography.data.Items?.map((tabitem) => {
|
artistDiscography.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<ArtistAlbum
|
<ArtistAlbum
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
@@ -430,7 +454,7 @@ function ArtistTitlePage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{artistSongs.isSuccess &&
|
{artistSongs.isSuccess &&
|
||||||
artistSongs.data.Items?.map((tabitem) => {
|
artistSongs.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<MusicTrack
|
<MusicTrack
|
||||||
item={tabitem}
|
item={tabitem}
|
||||||
@@ -463,7 +487,7 @@ function ArtistTitlePage() {
|
|||||||
className="grid"
|
className="grid"
|
||||||
>
|
>
|
||||||
{artistAppearances.isSuccess &&
|
{artistAppearances.isSuccess &&
|
||||||
artistAppearances.data.Items?.map((tabitem) => {
|
artistAppearances.data?.Items?.map((tabitem) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={tabitem.Id}
|
key={tabitem.Id}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import PropTypes from "prop-types";
|
import React, { useLayoutEffect, useRef } from "react";
|
||||||
import React, { useEffect, useRef } from "react";
|
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Chip from "@mui/material/Chip";
|
import Chip from "@mui/material/Chip";
|
||||||
@@ -17,7 +16,6 @@ import {
|
|||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-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 { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ import CardScroller from "@/components/cardScroller/cardScroller";
|
|||||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||||
import ShowMoreText from "@/components/showMoreText";
|
import ShowMoreText from "@/components/showMoreText";
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
|
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
|
|
||||||
import LikeButton from "@/components/buttons/likeButton";
|
import LikeButton from "@/components/buttons/likeButton";
|
||||||
@@ -41,31 +39,9 @@ import IconLink from "@/components/iconLink";
|
|||||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
|
||||||
const { children, value, index, ...other } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="tabpanel"
|
|
||||||
hidden={value !== index}
|
|
||||||
id={`full-width-tabpanel-${index}`}
|
|
||||||
aria-labelledby={`full-width-tab-${index}`}
|
|
||||||
{...other}
|
|
||||||
style={{ marginTop: "1em" }}
|
|
||||||
>
|
|
||||||
{value === index && <Box>{children}</Box>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
TabPanel.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
index: PropTypes.number.isRequired,
|
|
||||||
value: PropTypes.number.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/boxset/$id")({
|
export const Route = createFileRoute("/_api/boxset/$id")({
|
||||||
component: BoxSetTitlePage,
|
component: BoxSetTitlePage,
|
||||||
});
|
});
|
||||||
@@ -79,6 +55,7 @@ function BoxSetTitlePage() {
|
|||||||
const item = useQuery({
|
const item = useQuery({
|
||||||
queryKey: ["item", id],
|
queryKey: ["item", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getUserLibraryApi(api).getItem({
|
const result = await getUserLibraryApi(api).getItem({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: id,
|
itemId: id,
|
||||||
@@ -93,9 +70,10 @@ function BoxSetTitlePage() {
|
|||||||
const collectionItems = useQuery({
|
const collectionItems = useQuery({
|
||||||
queryKey: ["item", id, "collection"],
|
queryKey: ["item", id, "collection"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api) return null;
|
||||||
const result = await getItemsApi(api).getItems({
|
const result = await getItemsApi(api).getItems({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
parentId: item.data.Id,
|
parentId: item.data?.Id,
|
||||||
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
fields: [ItemFields.SeasonUserData, ItemFields.Overview],
|
||||||
excludeLocationTypes: [LocationType.Virtual],
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
});
|
});
|
||||||
@@ -107,8 +85,9 @@ function BoxSetTitlePage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const similarItems = useQuery({
|
const similarItems = useQuery({
|
||||||
queryKey: ["item", id, "similarItem"],
|
queryKey: ["item", "similarItem", id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
if (!api || !item.data?.Id) return null;
|
||||||
const result = await getLibraryApi(api).getSimilarItems({
|
const result = await getLibraryApi(api).getSimilarItems({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
itemId: item.data?.Id,
|
itemId: item.data?.Id,
|
||||||
@@ -121,13 +100,19 @@ function BoxSetTitlePage() {
|
|||||||
refetchOnWindowFocus: true,
|
refetchOnWindowFocus: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||||
if (item.isSuccess) {
|
|
||||||
if (item.data.BackdropImageTags?.length > 0) {
|
useLayoutEffect(() => {
|
||||||
|
if (api && item.isSuccess) {
|
||||||
|
if (item.data?.BackdropImageTags?.length) {
|
||||||
setBackdrop(
|
setBackdrop(
|
||||||
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
tag: item.data.BackdropImageTags[0],
|
item.data.Id ?? "",
|
||||||
}),
|
"Backdrop",
|
||||||
|
{
|
||||||
|
tag: item.data.BackdropImageTags[0],
|
||||||
|
},
|
||||||
|
),
|
||||||
item.data.Id,
|
item.data.Id,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -159,7 +144,7 @@ function BoxSetTitlePage() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isSuccess && similarItems.isSuccess) {
|
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={id}
|
key={id}
|
||||||
@@ -180,17 +165,20 @@ function BoxSetTitlePage() {
|
|||||||
<div className="item-hero-backdrop-container">
|
<div className="item-hero-backdrop-container">
|
||||||
{item.data.BackdropImageTags?.length ? (
|
{item.data.BackdropImageTags?.length ? (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Backdrop",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.Id ?? "",
|
||||||
tag: item.data.BackdropImageTags[0],
|
"Backdrop",
|
||||||
},
|
{
|
||||||
)}
|
tag: item.data.BackdropImageTags[0],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -198,11 +186,11 @@ function BoxSetTitlePage() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<motion.img
|
<motion.img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={heroBg}
|
src={heroBg}
|
||||||
className="item-hero-backdrop"
|
className="item-hero-backdrop"
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
y: parallax,
|
y: parallax,
|
||||||
@@ -216,53 +204,60 @@ function BoxSetTitlePage() {
|
|||||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
{item.data.ImageTags?.Primary &&
|
||||||
<>
|
item.data.ImageBlurHashes?.Primary ? (
|
||||||
|
<div>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item.data.ImageBlurHashes.Primary[
|
item.data.ImageBlurHashes?.Primary?.[
|
||||||
item.data.ImageTags.Primary
|
item.data.ImageTags.Primary
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
className="item-hero-image-blurhash"
|
className="item-hero-image-blurhash"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Primary",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.Id ?? "",
|
||||||
quality: 90,
|
"Primary",
|
||||||
tag: item.data.ImageTags.Primary,
|
{
|
||||||
},
|
quality: 90,
|
||||||
)}
|
tag: item.data.ImageTags.Primary,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-image"
|
className="item-hero-image"
|
||||||
/>
|
/>
|
||||||
</>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="item-hero-image-icon">
|
<div className="item-hero-image-icon">
|
||||||
{getTypeIcon(item.data.Type)}
|
{getTypeIcon(item.data.Type ?? "BoxSet")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="item-hero-detail">
|
<div className="item-hero-detail">
|
||||||
{Object.keys(item.data.ImageTags).includes("Logo") ? (
|
{item.data.ImageTags?.Logo ? (
|
||||||
<img
|
<img
|
||||||
alt={item.data.Name}
|
alt={item.data.Name ?? ""}
|
||||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
src={
|
||||||
item.data.Id,
|
api &&
|
||||||
"Logo",
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
{
|
item.data.Id ?? "",
|
||||||
quality: 90,
|
"Logo",
|
||||||
fillWidth: 592,
|
{
|
||||||
fillHeight: 592,
|
quality: 90,
|
||||||
},
|
fillWidth: 592,
|
||||||
)}
|
fillHeight: 592,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.currentTarget.style.opacity = 1;
|
e.currentTarget.style.opacity = "1";
|
||||||
}}
|
}}
|
||||||
className="item-hero-logo"
|
className="item-hero-logo"
|
||||||
/>
|
/>
|
||||||
@@ -357,7 +352,7 @@ function BoxSetTitlePage() {
|
|||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.data.RunTimeTicks -
|
item.data.RunTimeTicks -
|
||||||
item.data.UserData.PlaybackPositionTicks,
|
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
@@ -370,9 +365,7 @@ function BoxSetTitlePage() {
|
|||||||
<div className="flex flex-row fullWidth">
|
<div className="flex flex-row fullWidth">
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item.data}
|
item={item.data}
|
||||||
itemId={item.data.Id}
|
itemType={item.data.Type ?? "BoxSet"}
|
||||||
itemType={item.data.Type}
|
|
||||||
itemUserData={item.data.UserData}
|
|
||||||
currentVideoTrack={0}
|
currentVideoTrack={0}
|
||||||
currentAudioTrack={0}
|
currentAudioTrack={0}
|
||||||
currentSubTrack={0}
|
currentSubTrack={0}
|
||||||
@@ -387,14 +380,14 @@ function BoxSetTitlePage() {
|
|||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isFavorite={item.data.UserData.IsFavorite}
|
isFavorite={item.data.UserData?.IsFavorite}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemName={item.data.Name}
|
itemName={item.data.Name}
|
||||||
itemId={item.data.Id}
|
itemId={item.data.Id}
|
||||||
queryKey={["item", id]}
|
queryKey={["item", id]}
|
||||||
isPlayed={item.data.UserData.Played}
|
isPlayed={item.data.UserData?.Played}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -420,15 +413,19 @@ function BoxSetTitlePage() {
|
|||||||
marginTop: "1em",
|
marginTop: "1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.data.ExternalUrls.map((url) => (
|
{item.data.ExternalUrls?.map((url) => (
|
||||||
<IconLink url={url.Url} name={url.Name} />
|
<IconLink
|
||||||
|
url={url.Url ?? ""}
|
||||||
|
name={url.Name ?? ""}
|
||||||
|
key={url.Url}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{collectionItems.data.TotalRecordCount > 0 && (
|
{(collectionItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||||
<CardScroller title="" displayCards={7} disableDecoration>
|
<CardScroller title="" displayCards={7} disableDecoration>
|
||||||
{collectionItems.data.Items.map((similar, index) => {
|
{collectionItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -442,26 +439,20 @@ function BoxSetTitlePage() {
|
|||||||
imageType={"Primary"}
|
imageType={"Primary"}
|
||||||
cardCaption={similar.ProductionYear}
|
cardCaption={similar.ProductionYear}
|
||||||
cardType={"portrait"}
|
cardType={"portrait"}
|
||||||
queryKey={["item", id, "collection"]}
|
queryKey={["item", id]}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
)}
|
)}
|
||||||
{similarItems.data.TotalRecordCount > 0 && (
|
{similarItems.data?.TotalRecordCount && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
title="You might also like"
|
title="You might also like"
|
||||||
displayCards={7}
|
displayCards={7}
|
||||||
disableDecoration
|
disableDecoration
|
||||||
>
|
>
|
||||||
{similarItems.data.Items.map((similar, index) => {
|
{similarItems.data?.Items?.map((similar) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={similar.Id}
|
key={similar.Id}
|
||||||
@@ -494,12 +485,6 @@ function BoxSetTitlePage() {
|
|||||||
}
|
}
|
||||||
queryKey={["item", id, "similarItem"]}
|
queryKey={["item", id, "similarItem"]}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
imageBlurhash={
|
|
||||||
!!similar.ImageBlurHashes?.Primary &&
|
|
||||||
similar.ImageBlurHashes?.Primary[
|
|
||||||
Object.keys(similar.ImageBlurHashes.Primary)[0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in new issue
Block a user