diff --git a/src/components/card/card.jsx b/src/components/card/card.jsx index 9f8ccce..5f42e04 100644 --- a/src/components/card/card.jsx +++ b/src/components/card/card.jsx @@ -142,7 +142,6 @@ export const Card = ({ ? onClickEvent : () => { navigate(`/item/${itemId}`); - console.log("going..."); } } className="cardBox" diff --git a/src/routes/item/index.jsx b/src/routes/item/index.jsx index 0de1a13..c7fc2a2 100644 --- a/src/routes/item/index.jsx +++ b/src/routes/item/index.jsx @@ -66,6 +66,7 @@ import "./item.module.scss"; import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards"; import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice"; import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum"; +import { MdiMusic } from "../../components/icons/mdiMusic"; function TabPanel(props) { const { children, value, index, ...other } = props; @@ -319,6 +320,23 @@ const ItemDetail = () => { enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist, }); + const artistSongs = useQuery({ + queryKey: ["item", id, "artist", "songs"], + queryFn: async () => { + const result = await getItemsApi(window.api).getItems({ + artistIds: [item.data.Id], + sortBy: ["PremiereDate", "ProductionYear", "SortName"], + sortOrder: [SortOrder.Descending], + recursive: true, + includeItemTypes: [BaseItemKind.Audio], + userId: user.data.Id, + fields: [ItemFields.Overview], + }); + return result.data; + }, + enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist, + }); + const handleMarkPlayedOrunPlayed = async () => { let result; if (!item.data.UserData.Played) { @@ -398,7 +416,7 @@ const ItemDetail = () => { personEpisodes.isLoading, ]); - const artistTabs = ["Discography"]; + const artistTabs = ["Discography", "Songs"]; const [activeArtistTab, setActiveArtistTab] = useState(0); const [videoTracks, setVideoTracks] = useState([]); @@ -2449,7 +2467,8 @@ const ItemDetail = () => { )} {item.data.Type == BaseItemKind.MusicArtist && - artistDiscography.isSuccess && ( + artistDiscography.isSuccess && + artistSongs.isSuccess && ( { sx={{ borderBottom: 1, borderColor: "divider", - mb: 5, + mb: 2, }} > {artistTabs.map((pitem, index) => { @@ -2486,19 +2505,19 @@ const ItemDetail = () => { "Discography" && artistDiscography.data.Items.map( ( - album, + musicItem, mindex, ) => { return ( { ); }, )} + {pitem == "Songs" && ( + + + + {artistSongs.data.Items.map( + ( + music, + mindex, + ) => { + return ( + + + + {!!music + .ImageTags + .Primary && ( + + )} + + + + + + + + { + music.Name + } + + + , + + } + > + {music.Artists.map( + ( + artist, + aindex, + ) => { + return ( + + { + artist + } + + ); + }, + )} + + + + + {getRuntimeMusic( + music.RunTimeTicks, + )} + + + + { + handleLiking( + music, + ); + }} + > + {music + .UserData + .IsFavorite ? ( + + ) : ( + + )} + + + + ); + }, + )} + +
+
+ )} ); })}