- {item.data.Name}
+ {item.data?.Name}
{/* @ts-ignore - Using Link as component */}
-
- artist
-
- }
- label={item.data.AlbumArtist}
- />
+ >
+
+ artist
+
+ }
+ label={item.data.AlbumArtist}
+ />
+
{item.data.ProductionYear}
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
? `${musicTracks.data?.TotalRecordCount} songs`
- : "1 song"}
+ : "Single"}
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
@@ -262,9 +257,9 @@ function MusicAlbumTitlePage() {
className="item-info-sidebar-image"
alt={item.data.Name ?? "Album"}
src={
- item.data.Id &&
+ api &&
getImageUrlsApi(api).getItemImageUrlById(
- item.data.Id,
+ item.data.Id ?? "",
"Primary",
{
tag: item.data.ImageTags.Primary,
@@ -287,34 +282,11 @@ function MusicAlbumTitlePage() {
))}
-
- {item.data.ArtistItems?.map((artist) => (
-
-
-

-
artist
-
-
{artist.Name}
-
- ))}
+
+
,
document.body,
diff --git a/src/routes/_api/album/album.scss b/src/routes/_api/album/album.scss
index b768fed..76de2ca 100644
--- a/src/routes/_api/album/album.scss
+++ b/src/routes/_api/album/album.scss
@@ -34,7 +34,7 @@ $border-radius: 20px;
flex-direction: column;
gap: 1em;
position: fixed;
- max-height: 100vh;
+ // max-height: 100vh;
top: 0;
right: 0;
width: 30vw;
@@ -89,6 +89,11 @@ $border-radius: 20px;
overflow-x: hidden;
}
}
+ &-overview {
+ overflow-y: auto;
+ max-height: 28vh;
+ padding-bottom: 2px;
+ }
}
.item-detail-album {
diff --git a/src/routes/_api/artist/$id.tsx b/src/routes/_api/artist/$id.tsx
index 28968af..842be4e 100644
--- a/src/routes/_api/artist/$id.tsx
+++ b/src/routes/_api/artist/$id.tsx
@@ -1,5 +1,10 @@
-import PropTypes from "prop-types";
-import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
+import React, {
+ useState,
+ useEffect,
+ useLayoutEffect,
+ useRef,
+ type ReactNode,
+} from "react";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
@@ -17,7 +22,6 @@ import {
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 { useQuery } from "@tanstack/react-query";
@@ -26,7 +30,6 @@ import LikeButton from "@/components/buttons/likeButton";
import { Card } from "@/components/card/card";
import { Blurhash } from "react-blurhash";
-import meshBg from "@/assets/herobg.png";
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
import MusicTrack from "@/components/musicTrack";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
@@ -40,7 +43,14 @@ import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
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;
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")({
component: ArtistTitlePage,
});
@@ -76,10 +80,10 @@ function ArtistTitlePage() {
const item = useQuery({
queryKey: ["item", id],
queryFn: async () => {
+ if (!api) return null;
const result = await getUserLibraryApi(api).getItem({
userId: user?.Id,
itemId: id,
- fields: [ItemFields.Crew],
});
return result.data;
},
@@ -91,8 +95,9 @@ function ArtistTitlePage() {
const artistDiscography = useQuery({
queryKey: ["item", id, "artist", "discography"],
queryFn: async () => {
+ if (!api) return null;
const result = await getItemsApi(api).getItems({
- albumArtistIds: [item.data.Id],
+ albumArtistIds: [item.data?.Id ?? ""],
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
sortOrder: [SortOrder.Descending],
recursive: true,
@@ -102,14 +107,16 @@ function ArtistTitlePage() {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
+ enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
});
const artistSongs = useQuery({
queryKey: ["item", id, "artist", "songs"],
queryFn: async () => {
+ if (!api) return null;
+
const result = await getItemsApi(api).getItems({
- artistIds: [item.data.Id],
+ artistIds: [item.data?.Id ?? ""],
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
sortOrder: [SortOrder.Ascending],
recursive: true,
@@ -119,15 +126,16 @@ function ArtistTitlePage() {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
+ enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
});
const artistAppearances = useQuery({
queryKey: ["item", id, "artist", "appearences"],
queryFn: async () => {
+ if (!api) return null;
const result = await getItemsApi(api).getItems({
- contributingArtistIds: [item.data.Id],
- excludeItemIds: [item.data.Id],
+ contributingArtistIds: [item.data?.Id ?? ""],
+ excludeItemIds: [item.data?.Id ?? ""],
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
sortOrder: [SortOrder.Descending],
recursive: true,
@@ -136,7 +144,7 @@ function ArtistTitlePage() {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type === BaseItemKind.MusicArtist,
+ enabled: item.isSuccess && item.data?.Type === BaseItemKind.MusicArtist,
});
const artistTabs = [
@@ -150,7 +158,10 @@ function ArtistTitlePage() {
if (
artistDiscography.isSuccess &&
artistSongs.isSuccess &&
- artistAppearances.isSuccess
+ artistAppearances.isSuccess &&
+ artistDiscography.data &&
+ artistSongs.data &&
+ artistAppearances.data
) {
if (artistDiscography.data.TotalRecordCount !== 0) {
setActiveArtistTab(0);
@@ -170,9 +181,9 @@ function ArtistTitlePage() {
const { setBackdrop } = useBackdropStore();
useEffect(() => {
- if (item.isSuccess) {
+ if (item.isSuccess && item.data) {
setBackdrop(
- `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
+ `${api?.basePath}/Items/${item.data.Id}/Images/Backdrop`,
item.data.Id,
);
}
@@ -200,7 +211,7 @@ function ArtistTitlePage() {
);
}
- if (item.isSuccess) {
+ if (item.isSuccess && item.data) {
return (
{
- e.currentTarget.style.opacity = 1;
+ e.currentTarget.style.opacity = "1";
}}
style={{
y: parallax,
@@ -243,53 +257,59 @@ function ArtistTitlePage() {
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
}}
>
- {Object.keys(item.data.ImageTags).includes("Primary") ? (
- <>
+ {item.data.ImageTags?.Primary ? (
+
.getItemImageUrlById()
{
- e.currentTarget.style.opacity = 1;
+ e.currentTarget.style.opacity = "1";
}}
className="item-hero-image"
/>
- >
+
) : (
- {getTypeIcon(item.data.Type)}
+ {getTypeIcon(item.data.Type ?? "MusicArtist")}
)}
- {Object.keys(item.data.ImageTags).includes("Logo") ? (
+ {item.data.ImageTags?.Logo ? (
.getItemImageUrlById()
{
- e.currentTarget.style.opacity = 1;
+ e.currentTarget.style.opacity = "1";
}}
className="item-hero-logo"
/>
@@ -323,7 +343,11 @@ function ArtistTitlePage() {
}}
>
{item.data.ExternalUrls?.map((url) => (
-
+
))}
@@ -333,22 +357,22 @@ function ArtistTitlePage() {
}}
>
{item.data.PremiereDate && (
- <>
+