diff --git a/src/components/layouts/artist/artistAlbum.jsx b/src/components/layouts/artist/artistAlbum.jsx
new file mode 100644
index 0000000..4af0a18
--- /dev/null
+++ b/src/components/layouts/artist/artistAlbum.jsx
@@ -0,0 +1,159 @@
+/** @format */
+
+import PropTypes from "prop-types";
+
+import Box from "@mui/material/Box";
+import Paper from "@mui/material/Paper";
+import TableContainer from "@mui/material/TableContainer";
+import Table from "@mui/material/Table";
+import TableBody from "@mui/material/TableBody";
+import TableHead from "@mui/material/TableHead";
+import TableRow from "@mui/material/TableRow";
+import TableCell from "@mui/material/TableCell";
+import Typography from "@mui/material/Typography";
+import IconButton from "@mui/material/IconButton";
+
+import { useQuery } from "@tanstack/react-query";
+import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
+import { MdiClockOutline } from "../../icons/mdiClockOutline";
+import { getRuntimeMusic } from "../../../utils/date/time";
+import { MdiHeart } from "../../icons/mdiHeart";
+import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
+
+export const ArtistAlbum = ({ user, album }) => {
+ const albumTracks = useQuery({
+ queryKey: ["artist", "album", album.Id],
+ queryFn: async () => {
+ const result = await getItemsApi(window.api).getItems({
+ userId: user.Id,
+ parentId: album.Id,
+ });
+ return result.data;
+ },
+ });
+
+ const handleLikingTrack = async (track) => {
+ let result;
+ if (track.UserData.IsFavorite) {
+ result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
+ userId: user.data.Id,
+ itemId: track.Id,
+ });
+ } else if (!track.UserData.IsFavorite) {
+ result = await getUserLibraryApi(window.api).markFavoriteItem({
+ userId: user.data.Id,
+ itemId: track.Id,
+ });
+ }
+ albumTracks.refetch();
+ };
+
+ return (
+
+
+
+
+
+
+
+
+ #
+
+
+
+
+ Name
+
+
+
+
+
+
+
+
+
+
+ {albumTracks.isSuccess &&
+ albumTracks.data.Items.map(
+ (mitem, mindex) => {
+ return (
+
+
+
+ {
+ mitem.IndexNumber
+ }
+
+
+
+
+ handleLikingTrack(
+ mitem,
+ )
+ }
+ >
+ {mitem.UserData
+ .IsFavorite ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ {mitem.Name}
+
+
+
+
+ {getRuntimeMusic(
+ mitem.RunTimeTicks,
+ )}
+
+
+
+ );
+ },
+ )}
+
+
+
+
+ );
+};
diff --git a/src/routes/item/index.jsx b/src/routes/item/index.jsx
index e440ea4..3b27feb 100644
--- a/src/routes/item/index.jsx
+++ b/src/routes/item/index.jsx
@@ -26,7 +26,7 @@ import MenuItem from "@mui/material/MenuItem";
import Link from "@mui/material/Link";
import { green, pink, yellow } from "@mui/material/colors";
-import { motion } from "framer-motion";
+import { motion, useScroll } from "framer-motion";
import { Blurhash } from "react-blurhash";
import { useDispatch, useSelector } from "react-redux";
@@ -36,6 +36,7 @@ import {
BaseItemKind,
ItemFields,
MediaStreamType,
+ SortOrder,
} 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";
@@ -64,6 +65,7 @@ import { CardScroller } from "../../components/cardScroller/cardScroller";
import "./item.module.scss";
import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
+import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -300,6 +302,22 @@ const ItemDetail = () => {
networkMode: "always",
});
+ const artistDiscography = useQuery({
+ queryKey: ["item", id, "artist", "discography"],
+ queryFn: async () => {
+ const result = await getItemsApi(window.api).getItems({
+ albumArtistIds: [item.data.Id],
+ sortBy: ["PremiereDate", "ProductionYear", "SortName"],
+ sortOrder: [SortOrder.Descending],
+ recursive: true,
+ includeItemTypes: [BaseItemKind.MusicAlbum],
+ userId: user.data.Id,
+ });
+ return result.data;
+ },
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicArtist,
+ });
+
const handleMarkPlayedOrunPlayed = async () => {
let result;
if (!item.data.UserData.Played) {
@@ -379,6 +397,9 @@ const ItemDetail = () => {
personEpisodes.isLoading,
]);
+ const artistTabs = ["Discography"];
+ const [activeArtistTab, setActiveArtistTab] = useState(0);
+
const [videoTracks, setVideoTracks] = useState([]);
const [audioTracks, setAudioTracks] = useState([]);
const [subtitleTracks, setSubtitleTracks] = useState([]);
@@ -707,6 +728,9 @@ const ItemDetail = () => {
opacity: 0.7,
}}
color="inherit"
+ key={
+ aindex
+ }
to={`/item/${artist.Id}`}
>
{
@@ -2423,6 +2447,60 @@ const ItemDetail = () => {
)}
+ {item.data.Type == BaseItemKind.MusicArtist &&
+ artistDiscography.isSuccess && (
+
+
+ setActiveArtistTab(newVal)
+ }
+ aria-label="artists-tabs"
+ >
+ {artistTabs.map((pitem, index) => {
+ return (
+
+ );
+ })}
+
+ {artistTabs.map((pitem, index) => {
+ return (
+
+ {pitem ==
+ "Discography" &&
+ artistDiscography.data.Items.map(
+ (album) => {
+ return (
+
+ );
+ },
+ )}
+
+ );
+ })}
+
+ )}
+
{item.data.People.length != 0 && (