refactor: add sorting options to library page for Series and BoxSets
This commit is contained in:
76 files changed
+7110
-2350
No files matched your search
@@ -8,6 +8,9 @@
|
||||
position: relative;
|
||||
overscroll-behavior-x: contain;
|
||||
margin: 0.5em 1em;
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: inline-block;
|
||||
|
||||
@@ -1,39 +1,22 @@
|
||||
import type React from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
import React, { type ReactNode } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import Avatar from "@mui/material/Avatar";
|
||||
import Button from "@mui/material/Button";
|
||||
import Grow from "@mui/material/Grow";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Popper from "@mui/material/Popper";
|
||||
import Toolbar from "@mui/material/Toolbar";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { red } from "@mui/material/colors";
|
||||
|
||||
import {
|
||||
Link,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
useRouteContext,
|
||||
} from "@tanstack/react-router";
|
||||
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { delServer } from "@/utils/storage/servers";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import { useDrawerStore } from "@/utils/store/drawer";
|
||||
import "./appBar.scss";
|
||||
|
||||
import { EventEmitter as event } from "@/eventEmitter";
|
||||
@@ -41,7 +24,7 @@ import { EventEmitter as event } from "@/eventEmitter";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import useSettingsStore, {
|
||||
import {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
@@ -56,7 +39,7 @@ import {
|
||||
import BackButton from "../buttons/backButton";
|
||||
|
||||
interface ListItemLinkProps {
|
||||
icon?: React.ReactElement;
|
||||
icon?: ReactNode;
|
||||
primary: string;
|
||||
to: string;
|
||||
}
|
||||
@@ -141,7 +124,7 @@ export const AppBar = () => {
|
||||
event.emit("create-jellyfin-api", api.basePath);
|
||||
queryClient.clear();
|
||||
setAnchorEl(null);
|
||||
navigate("/login/index");
|
||||
navigate({ to: "/login" });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -157,7 +140,6 @@ export const AppBar = () => {
|
||||
} else {
|
||||
setDisplay(true);
|
||||
}
|
||||
|
||||
}, [location]);
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
@@ -186,7 +168,7 @@ export const AppBar = () => {
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<BackButton />
|
||||
<IconButton onClick={() => navigate({ to: "/home/" })}>
|
||||
<IconButton onClick={() => navigate({ to: "/home" })}>
|
||||
<div
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
@@ -209,7 +191,10 @@ export const AppBar = () => {
|
||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
||||
{user.isSuccess &&
|
||||
(user.data.PrimaryImageTag === undefined ? (
|
||||
<Avatar className="appBar-avatar" alt={user.data.Name}>
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
alt={user.data.Name ?? "image"}
|
||||
>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
</span>
|
||||
@@ -218,7 +203,7 @@ export const AppBar = () => {
|
||||
<Avatar
|
||||
className="appBar-avatar"
|
||||
src={`${api.basePath}/Users/${user.data.Id}/Images/Primary`}
|
||||
alt={user.data.Name}
|
||||
alt={user.data.Name ?? "image"}
|
||||
>
|
||||
<span className="material-symbols-rounded appBar-avatar-icon">
|
||||
account_circle
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -8,7 +9,7 @@ import { Card } from "../../../card/card";
|
||||
import { CardScroller } from "../../../cardScroller/cardScroller";
|
||||
|
||||
const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const items = useQuery({
|
||||
queryKey: ["library", "genreItem", genreId],
|
||||
|
||||
@@ -9,29 +9,30 @@ const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
||||
isAnimating,
|
||||
});
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
opacity: isFinished ? 0 : 1,
|
||||
pointerEvents: "none",
|
||||
transition: `opacity ${animationDuration}ms linear`,
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
right: "0",
|
||||
zIndex: "10001",
|
||||
}}
|
||||
>
|
||||
<LinearProgress
|
||||
sx={{
|
||||
height: 3,
|
||||
transitionDuration: animationDuration,
|
||||
if (isAnimating) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
pointerEvents: "none",
|
||||
transition: `opacity ${animationDuration}ms linear`,
|
||||
position: "fixed",
|
||||
top: "0",
|
||||
left: "0",
|
||||
right: "0",
|
||||
zIndex: "10001",
|
||||
}}
|
||||
value={progress * 100}
|
||||
variant="determinate"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
>
|
||||
<LinearProgress
|
||||
sx={{
|
||||
height: 3,
|
||||
transitionDuration: animationDuration,
|
||||
}}
|
||||
value={progress * 100}
|
||||
variant="determinate"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default NProgress;
|
||||
@@ -14,7 +14,9 @@ export const EmptyNotice = ({ extraMsg }) => {
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexFlow: "column",
|
||||
// opacity: 0.2,
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -46,9 +46,9 @@ import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
|
||||
import { enqueueSnackbar, useSnackbar } from "notistack";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
import { type Update, check } from "@tauri-apps/plugin-updater";
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
const motionConfig = {
|
||||
initial: {
|
||||
@@ -93,7 +93,7 @@ const Settings = () => {
|
||||
|
||||
const updateInfo = useQuery({
|
||||
queryKey: ["about", "updater"],
|
||||
queryFn: async () => await checkUpdate(),
|
||||
queryFn: async () => await check(),
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ const Settings = () => {
|
||||
},
|
||||
onSuccess: async () => {
|
||||
setSettingsDialogOpen(false);
|
||||
navigate({ to: "/login/index" });
|
||||
navigate({ to: "/login" });
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error(error);
|
||||
@@ -438,7 +438,7 @@ const Settings = () => {
|
||||
className="material-symbols-rounded"
|
||||
style={{ "--wght": 500 }}
|
||||
>
|
||||
{updateInfo.data?.shouldUpdate
|
||||
{updateInfo.data?.available
|
||||
? "new_release"
|
||||
: "new_releases"}
|
||||
</span>
|
||||
@@ -448,9 +448,7 @@ const Settings = () => {
|
||||
{applicationVersion}
|
||||
</Typography>
|
||||
}
|
||||
color={
|
||||
updateInfo.data?.shouldUpdate ? "error" : "success"
|
||||
}
|
||||
color={updateInfo.data?.available ? "error" : "success"}
|
||||
size="small"
|
||||
style={{
|
||||
width: "fit-content !important",
|
||||
@@ -464,7 +462,7 @@ const Settings = () => {
|
||||
<Typography variant="subtitle2">
|
||||
{updateInfo.isFetching ? (
|
||||
"Checking for new updates..."
|
||||
) : updateInfo.data?.shouldUpdate ? (
|
||||
) : updateInfo.data?.available ? (
|
||||
<Chip
|
||||
icon={
|
||||
<span className="material-symbols-rounded">
|
||||
@@ -493,12 +491,12 @@ const Settings = () => {
|
||||
}}
|
||||
loading={updateInfo.isFetching || updating}
|
||||
variant="contained"
|
||||
disabled={!updateInfo.data?.shouldUpdate}
|
||||
disabled={!updateInfo.data?.available}
|
||||
loadingPosition="start"
|
||||
onClick={async () => {
|
||||
if (updateInfo.data?.shouldUpdate) {
|
||||
if (updateInfo.data?.available) {
|
||||
setUpdating(true);
|
||||
await installUpdate();
|
||||
await updateInfo.data?.downloadAndInstall();
|
||||
enqueueSnackbar(
|
||||
"Update has been installed! You need to relaunch JellyPlayer.",
|
||||
{
|
||||
@@ -511,7 +509,7 @@ const Settings = () => {
|
||||
>
|
||||
{updateInfo.isFetching
|
||||
? "Checking for Update..."
|
||||
: updateInfo.data?.shouldUpdate
|
||||
: updateInfo.data?.available
|
||||
? "Update"
|
||||
: "No Update Found"}
|
||||
</LoadingButton>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Skeleton } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
const LibraryItemsSkeleton = () => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
overflow: "visible",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
{Array.from(new Array(18)).map((item, index) => (
|
||||
<Skeleton
|
||||
key={index}
|
||||
variant="rounded"
|
||||
sx={{
|
||||
flexBasis: 185,
|
||||
height: "auto",
|
||||
aspectRatio: 0.6666,
|
||||
// background: "red",
|
||||
marginRight: "1.5em",
|
||||
marginBottom: "1.5em",
|
||||
flexShrink: 1,
|
||||
flexGrow: 0,
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LibraryItemsSkeleton;
|
||||
Reference in new issue
Block a user