diff --git a/src/App.jsx b/src/App.jsx
index 8e7c606..b47f109 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -294,7 +294,7 @@ function App() {
sx={{
display: "flex",
width: "100%",
- height: "100%",
+ height: "100vh",
justifyContent: "center",
alignItems: "center",
}}
diff --git a/src/components/icons/mdiClockOutline.jsx b/src/components/icons/mdiClockOutline.jsx
new file mode 100644
index 0000000..81ac3f9
--- /dev/null
+++ b/src/components/icons/mdiClockOutline.jsx
@@ -0,0 +1,12 @@
+/** @format */
+import SvgIcon from "@mui/material/SvgIcon";
+
+import { mdiClockOutline } from "@mdi/js";
+
+export const MdiClockOutline = (props) => {
+ return (
+
+
+
+ );
+};
diff --git a/src/routes/item/item.module.scss b/src/routes/item/item.module.scss
index 84baef4..e5005bc 100644
--- a/src/routes/item/item.module.scss
+++ b/src/routes/item/item.module.scss
@@ -1,6 +1,9 @@
/** @format */
.item-detail {
+ &-heading {
+ opacity: 0.85;
+ }
&-backdrop {
position: fixed;
top: 0;
diff --git a/src/routes/item/root.jsx b/src/routes/item/root.jsx
index d876454..b929137 100644
--- a/src/routes/item/root.jsx
+++ b/src/routes/item/root.jsx
@@ -14,9 +14,17 @@ import Tab from "@mui/material/Tab";
import Grid2 from "@mui/material/Unstable_Grid2";
import Button from "@mui/material/Button";
import IconButton from "@mui/material/IconButton";
-// import Chip from "@mui/material/Chip";
+import Paper from "@mui/material/Paper";
+import TableContainer from "@mui/material/TableContainer";
+import Table from "@mui/material/Table";
+import TableHead from "@mui/material/TableHead";
+import TableRow from "@mui/material/TableRow";
+import TableBody from "@mui/material/TableBody";
+import TableCell from "@mui/material/TableCell";
import { green, pink } from "@mui/material/colors";
+import { AvatarImage } from "../../components/avatar/avatar";
+
import { Blurhash } from "react-blurhash";
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
import { useDispatch, useSelector } from "react-redux";
@@ -34,7 +42,7 @@ import { useQuery } from "@tanstack/react-query";
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
-import { getRuntimeFull } from "../../utils/date/time";
+import { getRuntimeMusic, getRuntimeFull } from "../../utils/date/time";
import { TypeIconCollectionCard } from "../../components/utils/iconsCollection";
import { Card } from "../../components/card/card";
@@ -47,6 +55,7 @@ import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline";
import { MdiHeart } from "../../components/icons/mdiHeart";
import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
+import { MdiClockOutline } from "../../components/icons/mdiClockOutline";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -213,7 +222,7 @@ const ItemDetail = () => {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type == "Person",
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
networkMode: "always",
});
const personShows = useQuery({
@@ -229,7 +238,7 @@ const ItemDetail = () => {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type == "Person",
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
networkMode: "always",
});
@@ -246,7 +255,7 @@ const ItemDetail = () => {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type == "Person",
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
networkMode: "always",
});
const personPhotos = useQuery({
@@ -261,7 +270,7 @@ const ItemDetail = () => {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type == "Person",
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
networkMode: "always",
});
const personEpisodes = useQuery({
@@ -277,7 +286,20 @@ const ItemDetail = () => {
});
return result.data;
},
- enabled: item.isSuccess && item.data.Type == "Person",
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.Person,
+ networkMode: "always",
+ });
+
+ const musicTracks = useQuery({
+ queryKey: ["item", id, "musicTracks"],
+ queryFn: async () => {
+ const result = await getItemsApi(window.api).getItems({
+ userId: user.data.Id,
+ parentId: item.data.Id,
+ });
+ return result.data;
+ },
+ enabled: item.isSuccess && item.data.Type == BaseItemKind.MusicAlbum,
networkMode: "always",
});
@@ -312,6 +334,23 @@ const ItemDetail = () => {
}
item.refetch();
};
+ const handleLikingTrack = async (track) => {
+ let result;
+ if (track.UserData.IsFavorite) {
+ result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
+ userId: user.data.Id,
+ itemId: track.Id,
+ });
+ console.log(result.statusText);
+ } else if (!track.UserData.IsFavorite) {
+ result = await getUserLibraryApi(window.api).markFavoriteItem({
+ userId: user.data.Id,
+ itemId: track.Id,
+ });
+ }
+ item.refetch();
+ musicTracks.refetch();
+ };
const [activePersonTab, setActivePersonTab] = useState(0);
@@ -734,16 +773,17 @@ const ItemDetail = () => {
{item.data.Genres != 0 && (
-
+
-
+
Genre
{item.data.Genres.map(
@@ -760,6 +800,34 @@ const ItemDetail = () => {
)}
+
+ {item.data.Type == BaseItemKind.MusicAlbum && (
+
+
+ Artists
+
+ {item.data.Artists.map((mitem, mindex) => {
+ return (
+
+ {mitem}
+
+ );
+ })}
+
+ )}
+
{!!item.data.Overview && (
@@ -775,240 +843,125 @@ const ItemDetail = () => {
)}
- {nextUpEpisode.isSuccess && (
-
- {nextUpEpisode.data.Items.map(
- (mitem, mindex) => {
- return (
-
-
-
- );
- },
- )}
-
- )}
-
- {seasons.isSuccess && (
-
- {
- setCurrentSeason(newVal);
- }}
- sx={{ mb: 2 }}
- selectionFollowsFocus
- >
- {seasons.data.Items.map(
- (season, index) => {
- return (
-
- );
- },
- )}
-
- {seasons.data.Items.map((season, index) => {
- return (
-
-
+
+
+
- {episodes.isLoading ? (
-
- ) : (
- episodes.data.Items.map(
- (
- mitem,
- mindex,
- ) => {
- return (
-
+ #
+
+
+
+
+
+ Name
+
+
+
+
+
+
+
+
+
+
+ {musicTracks.isSuccess &&
+ musicTracks.data.Items.map(
+ (mitem, mindex) => {
+ return (
+
+
+
+ {
+ mitem.IndexNumber
}
- xs={
- 1
- }
- sm={
- 1
- }
- md={
- 1
+
+
+
+
+ handleLikingTrack(
+ mitem,
+ )
}
>
-
-
- );
- },
- )
- )}
-
-
- );
- })}
-
- )}
- {item.data.People.length != 0 && (
-
- {item.data.People.map((person, index) => {
- return (
-
- );
- })}
-
+ {mitem
+ .UserData
+ .IsFavorite ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ {
+ mitem.Name
+ }
+
+
+
+
+ {getRuntimeMusic(
+ mitem.RunTimeTicks,
+ )}
+
+
+
+ );
+ },
+ )}
+
+
+
)}
- {item.data.Type == "Person" &&
+ {item.data.Type == BaseItemKind.Person &&
personShows.isSuccess &&
personMovies.isSuccess &&
personBooks.isSuccess &&
@@ -1658,6 +1611,240 @@ const ItemDetail = () => {
)}
+ {nextUpEpisode.isSuccess && (
+
+ {nextUpEpisode.data.Items.map(
+ (mitem, mindex) => {
+ return (
+
+
+
+ );
+ },
+ )}
+
+ )}
+
+ {seasons.isSuccess && (
+
+ {
+ setCurrentSeason(newVal);
+ }}
+ sx={{ mb: 2 }}
+ selectionFollowsFocus
+ >
+ {seasons.data.Items.map(
+ (season, index) => {
+ return (
+
+ );
+ },
+ )}
+
+ {seasons.data.Items.map((season, index) => {
+ return (
+
+
+ {episodes.isLoading ? (
+
+ ) : (
+ episodes.data.Items.map(
+ (
+ mitem,
+ mindex,
+ ) => {
+ return (
+
+
+
+ );
+ },
+ )
+ )}
+
+
+ );
+ })}
+
+ )}
+
+ {item.data.People.length != 0 && (
+
+ {item.data.People.map((person, index) => {
+ return (
+
+ );
+ })}
+
+ )}
+
{similarItems.data.Items.length != 0 && (
{
timeMin -= timeHr * 60;
formatedTime = `${timeHr}hr ${timeMin}min`;
} else {
- formatedTime = `${timeMin}min`;
+ formatedTime = `${timeMin}min ${timeSec}sec`;
+ }
+ return formatedTime;
+};
+
+/**
+ * @format
+ * @param {number} ticks - C# ticks of a particular item
+ * @return {number} Converted ticks to hh:mm:ss formate
+ */
+export const getRuntimeMusic = (ticks) => {
+ let time = ticksToMs(ticks);
+ let formatedTime = "";
+ let timeSec = Math.floor(time / 1000);
+ let timeMin = Math.floor(timeSec / 60);
+ timeSec -= timeMin * 60;
+ if (timeMin > 60) {
+ let timeHr = Math.floor(timeMin / 60);
+ timeMin -= timeHr * 60;
+ formatedTime = `${timeHr}:${timeMin}`;
+ } else {
+ formatedTime = `${timeMin}:${timeSec}`;
}
return formatedTime;
};
@@ -36,8 +57,9 @@ export const getRuntime = (ticks) => {
export const getRuntimeFull = (ticks) => {
let time = ticksToMs(ticks);
let formatedTime = "";
- let timeSec = Math.round(time / 1000);
- let timeMin = Math.round(timeSec / 60);
+ let timeSec = Math.floor(time / 1000);
+ let timeMin = Math.floor(timeSec / 60);
+ timeSec -= timeMin * 60;
if (timeMin > 60) {
let timeHr = Math.floor(timeMin / 60);
timeMin -= timeHr * 60;