refactor: improve UI components
This commit is contained in:
14 files changed
+220
-246
No files matched your search
@@ -1,17 +1,17 @@
|
|||||||
import { setServer } from "@/utils/storage/servers";
|
|
||||||
import { jellyfin } from "@/utils/store/api";
|
|
||||||
import { LoadingButton } from "@mui/lab";
|
import { LoadingButton } from "@mui/lab";
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
InputBase,
|
||||||
DialogContent,
|
Stack,
|
||||||
DialogTitle,
|
Typography,
|
||||||
TextField,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { setServer } from "@/utils/storage/servers";
|
||||||
|
import { jellyfin } from "@/utils/store/api";
|
||||||
|
|
||||||
type AddServerDialogProps = {
|
type AddServerDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -64,72 +64,98 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
|||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
|
onClose={() => setAddServerDialog(false)}
|
||||||
hideBackdrop={Boolean(hideBackdrop)}
|
hideBackdrop={Boolean(hideBackdrop)}
|
||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
disableScrollLock={true}
|
disableScrollLock={true}
|
||||||
|
PaperProps={{
|
||||||
|
sx: {
|
||||||
|
backgroundColor: "rgba(20, 20, 30, 0.7)",
|
||||||
|
backdropFilter: "blur(24px) saturate(180%)",
|
||||||
|
backgroundImage:
|
||||||
|
"linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0))",
|
||||||
|
border: "1px solid rgba(255, 255, 255, 0.08)",
|
||||||
|
boxShadow: "0 20px 50px rgba(0,0,0,0.5)",
|
||||||
|
borderRadius: 4,
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle variant="h4" align="center" mb={1}>
|
<Stack p={4} spacing={3}>
|
||||||
Add Server
|
<Stack spacing={1} alignItems="center">
|
||||||
</DialogTitle>
|
<span
|
||||||
<DialogContent className="settings-server-add">
|
className="material-symbols-rounded"
|
||||||
<TextField
|
style={{
|
||||||
variant="filled"
|
fontSize: "48px",
|
||||||
label="Address"
|
color: "var(--mui-palette-primary-main)",
|
||||||
fullWidth
|
}}
|
||||||
onChange={(e) => setServerIp(e.target.value)}
|
>
|
||||||
/>
|
add_to_queue
|
||||||
</DialogContent>
|
</span>
|
||||||
<DialogActions
|
<Typography variant="h5" fontWeight="bold" textAlign="center">
|
||||||
style={{
|
Connect to Server
|
||||||
alignItems: "center",
|
</Typography>
|
||||||
justifyContent: "center",
|
<Typography variant="body2" color="text.secondary" textAlign="center">
|
||||||
padding: "1em",
|
Enter your Jellyfin server address to continue
|
||||||
gap: "1em",
|
</Typography>
|
||||||
}}
|
</Stack>
|
||||||
>
|
|
||||||
<Button
|
<Box
|
||||||
variant="contained"
|
sx={{
|
||||||
startIcon={
|
p: "2px 16px",
|
||||||
<span
|
bgcolor: "rgba(0,0,0,0.2)",
|
||||||
className="material-symbols-rounded"
|
borderRadius: 2,
|
||||||
style={{
|
border: "1px solid rgba(255,255,255,0.05)",
|
||||||
marginRight: "0.25em",
|
display: "flex",
|
||||||
fontVariationSettings:
|
alignItems: "center",
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
gap: 2,
|
||||||
}}
|
"&:focus-within": {
|
||||||
>
|
border: "1px solid var(--mui-palette-primary-main)",
|
||||||
cancel
|
bgcolor: "rgba(0,0,0,0.3)",
|
||||||
</span>
|
},
|
||||||
}
|
transition: "all 0.2s",
|
||||||
color="error"
|
}}
|
||||||
onClick={() => setAddServerDialog(false)}
|
|
||||||
>
|
>
|
||||||
Close
|
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||||
</Button>
|
dns
|
||||||
{/* @ts-ignore */}
|
</span>
|
||||||
<LoadingButton
|
<InputBase
|
||||||
startIcon={
|
placeholder="https://jellyfin.example.com"
|
||||||
<span
|
fullWidth
|
||||||
className="material-symbols-rounded"
|
value={serverIp}
|
||||||
style={{
|
onChange={(e) => setServerIp(e.target.value)}
|
||||||
marginRight: "0.25em",
|
sx={{ py: 1.5 }}
|
||||||
fontVariationSettings:
|
autoFocus
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
onKeyDown={(e) => {
|
||||||
}}
|
if (e.key === "Enter") {
|
||||||
>
|
addServer.mutate();
|
||||||
add_circle
|
}
|
||||||
</span>
|
}}
|
||||||
}
|
/>
|
||||||
variant="contained"
|
</Box>
|
||||||
loading={addServer.isPending}
|
|
||||||
loadingPosition="start"
|
<Stack direction="row" spacing={2} justifyContent="flex-end" pt={1}>
|
||||||
onClick={addServer.mutate}
|
<Button
|
||||||
color="success"
|
onClick={() => setAddServerDialog(false)}
|
||||||
>
|
color="inherit"
|
||||||
Add
|
variant="text"
|
||||||
</LoadingButton>
|
sx={{ borderRadius: 2 }}
|
||||||
</DialogActions>
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<LoadingButton
|
||||||
|
loading={addServer.isPending}
|
||||||
|
onClick={() => addServer.mutate()}
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
sx={{ borderRadius: 2, px: 3 }}
|
||||||
|
disabled={!serverIp}
|
||||||
|
>
|
||||||
|
Connect
|
||||||
|
</LoadingButton>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -16,15 +16,20 @@
|
|||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
backdrop-filter: blur(40px);
|
|
||||||
inset: -0.35em;
|
inset: -0.35em;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
|
||||||
background: rgb(0 0 0 / 0.4);
|
// Glass styling matching Search Dialog
|
||||||
|
background-color: rgba(20, 20, 30, 0.7);
|
||||||
|
backdrop-filter: blur(24px) saturate(180%);
|
||||||
|
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
transition: opacity $transition-time-fast;
|
transition: all $transition-time-fast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,11 +130,11 @@ export const AppBar = () => {
|
|||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={handleDrawerOpen}>
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
<div className="material-symbols-rounded">menu</div>
|
<span className="material-symbols-rounded">menu</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<MemoizeBackButton />
|
<MemoizeBackButton />
|
||||||
<IconButton onClick={handleNavigateToHome}>
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
<div
|
<span
|
||||||
className={
|
className={
|
||||||
location.pathname === "/home"
|
location.pathname === "/home"
|
||||||
? "material-symbols-rounded fill"
|
? "material-symbols-rounded fill"
|
||||||
@@ -142,16 +142,16 @@ export const AppBar = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
home
|
home
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton onClick={toggleSearchDialog}>
|
<IconButton onClick={toggleSearchDialog}>
|
||||||
<div className="material-symbols-rounded">search</div>
|
<span className="material-symbols-rounded">search</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton onClick={handleNavigateToFavorite}>
|
<IconButton onClick={handleNavigateToFavorite}>
|
||||||
<div className="material-symbols-rounded">favorite</div>
|
<span className="material-symbols-rounded">favorite</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<UserAvatarMenu />
|
<UserAvatarMenu />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { UserItemDataDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
import { pink } from "@mui/material/colors";
|
import { pink } from "@mui/material/colors";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
|
import React from "react";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
export default function LikeButton({
|
export default function LikeButton({
|
||||||
itemId,
|
itemId,
|
||||||
@@ -78,24 +76,24 @@ export default function LikeButton({
|
|||||||
transition: "opacity 250ms",
|
transition: "opacity 250ms",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={
|
style={
|
||||||
isFavorite
|
isFavorite
|
||||||
? {
|
? {
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
"--fill": mutation.isPending ? 0 : 1,
|
"--fill": mutation.isPending ? 0 : 1,
|
||||||
color: mutation.isPending ? "white" : pink.A700,
|
color: mutation.isPending ? "white" : pink.A700,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
"--fill": mutation.isPending ? 1 : 0,
|
"--fill": mutation.isPending ? 1 : 0,
|
||||||
color: mutation.isPending ? pink.A700 : "white",
|
color: mutation.isPending ? pink.A700 : "white",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
favorite
|
favorite
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -263,14 +263,14 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded em-4 fill"
|
className="material-symbols-rounded em-4 fill"
|
||||||
style={{
|
style={{
|
||||||
fontSize: "3em",
|
fontSize: "3em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
</Fab>
|
</Fab>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ const PlayButton = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
startIcon={
|
startIcon={
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
@@ -303,7 +303,7 @@ const PlayButton = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -384,7 +384,7 @@ const PlayButton = ({
|
|||||||
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
item.Type === "Episode" ? handleClick(e, item.Id) : handleClick(e)
|
||||||
}
|
}
|
||||||
startIcon={
|
startIcon={
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded fill"
|
className="material-symbols-rounded fill"
|
||||||
style={{
|
style={{
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
@@ -392,7 +392,7 @@ const PlayButton = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
play_arrow
|
play_arrow
|
||||||
</div>
|
</span>
|
||||||
}
|
}
|
||||||
{...buttonProps}
|
{...buttonProps}
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -160,13 +160,21 @@ const QueueButton = () => {
|
|||||||
open={open}
|
open={open}
|
||||||
onClose={() => setOpen(false)}
|
onClose={() => setOpen(false)}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
|
className: "glass",
|
||||||
sx: {
|
sx: {
|
||||||
width: 450,
|
width: 450,
|
||||||
maxWidth: "100%",
|
maxWidth: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
bgcolor: "background.default",
|
borderLeft: "1px solid rgba(255, 255, 255, 0.08)",
|
||||||
backgroundImage: "none",
|
},
|
||||||
|
}}
|
||||||
|
ModalProps={{
|
||||||
|
BackdropProps: {
|
||||||
|
sx: {
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
||||||
|
backdropFilter: "blur(4px)",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -179,9 +187,10 @@ const QueueButton = () => {
|
|||||||
position: "sticky",
|
position: "sticky",
|
||||||
top: 0,
|
top: 0,
|
||||||
zIndex: 20,
|
zIndex: 20,
|
||||||
bgcolor: "background.default",
|
|
||||||
borderBottom: "1px solid",
|
borderBottom: "1px solid",
|
||||||
borderColor: "divider",
|
borderColor: "rgba(255, 255, 255, 0.08)",
|
||||||
|
backgroundColor: "rgba(20, 20, 30, 0.4)",
|
||||||
|
backdropFilter: "blur(12px)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center" gap={1}>
|
<Box display="flex" alignItems="center" gap={1}>
|
||||||
@@ -194,7 +203,7 @@ const QueueButton = () => {
|
|||||||
sx={{
|
sx={{
|
||||||
ml: 1,
|
ml: 1,
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
bgcolor: "action.hover",
|
bgcolor: "rgba(255, 255, 255, 0.08)",
|
||||||
px: 1,
|
px: 1,
|
||||||
py: 0.5,
|
py: 0.5,
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
import useInterval from "@/utils/hooks/useInterval";
|
|
||||||
import { saveUser } from "@/utils/storage/user";
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
import { LoadingButton, type LoadingButtonProps } from "@mui/lab";
|
||||||
@@ -22,6 +19,9 @@ import { useNavigate } from "@tanstack/react-router";
|
|||||||
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||||
import { useSnackbar } from "notistack";
|
import { useSnackbar } from "notistack";
|
||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
import useInterval from "@/utils/hooks/useInterval";
|
||||||
|
import { saveUser } from "@/utils/storage/user";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
const Transition = React.forwardRef(function Transition(
|
const Transition = React.forwardRef(function Transition(
|
||||||
props: TransitionProps & {
|
props: TransitionProps & {
|
||||||
@@ -185,6 +185,7 @@ const QuickConnectButton = (props: LoadingButtonProps) => {
|
|||||||
fullWidth
|
fullWidth
|
||||||
maxWidth="xs"
|
maxWidth="xs"
|
||||||
TransitionComponent={Transition}
|
TransitionComponent={Transition}
|
||||||
|
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
|
||||||
>
|
>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const TrailerButton = (props: TrailerButtonType) => {
|
|||||||
fullWidth
|
fullWidth
|
||||||
open={dialog}
|
open={dialog}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
|
className: "glass",
|
||||||
style: {
|
style: {
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -82,12 +82,13 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity $transition-time-default;
|
transition: all $transition-time-default;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
background: rgb(0 0 0 / 0.6);
|
background: rgba(20, 20, 30, 0.6);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
}
|
}
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
|
|||||||
@@ -164,9 +164,19 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
const restoreGenres = () => setLocalGenreIds(initialGenres);
|
const restoreGenres = () => setLocalGenreIds(initialGenres);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm" keepMounted>
|
<Dialog
|
||||||
|
open={open}
|
||||||
|
onClose={onClose}
|
||||||
|
fullWidth
|
||||||
|
maxWidth="sm"
|
||||||
|
keepMounted
|
||||||
|
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
|
||||||
|
>
|
||||||
<DialogTitle>Filters</DialogTitle>
|
<DialogTitle>Filters</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent
|
||||||
|
dividers
|
||||||
|
sx={{ borderColor: "rgba(255, 255, 255, 0.1)" }}
|
||||||
|
>
|
||||||
<Stack spacing={1.25}>
|
<Stack spacing={1.25}>
|
||||||
<Accordion
|
<Accordion
|
||||||
disableGutters
|
disableGutters
|
||||||
@@ -186,7 +196,7 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
"& .MuiAccordionSummary-content": { my: 0 },
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
}}
|
}}
|
||||||
expandIcon={
|
expandIcon={
|
||||||
<div className="material-symbols-rounded">expand_more</div>
|
<span className="material-symbols-rounded">expand_more</span>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">General</Typography>
|
<Typography variant="subtitle2">General</Typography>
|
||||||
@@ -236,7 +246,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
"& .MuiAccordionSummary-content": { my: 0 },
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
}}
|
}}
|
||||||
expandIcon={
|
expandIcon={
|
||||||
<div className="material-symbols-rounded">expand_more</div>
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">Video features</Typography>
|
<Typography variant="subtitle2">Video features</Typography>
|
||||||
@@ -288,7 +300,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
"& .MuiAccordionSummary-content": { my: 0 },
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
}}
|
}}
|
||||||
expandIcon={
|
expandIcon={
|
||||||
<div className="material-symbols-rounded">expand_more</div>
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">Resolution</Typography>
|
<Typography variant="subtitle2">Resolution</Typography>
|
||||||
@@ -334,7 +348,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
"& .MuiAccordionSummary-content": { my: 0 },
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
}}
|
}}
|
||||||
expandIcon={
|
expandIcon={
|
||||||
<div className="material-symbols-rounded">expand_more</div>
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">Media type</Typography>
|
<Typography variant="subtitle2">Media type</Typography>
|
||||||
@@ -383,7 +399,9 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
|||||||
"& .MuiAccordionSummary-content": { my: 0 },
|
"& .MuiAccordionSummary-content": { my: 0 },
|
||||||
}}
|
}}
|
||||||
expandIcon={
|
expandIcon={
|
||||||
<div className="material-symbols-rounded">expand_more</div>
|
<span className="material-symbols-rounded">
|
||||||
|
expand_more
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Typography variant="subtitle2">Genres</Typography>
|
<Typography variant="subtitle2">Genres</Typography>
|
||||||
@@ -475,7 +493,7 @@ export const FiltersDialogTrigger: React.FC = () => {
|
|||||||
onClick={() => setOpen(true)}
|
onClick={() => setOpen(true)}
|
||||||
aria-label="Open filters dialog"
|
aria-label="Open filters dialog"
|
||||||
>
|
>
|
||||||
<div
|
<span
|
||||||
className="material-symbols-rounded"
|
className="material-symbols-rounded"
|
||||||
style={{ position: "relative" }}
|
style={{ position: "relative" }}
|
||||||
>
|
>
|
||||||
@@ -498,7 +516,7 @@ export const FiltersDialogTrigger: React.FC = () => {
|
|||||||
{activeCount}
|
{activeCount}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<FiltersDialog open={open} onClose={() => setOpen(false)} />
|
<FiltersDialog open={open} onClose={() => setOpen(false)} />
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||||
import {
|
import {
|
||||||
|
alpha,
|
||||||
Box,
|
Box,
|
||||||
IconButton,
|
IconButton,
|
||||||
ListItem,
|
ListItem,
|
||||||
@@ -94,16 +95,23 @@ const QueueListItem = ({
|
|||||||
}
|
}
|
||||||
sx={{
|
sx={{
|
||||||
opacity: active ? 1 : 1,
|
opacity: active ? 1 : 1,
|
||||||
bgcolor: active ? "transparent" : "background.paper",
|
bgcolor: active ? "rgba(255, 255, 255, 0.1)" : "rgba(0,0,0,0.2)",
|
||||||
borderRadius: 3,
|
borderRadius: 3,
|
||||||
mb: 0,
|
mb: 0,
|
||||||
transition: "all 0.2s ease",
|
transition: "all 0.2s ease",
|
||||||
border: active ? "none" : "1px solid",
|
border: "1px solid",
|
||||||
borderColor: "divider",
|
borderColor: active
|
||||||
|
? "rgba(255, 255, 255, 0.2)"
|
||||||
|
: "rgba(255,255,255,0.05)",
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
bgcolor: active ? "transparent" : "action.hover",
|
bgcolor: active
|
||||||
|
? "rgba(255, 255, 255, 0.15)"
|
||||||
|
: "rgba(255,255,255,0.05)",
|
||||||
transform: active ? "none" : "translateY(-2px)",
|
transform: active ? "none" : "translateY(-2px)",
|
||||||
boxShadow: active ? "none" : 2,
|
borderColor: active
|
||||||
|
? "rgba(255, 255, 255, 0.3)"
|
||||||
|
: "rgba(255,255,255,0.2)",
|
||||||
|
boxShadow: active ? "none" : "0 4px 12px rgba(0,0,0,0.2)",
|
||||||
},
|
},
|
||||||
pr: onDelete ? 6 : 2,
|
pr: onDelete ? 6 : 2,
|
||||||
...sx,
|
...sx,
|
||||||
@@ -117,7 +125,7 @@ const QueueListItem = ({
|
|||||||
marginRight: 12,
|
marginRight: 12,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
opacity: 0.3,
|
opacity: 0.5,
|
||||||
transition: "opacity 0.2s",
|
transition: "opacity 0.2s",
|
||||||
}}
|
}}
|
||||||
className="drag-handle"
|
className="drag-handle"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import useSettingsStore, {
|
import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
|
||||||
setSettingsDialogOpen,
|
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
|
||||||
setSettingsTabValue,
|
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||||
} from "@/utils/store/settings";
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Chip,
|
Chip,
|
||||||
@@ -18,19 +17,25 @@ import {
|
|||||||
TextField,
|
TextField,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { AnimatePresence, motion } from "motion/react";
|
import { AnimatePresence, motion } from "motion/react";
|
||||||
import React, { useState, useMemo, useCallback } from "react";
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
import logo from "@/assets/logo.png";
|
import logo from "@/assets/logo.png";
|
||||||
|
|
||||||
import { jellyfin, useApiInContext } from "@/utils/store/api";
|
import { jellyfin, useApiInContext } from "@/utils/store/api";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
|
import useSettingsStore, {
|
||||||
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
|
setSettingsDialogOpen,
|
||||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
setSettingsTabValue,
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
} from "@/utils/store/settings";
|
||||||
import "./settings.scss";
|
import "./settings.scss";
|
||||||
|
|
||||||
|
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
import { red } from "@mui/material/colors";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
import { relaunch } from "@tauri-apps/plugin-process";
|
||||||
|
import { check } from "@tauri-apps/plugin-updater";
|
||||||
|
import { useSnackbar } from "notistack";
|
||||||
import {
|
import {
|
||||||
delServer,
|
delServer,
|
||||||
getAllServers,
|
getAllServers,
|
||||||
@@ -40,13 +45,7 @@ import {
|
|||||||
} from "@/utils/storage/servers";
|
} from "@/utils/storage/servers";
|
||||||
import { allSettings } from "@/utils/storage/settings";
|
import { allSettings } from "@/utils/storage/settings";
|
||||||
import { delUser } from "@/utils/storage/user";
|
import { delUser } from "@/utils/storage/user";
|
||||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
import AddServerDialog from "../addServerDialog";
|
||||||
import { LoadingButton } from "@mui/lab";
|
|
||||||
import { red } from "@mui/material/colors";
|
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
|
||||||
import { relaunch } from "@tauri-apps/plugin-process";
|
|
||||||
import { check } from "@tauri-apps/plugin-updater";
|
|
||||||
import { useSnackbar } from "notistack";
|
|
||||||
import SettingOption from "../settingOption";
|
import SettingOption from "../settingOption";
|
||||||
import SettingOptionSelect from "../settingOptionSelect";
|
import SettingOptionSelect from "../settingOptionSelect";
|
||||||
|
|
||||||
@@ -64,12 +63,12 @@ const Settings = () => {
|
|||||||
state.dialogOpen,
|
state.dialogOpen,
|
||||||
state.tabValue,
|
state.tabValue,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
const createApi = useApiInContext((s) => s.createApi);
|
const createApi = useApiInContext((s) => s.createApi);
|
||||||
|
|
||||||
const user = useCentralStore((state) => state.currentUser);
|
const user = useCentralStore((state) => state.currentUser);
|
||||||
|
|
||||||
const systemInfo = useQuery({
|
const systemInfo = useQuery({
|
||||||
queryKey: ["about", "systemInfo"],
|
queryKey: ["about", "systemInfo"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@@ -83,7 +82,9 @@ const Settings = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const [applicationVersion] = useCentralStore((state) => [state.clientVersion]);
|
const [applicationVersion] = useCentralStore((state) => [
|
||||||
|
state.clientVersion,
|
||||||
|
]);
|
||||||
|
|
||||||
const serversOnDisk = useQuery({
|
const serversOnDisk = useQuery({
|
||||||
queryKey: ["settings", "serversOnDisk"],
|
queryKey: ["settings", "serversOnDisk"],
|
||||||
@@ -113,7 +114,7 @@ const Settings = () => {
|
|||||||
enabled: open,
|
enabled: open,
|
||||||
});
|
});
|
||||||
|
|
||||||
const clientSettingsOnServer = useQuery({
|
const _clientSettingsOnServer = useQuery({
|
||||||
queryKey: ["settings", "clientSettings"],
|
queryKey: ["settings", "clientSettings"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!api) return;
|
if (!api) return;
|
||||||
@@ -127,13 +128,11 @@ const Settings = () => {
|
|||||||
enabled: open,
|
enabled: open,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
// Server Management
|
// Server Management
|
||||||
const [updating, setUpdating] = useState(false);
|
const [updating, setUpdating] = useState(false);
|
||||||
const [addServerDialog, setAddServerDialog] = useState(false);
|
const [addServerDialog, setAddServerDialog] = useState(false);
|
||||||
const [serverIp, setServerIp] = useState("");
|
|
||||||
|
|
||||||
const handleServerChange = useMutation({
|
const handleServerChange = useMutation({
|
||||||
mutationFn: async (server: RecommendedServerInfo) => {
|
mutationFn: async (server: RecommendedServerInfo) => {
|
||||||
@@ -181,40 +180,6 @@ const Settings = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const addServer = useMutation({
|
|
||||||
mutationFn: async () => {
|
|
||||||
const servers =
|
|
||||||
await jellyfin.discovery.getRecommendedServerCandidates(serverIp);
|
|
||||||
const bestServer = jellyfin.discovery.findBestServer(servers);
|
|
||||||
return bestServer;
|
|
||||||
},
|
|
||||||
onSuccess: async (bestServer) => {
|
|
||||||
if (bestServer) {
|
|
||||||
await setServer(bestServer.systemInfo?.Id ?? "", bestServer);
|
|
||||||
setAddServerDialog(false);
|
|
||||||
enqueueSnackbar(
|
|
||||||
"Client added successfully. You might need to refresh client list.",
|
|
||||||
{
|
|
||||||
variant: "success",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await serversOnDisk.refetch();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (err) => {
|
|
||||||
console.error(err);
|
|
||||||
enqueueSnackbar(`${err}`, { variant: "error" });
|
|
||||||
enqueueSnackbar("Something went wrong", { variant: "error" });
|
|
||||||
},
|
|
||||||
onSettled: async (bestServer) => {
|
|
||||||
if (!bestServer) {
|
|
||||||
enqueueSnackbar("Provided server address is not a Jellyfin server.", {
|
|
||||||
variant: "error",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Memoize PaperProps to prevent unnecessary re-renders
|
// Memoize PaperProps to prevent unnecessary re-renders
|
||||||
const paperProps = useMemo(
|
const paperProps = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -636,73 +601,14 @@ const Settings = () => {
|
|||||||
</motion.div>
|
</motion.div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
|
||||||
{/* Add Server */}
|
<AddServerDialog
|
||||||
<Dialog
|
|
||||||
open={addServerDialog}
|
open={addServerDialog}
|
||||||
fullWidth
|
setAddServerDialog={setAddServerDialog}
|
||||||
hideBackdrop
|
hideBackdrop
|
||||||
disableScrollLock={true}
|
sideEffect={async () => {
|
||||||
>
|
await serversOnDisk.refetch();
|
||||||
<DialogTitle>Add Server</DialogTitle>
|
}}
|
||||||
<DialogContent className="settings-server-add">
|
/>
|
||||||
<TextField
|
|
||||||
variant="filled"
|
|
||||||
label="Address"
|
|
||||||
fullWidth
|
|
||||||
onChange={(e) => setServerIp(e.target.value)}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions
|
|
||||||
style={{
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
padding: "1em",
|
|
||||||
gap: "1em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
startIcon={
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{
|
|
||||||
marginRight: "0.25em",
|
|
||||||
fontVariationSettings:
|
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
cancel
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
color="error"
|
|
||||||
onClick={() => setAddServerDialog(false)}
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</Button>
|
|
||||||
{/* @ts-ignore */}
|
|
||||||
<LoadingButton
|
|
||||||
startIcon={
|
|
||||||
<span
|
|
||||||
className="material-symbols-rounded"
|
|
||||||
style={{
|
|
||||||
marginRight: "0.25em",
|
|
||||||
fontVariationSettings:
|
|
||||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
add_circle
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
variant="contained"
|
|
||||||
loading={addServer.isPending}
|
|
||||||
loadingPosition="start"
|
|
||||||
onClick={addServer.mutate}
|
|
||||||
color="success"
|
|
||||||
>
|
|
||||||
Add
|
|
||||||
</LoadingButton>
|
|
||||||
</DialogActions>
|
|
||||||
</Dialog>
|
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export const UserAvatarMenu = () => {
|
|||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
sx={menuStyle}
|
sx={menuStyle}
|
||||||
disableScrollLock
|
disableScrollLock
|
||||||
|
PaperProps={{ className: "glass" }}
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -99,7 +100,7 @@ export const UserAvatarMenu = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<div className="material-symbols-rounded">logout</div>
|
<span className="material-symbols-rounded">logout</span>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
Logout
|
Logout
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -112,7 +113,7 @@ export const UserAvatarMenu = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<div className="material-symbols-rounded">settings</div>
|
<span className="material-symbols-rounded">settings</span>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
Settings
|
Settings
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -123,7 +124,7 @@ export const UserAvatarMenu = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<div className="material-symbols-rounded">tune</div>
|
<span className="material-symbols-rounded">tune</span>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
Preferences
|
Preferences
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@@ -134,7 +135,7 @@ export const UserAvatarMenu = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<div className="material-symbols-rounded">info</div>
|
<span className="material-symbols-rounded">info</span>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
About
|
About
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|||||||
@@ -296,10 +296,10 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.glass {
|
.glass {
|
||||||
background: rgba(0, 0, 0, 0.6) !important;
|
background-color: rgba(20, 20, 30, 0.7) !important;
|
||||||
backdrop-filter: blur(20px);
|
backdrop-filter: blur(24px) saturate(180%) !important;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.opacity-07{
|
.opacity-07{
|
||||||
|
|||||||
Reference in new issue
Block a user