diff --git a/src/App.jsx b/src/App.jsx
index 63684b1..fcfd2df 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -93,6 +93,9 @@ const anim = {
animate: {
opacity: 1,
},
+ exit: {
+ opacity: 0,
+ },
};
const AnimationWrapper = () => {
@@ -102,8 +105,9 @@ const AnimationWrapper = () => {
variants={anim}
initial="initial"
animate="animate"
+ exit="exit"
transition={{
- duration: 0.4,
+ duration: 0.35,
}}
>
diff --git a/src/routes/library/index.jsx b/src/routes/library/index.jsx
index 2a679c3..2d71fd3 100644
--- a/src/routes/library/index.jsx
+++ b/src/routes/library/index.jsx
@@ -2,7 +2,7 @@
import { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
-import { useParams, useNavigate } from "react-router-dom";
+import { useParams, useNavigate, Link } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
@@ -24,12 +24,14 @@ import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import Button from "@mui/material/Button";
-import Paper from "@mui/material/Paper";
import Table from "@mui/material/Table";
+import TableBody from "@mui/material/TableBody";
import TableContainer from "@mui/material/TableContainer";
import TableRow from "@mui/material/TableRow";
import TableCell from "@mui/material/TableCell";
import IconButton from "@mui/material/IconButton";
+import Pagination from "@mui/material/Pagination";
+import ButtonBase from "@mui/material/ButtonBase";
import { theme } from "../../theme";
@@ -55,6 +57,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import {
BaseItemKind,
CollectionTypeOptions,
+ ItemFields,
} from "@jellyfin/sdk/lib/generated-client";
import { getRuntimeMusic } from "../../utils/date/time";
@@ -68,6 +71,9 @@ const LibraryView = () => {
const dispatch = useDispatch();
const appBarVisiblity = useSelector((state) => state.appBar.visible);
+ const [page, setPage] = useState(1);
+ const maxDisplayItems = 50;
+
if (!appBarVisiblity) {
dispatch(showAppBar());
}
@@ -104,6 +110,7 @@ const LibraryView = () => {
const result = await getItemsApi(window.api).getItems({
userId: user.data.Id,
ids: [libraryId],
+ fields: [ItemFields.RecursiveItemCount],
});
return result.data;
};
@@ -296,6 +303,8 @@ const LibraryView = () => {
isHd: isHD ? true : undefined,
is4K: is4K ? true : undefined,
is3D: is3D ? true : undefined,
+ startIndex: maxDisplayItems * (page - 1),
+ limit: maxDisplayItems,
});
}
return result.data;
@@ -306,6 +315,7 @@ const LibraryView = () => {
"libraryView",
"currentLibItems",
id,
+ `page: ${page}`,
[
currentViewType,
sortAscending,
@@ -331,7 +341,7 @@ const LibraryView = () => {
queryFn: () => fetchLibItems(id),
enabled: currentLib.isSuccess,
networkMode: "always",
- refetchOnWindowFocus: false,
+ keepPreviousData: true,
});
const handleCurrentViewType = (e) => {
@@ -821,7 +831,16 @@ const LibraryView = () => {
alignItems: "center",
}}
>
-
+
) : items.data.TotalRecordCount == 0 ? (
@@ -829,7 +848,12 @@ const LibraryView = () => {
{items.data.Items.map((item, index) => {
return (
-
+
{
) : (
- {items.data.Items.map((item, index) => {
- return (
-
-
-
- {!!item.ImageTags
- .Primary && (
-
- )}
-
-
+
+ {items.data.Items.map((item, index) => {
+ return (
+
+
+
+ {!!item
+ .ImageTags
+ .Primary && (
+
+ )}
+
+
+
-
-
-
-
- {item.Name}
-
-
- {item.Album}
-
-
-
-
- {getRuntimeMusic(
- item.RunTimeTicks,
- )}
-
-
-
- {
- handleLiking(
- item,
- );
- }}
- >
- {item.UserData
- .IsFavorite ? (
-
- ) : (
-
- )}
-
-
-
- );
- })}
+
+
+
+ {item.Name}
+
+
+ ,
+
+ }
+ >
+ {item.Artists.map(
+ (
+ artist,
+ aindex,
+ ) => {
+ return (
+
+ {
+ artist
+ }
+
+ );
+ },
+ )}
+
+
+
+
+ {getRuntimeMusic(
+ item.RunTimeTicks,
+ )}
+
+
+
+ {
+ handleLiking(
+ item,
+ );
+ }}
+ >
+ {item.UserData
+ .IsFavorite ? (
+
+ ) : (
+
+ )}
+
+
+
+ );
+ })}
+
)}
+
+ {!items.isFetching &&
+ items.isSuccess &&
+ items.data.TotalRecordCount > 75 && (
+
+
+ {maxDisplayItems * (page - 1)} -{" "}
+ {items.data.TotalRecordCount <=
+ maxDisplayItems * page
+ ? items.data.TotalRecordCount
+ : maxDisplayItems * page}{" "}
+ of {items.data.TotalRecordCount}
+
+ {
+ setPage(val);
+ }}
+ count={Math.ceil(
+ items.data.TotalRecordCount /
+ maxDisplayItems,
+ )}
+ sx={{
+ width: "fit-content",
+ }}
+ />
+
+ )}
+
{items.isError && }