refactor: update UI for setup
This commit is contained in:
8 files changed
+624
-338
No files matched your search
@@ -2,7 +2,6 @@ import React, { type ReactNode, useRef, useState } from "react";
|
||||
import Carousel from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
import { Box } from "@mui/material";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
} from "./utils/store/api";
|
||||
import { CentralProvider, useCentralStore } from "./utils/store/central";
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
networkMode: "always",
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { OutlinedInput, Typography } from "@mui/material";
|
||||
import { Paper, TextField, Typography } from "@mui/material";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import InputLabel from "@mui/material/InputLabel";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
@@ -24,6 +22,7 @@ import React, {
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { saveUser } from "@/utils/storage/user";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
@@ -71,13 +70,15 @@ function LoginUser() {
|
||||
});
|
||||
};
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
const setBackdrop = useBackdropStore(
|
||||
useShallow((state) => state.setBackdrop),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!api) {
|
||||
return;
|
||||
}
|
||||
setBackdrop("", "");
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
const handleCheckRememberMe = (
|
||||
@@ -129,82 +130,130 @@ function LoginUser() {
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
flexDirection: "column",
|
||||
width: "30vw",
|
||||
margin: "auto",
|
||||
}}
|
||||
className="login flex flex-center flex-column centered"
|
||||
style={{ marginTop: 0 }}
|
||||
>
|
||||
<AvatarImage userId={userId} />
|
||||
<div style={{ display: "inline-flex", margin: "1em 0" }}>
|
||||
<Typography variant="h5">Login as</Typography>
|
||||
<Typography
|
||||
variant="h5"
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
maxWidth: "600px",
|
||||
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,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "inline",
|
||||
marginBottom: "2em",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: "1em",
|
||||
}}
|
||||
ml={0.5}
|
||||
fontWeight={700}
|
||||
className="gradient-text"
|
||||
>
|
||||
{userName}
|
||||
</Typography>
|
||||
</div>
|
||||
<form onSubmit={(e) => handleLogin.mutate(e)}>
|
||||
<FormControl
|
||||
variant="outlined"
|
||||
<AvatarImage userId={userId} />
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1" sx={{ opacity: 0.7 }}>
|
||||
Login as
|
||||
</Typography>
|
||||
<Typography variant="h5" fontWeight={700} className="gradient-text">
|
||||
{userName}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form
|
||||
onSubmit={(e) => handleLogin.mutate(e)}
|
||||
style={{
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "1.5rem",
|
||||
}}
|
||||
>
|
||||
<InputLabel htmlFor="user-password">Password</InputLabel>
|
||||
<OutlinedInput
|
||||
id="user-password"
|
||||
<TextField
|
||||
fullWidth
|
||||
type={password.showpass ? "text" : "password"}
|
||||
onChange={handlePassword("password")}
|
||||
label="Password"
|
||||
endAdornment={
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={handleShowPassword}
|
||||
aria-label="toggle password visibility"
|
||||
>
|
||||
{password.showpass ? (
|
||||
<span className="material-symbols-rounded">visibility</span>
|
||||
) : (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility_off
|
||||
</span>
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
variant="outlined"
|
||||
autoFocus
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
key
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconButton onClick={handleShowPassword} edge="end">
|
||||
{password.showpass ? (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility
|
||||
</span>
|
||||
) : (
|
||||
<span className="material-symbols-rounded">
|
||||
visibility_off
|
||||
</span>
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox checked={rememberMe} onChange={handleCheckRememberMe} />
|
||||
}
|
||||
label="Remember me"
|
||||
/>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={
|
||||
<span className="material-symbols-rounded">chevron_right</span>
|
||||
}
|
||||
type="submit"
|
||||
loading={handleLogin.isPending}
|
||||
loadingPosition="end"
|
||||
size="large"
|
||||
fullWidth
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
</form>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={handleCheckRememberMe}
|
||||
/>
|
||||
}
|
||||
label="Remember me"
|
||||
sx={{ m: 0 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
endIcon={<span className="material-symbols-rounded">login</span>}
|
||||
type="submit"
|
||||
loading={handleLogin.isPending}
|
||||
loadingPosition="end"
|
||||
size="large"
|
||||
fullWidth
|
||||
sx={{ borderRadius: 2, height: 48 }}
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
</form>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+130
-35
@@ -1,5 +1,5 @@
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { Chip, Typography } from "@mui/material";
|
||||
import { Box, Chip, Typography } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
@@ -7,10 +7,10 @@ import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice.jsx";
|
||||
import "./login.scss";
|
||||
|
||||
import type { UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Paper } from "@mui/material";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
|
||||
import avatar from "../../../assets/icons/avatar.png";
|
||||
|
||||
export const Route = createFileRoute("/_api/login/list")({
|
||||
@@ -24,21 +24,66 @@ const UserCard = ({ user }: { user: UserDto }) => {
|
||||
to="/login/$userId/$userName"
|
||||
params={{ userId: user.Id ?? "", userName: user.Name ?? "" }}
|
||||
className="user-list-item user-card"
|
||||
style={{ textDecoration: "none", display: "block" }}
|
||||
>
|
||||
<div className="user-card-image-container">
|
||||
{user.PrimaryImageTag ? (
|
||||
<img
|
||||
className="user-card-image"
|
||||
alt={"user"}
|
||||
src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
|
||||
/>
|
||||
) : (
|
||||
<img className="user-card-image" alt="user" src={avatar} />
|
||||
)}
|
||||
</div>
|
||||
<Typography mt={1} align="center">
|
||||
{user.Name}
|
||||
</Typography>
|
||||
<Paper
|
||||
elevation={0}
|
||||
sx={{
|
||||
p: 2,
|
||||
bgcolor: "rgba(255,255,255,0.03)",
|
||||
"&:hover": {
|
||||
bgcolor: "rgba(255,255,255,0.1)",
|
||||
transform: "translateY(-4px)",
|
||||
boxShadow: "0 8px 20px rgba(0,0,0,0.3)",
|
||||
},
|
||||
transition: "all 0.3s ease",
|
||||
borderRadius: 4,
|
||||
border: "1px solid rgba(255,255,255,0.05)",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
width: "160px",
|
||||
height: "100%",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="user-card-image-container"
|
||||
style={{
|
||||
width: "100px",
|
||||
height: "100px",
|
||||
borderRadius: "50%",
|
||||
overflow: "hidden",
|
||||
boxShadow: "0 8px 16px rgba(0,0,0,0.3)",
|
||||
}}
|
||||
>
|
||||
{user.PrimaryImageTag ? (
|
||||
<img
|
||||
className="user-card-image"
|
||||
alt={"user"}
|
||||
src={`${api?.basePath}/Users/${user.Id}/Images/Primary?quality=80&tag=${user.PrimaryImageTag}`}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
) : (
|
||||
<img
|
||||
className="user-card-image"
|
||||
alt="user"
|
||||
src={avatar}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Typography
|
||||
mt={2}
|
||||
align="center"
|
||||
variant="subtitle1"
|
||||
fontWeight="bold"
|
||||
noWrap
|
||||
sx={{ width: "100%", color: "text.primary" }}
|
||||
>
|
||||
{user.Name}
|
||||
</Typography>
|
||||
</Paper>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
@@ -63,27 +108,77 @@ function LoginPublicUsersList() {
|
||||
|
||||
if (users.isSuccess) {
|
||||
return (
|
||||
<div className="login-container scrollY">
|
||||
<Typography variant="h4" align="center">
|
||||
Users
|
||||
</Typography>
|
||||
<div className="login-container scrollY flex flex-column flex-center">
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
maxWidth: "800px",
|
||||
width: "90%",
|
||||
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,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 3,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h4" align="center" fontWeight="bold">
|
||||
Select User
|
||||
</Typography>
|
||||
|
||||
<div className="user-list-container roundedScrollbar">
|
||||
{users.data.map((item) => {
|
||||
return <UserCard user={item} key={item.Id} />;
|
||||
})}
|
||||
</div>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexWrap: "wrap",
|
||||
gap: 3,
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
maxHeight: "60vh",
|
||||
overflowY: "auto",
|
||||
py: 2,
|
||||
"&::-webkit-scrollbar": { display: "none" },
|
||||
scrollbarWidth: "none",
|
||||
}}
|
||||
>
|
||||
{users.data.map((item) => {
|
||||
return <UserCard user={item} key={item.Id} />;
|
||||
})}
|
||||
</Box>
|
||||
|
||||
<Chip
|
||||
style={{ marginLeft: "50%", transform: "translateX(-50%)" }}
|
||||
label={
|
||||
<Typography variant="body2" align="center">
|
||||
Don't see your user? Try using{" "}
|
||||
<Link to="/login/manual">Manual Login</Link> or{" "}
|
||||
<Link to="/setup/server/list">Changing Server</Link>
|
||||
</Typography>
|
||||
}
|
||||
/>
|
||||
<Chip
|
||||
label={
|
||||
<Typography variant="body2" align="center">
|
||||
Don't see your user? Try using{" "}
|
||||
<Link
|
||||
to="/login/manual"
|
||||
style={{ color: "inherit", fontWeight: "bold" }}
|
||||
>
|
||||
Manual Login
|
||||
</Link>{" "}
|
||||
or{" "}
|
||||
<Link
|
||||
to="/setup/server/list"
|
||||
style={{ color: "inherit", fontWeight: "bold" }}
|
||||
>
|
||||
Changing Server
|
||||
</Link>
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
p: 1,
|
||||
height: "auto",
|
||||
"& .MuiChip-label": {
|
||||
padding: "8px 12px",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Paper>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,36 +1,31 @@
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { Paper, TextField, Typography } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, {
|
||||
type ChangeEvent,
|
||||
type FormEvent,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
import { saveUser } from "@/utils/storage/user.js";
|
||||
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { OutlinedInput, Paper, TextField, Typography } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import Checkbox from "@mui/material/Checkbox";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import InputAdornment from "@mui/material/InputAdornment";
|
||||
import InputLabel from "@mui/material/InputLabel";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api.js";
|
||||
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
|
||||
import "./login.scss";
|
||||
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
import { blue } from "@mui/material/colors";
|
||||
import {
|
||||
createFileRoute,
|
||||
useNavigate,
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop.js";
|
||||
|
||||
export const Route = createFileRoute("/_api/login/manual")({
|
||||
component: UserLoginManual,
|
||||
@@ -96,7 +91,12 @@ function UserLoginManual() {
|
||||
}
|
||||
createApi(api.basePath, authenticate.data?.AccessToken);
|
||||
|
||||
if (rememberMe) await saveUser(username, authenticate.data.AccessToken);
|
||||
if (rememberMe)
|
||||
await saveUser(
|
||||
username,
|
||||
authenticate.data.AccessToken,
|
||||
authenticate.data.User?.Id ?? "",
|
||||
);
|
||||
router.invalidate().finally(() => {
|
||||
navigate({ to: searchParams.redirect || "/home", replace: true });
|
||||
});
|
||||
@@ -122,40 +122,85 @@ function UserLoginManual() {
|
||||
setRememberMe(checked);
|
||||
};
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
const setBackdrop = useBackdropStore(
|
||||
useShallow((state) => state.setBackdrop),
|
||||
);
|
||||
useEffect(() => {
|
||||
setBackdrop("", "");
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="login scrollY">
|
||||
<div
|
||||
className={`login-form-container ${
|
||||
server.data?.LoginDisclaimer && "padded-top"
|
||||
}`}
|
||||
<div className="login scrollY flex flex-center flex-column">
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
maxWidth: "600px",
|
||||
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,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 3,
|
||||
mb: 3,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h4" color="textPrimary">
|
||||
<Typography variant="h4" fontWeight="bold" align="center">
|
||||
Login
|
||||
</Typography>
|
||||
<form className="login-form" onSubmit={(e) => handleLogin.mutate(e)}>
|
||||
<form
|
||||
className="flex flex-column"
|
||||
style={{ gap: "1.5em", width: "100%" }}
|
||||
onSubmit={(e) => handleLogin.mutate(e)}
|
||||
>
|
||||
<TextField
|
||||
variant="outlined"
|
||||
label="Username"
|
||||
label="Username" // Label helps accessibility, theme handles style
|
||||
fullWidth
|
||||
onChange={(e) => setUsername(e.currentTarget.value)}
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
person
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<FormControl sx={{ width: "100%" }} variant="outlined">
|
||||
<InputLabel htmlFor="user-password">Password</InputLabel>
|
||||
<OutlinedInput
|
||||
fullWidth
|
||||
id="user-password"
|
||||
type={password.showpass ? "text" : "password"}
|
||||
onChange={handlePassword("password")}
|
||||
label="Password"
|
||||
endAdornment={
|
||||
<TextField
|
||||
fullWidth
|
||||
type={password.showpass ? "text" : "password"}
|
||||
onChange={handlePassword("password")}
|
||||
label="Password"
|
||||
variant="outlined"
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5 }}
|
||||
>
|
||||
key
|
||||
</span>
|
||||
</InputAdornment>
|
||||
),
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={handleShowPassword}
|
||||
aria-label="toggle password visibility"
|
||||
edge="end"
|
||||
sx={{
|
||||
color: "rgba(255,255,255,0.7)",
|
||||
"&:hover": { color: "#fff" },
|
||||
}}
|
||||
>
|
||||
{password.showpass ? (
|
||||
<span className="material-symbols-rounded">
|
||||
@@ -168,48 +213,68 @@ function UserLoginManual() {
|
||||
)}
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox checked={rememberMe} onChange={handleCheckRememberMe} />
|
||||
<Checkbox
|
||||
checked={rememberMe}
|
||||
onChange={handleCheckRememberMe}
|
||||
sx={{
|
||||
color: "rgba(255,255,255,0.5)",
|
||||
"&.Mui-checked": {
|
||||
color: "primary.main",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Typography variant="body2" sx={{ opacity: 0.7 }}>
|
||||
Remember me
|
||||
</Typography>
|
||||
}
|
||||
label="Remember me"
|
||||
/>
|
||||
<div
|
||||
className="flex flex-row"
|
||||
style={{ width: "100%", gap: "0.8em", flexWrap: "wrap" }}
|
||||
>
|
||||
|
||||
<div className="flex flex-column" style={{ gap: "1em" }}>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
type="submit"
|
||||
loading={handleLogin.isPending}
|
||||
sx={{ width: "100%" }}
|
||||
sx={{ width: "100%", height: 48, borderRadius: 2 }}
|
||||
size="large"
|
||||
>
|
||||
Login
|
||||
</LoadingButton>
|
||||
<Button
|
||||
color="secondary"
|
||||
variant="contained"
|
||||
className="userEventButton"
|
||||
// size="large"
|
||||
style={{ flex: 1 }}
|
||||
color="inherit"
|
||||
variant="text"
|
||||
sx={{
|
||||
width: "100%",
|
||||
color: "rgba(255,255,255,0.5)",
|
||||
"&:hover": {
|
||||
color: "white",
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
},
|
||||
}}
|
||||
onClick={() => navigate({ to: "/setup/server/list" })}
|
||||
>
|
||||
Change Server
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</Paper>
|
||||
{server.isSuccess && server.data?.LoginDisclaimer && (
|
||||
<Paper
|
||||
elevation={0}
|
||||
style={{
|
||||
marginTop: "1em",
|
||||
padding: "1em",
|
||||
borderRadius: "15px",
|
||||
width: "28em",
|
||||
sx={{
|
||||
padding: "1.5em",
|
||||
borderRadius: "16px",
|
||||
width: "100%",
|
||||
maxWidth: "450px",
|
||||
backgroundColor: "rgba(33, 150, 243, 0.1)",
|
||||
border: "1px solid rgba(33, 150, 243, 0.2)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
@@ -219,16 +284,16 @@ function UserLoginManual() {
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
color: blue[700],
|
||||
//@ts-ignore
|
||||
"--fill": 1,
|
||||
color: blue[400],
|
||||
}}
|
||||
>
|
||||
info
|
||||
</span>
|
||||
Notice
|
||||
<Typography variant="subtitle1" fontWeight="bold">
|
||||
Notice
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||
<Typography variant="body2" style={{ opacity: 0.8, lineHeight: 1.6 }}>
|
||||
{server.data.LoginDisclaimer}
|
||||
</Typography>
|
||||
</Paper>
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import React, { type FormEvent, useState } from "react";
|
||||
|
||||
import { setDefaultServer, setServer } from "@/utils/storage/servers";
|
||||
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import { yellow } from "@mui/material/colors";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
import React, { type FormEvent, useState } from "react";
|
||||
import { setDefaultServer, setServer } from "@/utils/storage/servers";
|
||||
import { jellyfin, useApiInContext } from "@/utils/store/api";
|
||||
import { yellow } from "@mui/material/colors";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
// SCSS
|
||||
import "./server.scss";
|
||||
import { Paper, Stack } from "@mui/material";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import logo from "../../assets/logoBlackTransparent.png";
|
||||
|
||||
export const Route = createFileRoute("/setup/server/add")({
|
||||
component: ServerSetup,
|
||||
@@ -66,56 +65,85 @@ function ServerSetup() {
|
||||
});
|
||||
|
||||
return (
|
||||
<div
|
||||
className={"centered serverContainer flex flex-column flex-center"}
|
||||
style={{
|
||||
opacity: checkServer.isPending ? "0.5" : "1",
|
||||
transition: "opacity 350ms",
|
||||
width: "40vw",
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: "1em" }}>
|
||||
<Typography variant="h3">Add Server</Typography>
|
||||
</div>
|
||||
<form
|
||||
onSubmit={(e) => checkServer.mutate(e)}
|
||||
className="flex flex-column"
|
||||
style={{ gap: "1em", width: "100%" }}
|
||||
>
|
||||
<TextField
|
||||
className="textbox"
|
||||
label="Server Address:"
|
||||
variant="outlined"
|
||||
// inputRef={serverIp}
|
||||
onChange={(event) => {
|
||||
setServerIp(event.target.value);
|
||||
}}
|
||||
/>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
sx={{ width: "100%" }}
|
||||
size="large"
|
||||
loading={checkServer.isPending}
|
||||
endIcon={
|
||||
<span className="material-symbols-rounded">chevron_right</span>
|
||||
}
|
||||
loadingPosition="end"
|
||||
type="submit"
|
||||
>
|
||||
Add Server
|
||||
</LoadingButton>
|
||||
</form>
|
||||
<Grid
|
||||
item
|
||||
xl={5}
|
||||
md={6}
|
||||
<div className="centered serverContainer flex flex-column flex-center">
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
opacity: 0.6,
|
||||
maxWidth: "40em",
|
||||
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",
|
||||
}}
|
||||
>
|
||||
<Stack spacing={2} width="30em" alignItems="center">
|
||||
<img
|
||||
src={logo}
|
||||
alt="Blink"
|
||||
style={{
|
||||
width: "200px",
|
||||
height: "auto",
|
||||
objectFit: "contain",
|
||||
}}
|
||||
/>
|
||||
|
||||
<Typography
|
||||
variant="body1"
|
||||
color="text.secondary"
|
||||
textAlign="center"
|
||||
maxWidth="80%"
|
||||
sx={{ lineHeight: 1.5 }}
|
||||
>
|
||||
Enter your Jellyfin server address to get started
|
||||
</Typography>
|
||||
|
||||
<form
|
||||
onSubmit={(e) => checkServer.mutate(e)}
|
||||
className="flex flex-column"
|
||||
style={{ gap: "1em", width: "100%" }}
|
||||
>
|
||||
<TextField
|
||||
className="textbox"
|
||||
placeholder="https://jellyfin.example.com"
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
// inputRef={serverIp}
|
||||
onChange={(event) => {
|
||||
setServerIp(event.target.value);
|
||||
}}
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ opacity: 0.5, marginRight: "12px" }}
|
||||
>
|
||||
dns
|
||||
</span>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
sx={{ width: "100%", borderRadius: 2, height: 48 }}
|
||||
size="large"
|
||||
loading={checkServer.isPending}
|
||||
type="submit"
|
||||
>
|
||||
Connect
|
||||
</LoadingButton>
|
||||
</form>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={1}
|
||||
alignItems="center"
|
||||
sx={{ mt: 3, opacity: 0.6 }}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
@@ -128,7 +156,7 @@ function ServerSetup() {
|
||||
<Typography variant="subtitle1">
|
||||
Example: https://demo.jellyfin.org/stable
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+126
-114
@@ -1,21 +1,7 @@
|
||||
import React, { useLayoutEffect, useState } from "react";
|
||||
|
||||
import Chip from "@mui/material/Chip";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
|
||||
import AppBarBackOnly from "@/components/appBar/backOnly";
|
||||
import {
|
||||
type ServerInfo,
|
||||
delServer,
|
||||
getAllServers,
|
||||
getDefaultServer,
|
||||
setDefaultServer,
|
||||
} from "@/utils/storage/servers";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
createFileRoute,
|
||||
@@ -23,7 +9,19 @@ import {
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useLayoutEffect, useState } from "react";
|
||||
import AppBarBackOnly from "@/components/appBar/backOnly";
|
||||
import {
|
||||
delServer,
|
||||
getAllServers,
|
||||
getDefaultServer,
|
||||
type ServerInfo,
|
||||
setDefaultServer,
|
||||
} from "@/utils/storage/servers";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./serverList.scss";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import AddServerDialog from "@/components/addServerDialog";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
@@ -95,124 +93,138 @@ function ServerList() {
|
||||
await defaultServer.refetch();
|
||||
};
|
||||
|
||||
const setBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
const setBackdrop = useBackdropStore(
|
||||
useShallow((state) => state.setBackdrop),
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setBackdrop("", "");
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
const [addServerDialog, setAddServerDialog] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="server-list">
|
||||
<div className="server-list flex flex-column flex-center centered">
|
||||
<AppBarBackOnly />
|
||||
<div
|
||||
style={{
|
||||
<Paper
|
||||
sx={{
|
||||
p: 4,
|
||||
width: "100%",
|
||||
maxWidth: "600px",
|
||||
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",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
width: "40vw",
|
||||
alignItems: "center",
|
||||
marginBottom: "2em",
|
||||
flexDirection: "column",
|
||||
gap: 3,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3" fontWeight={200}>
|
||||
Servers
|
||||
</Typography>
|
||||
<IconButton
|
||||
<div
|
||||
style={{
|
||||
fontSize: "1.64em",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
onClick={() => setAddServerDialog(true)}
|
||||
>
|
||||
<div className="material-symbols-rounded">add</div>
|
||||
</IconButton>
|
||||
<AddServerDialog
|
||||
open={addServerDialog}
|
||||
sideEffect={() => servers.refetch()}
|
||||
setAddServerDialog={setAddServerDialog}
|
||||
/>
|
||||
</div>
|
||||
<Paper className="server-list-container">
|
||||
{servers.isSuccess &&
|
||||
servers.data.map((server) => (
|
||||
<div key={server.id} className="server-list-item">
|
||||
<div className="material-symbols-rounded server-list-item-icon">
|
||||
dns
|
||||
</div>
|
||||
<div className="server-list-item-info">
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={400}
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{server.systemInfo?.ServerName}
|
||||
{server.id === defaultServer.data && (
|
||||
<Chip
|
||||
label={
|
||||
<Typography variant="caption" fontWeight={700}>
|
||||
Current
|
||||
</Typography>
|
||||
}
|
||||
color="info"
|
||||
sx={{
|
||||
ml: 2,
|
||||
width: "5.4em",
|
||||
}}
|
||||
size="small"
|
||||
/>
|
||||
)}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.7,
|
||||
}}
|
||||
fontWeight={300}
|
||||
>
|
||||
{server.address}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.5,
|
||||
}}
|
||||
fontWeight={300}
|
||||
>
|
||||
Version: {server.systemInfo?.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="server-list-item-buttons">
|
||||
<IconButton
|
||||
style={{
|
||||
fontSize: "1.64em",
|
||||
}}
|
||||
onClick={() => {
|
||||
handleServerChange.mutate(server);
|
||||
}}
|
||||
disabled={handleServerChange.isPending}
|
||||
>
|
||||
<div className="material-symbols-rounded">start</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
style={{
|
||||
fontSize: "1.64em",
|
||||
<Typography variant="h4" fontWeight="bold">
|
||||
Servers
|
||||
</Typography>
|
||||
<IconButton
|
||||
onClick={() => setAddServerDialog(true)}
|
||||
sx={{
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
"&:hover": { bgcolor: "rgba(255,255,255,0.1)" },
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">add</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
color: red[400],
|
||||
}}
|
||||
disabled={handleServerChange.isPending}
|
||||
onClick={() => {
|
||||
handleDelete(server);
|
||||
}}
|
||||
<div className="flex flex-column" style={{ gap: "1em" }}>
|
||||
{servers.isSuccess &&
|
||||
servers.data.map((server) => (
|
||||
<div
|
||||
key={server.id}
|
||||
className="server-list-item"
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
padding: "16px",
|
||||
borderRadius: "16px",
|
||||
backgroundColor: "rgba(0,0,0,0.2)",
|
||||
border: "1px solid rgba(255,255,255,0.05)",
|
||||
gap: "16px",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: "24px", opacity: 0.7 }}
|
||||
>
|
||||
<div className="material-symbols-rounded">delete_forever</div>
|
||||
</IconButton>
|
||||
dns
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={600}
|
||||
sx={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
{server.systemInfo?.ServerName}
|
||||
{server.id === defaultServer.data && (
|
||||
<Chip
|
||||
label="Current"
|
||||
color="primary"
|
||||
size="small"
|
||||
sx={{ height: 20, fontSize: "0.7rem", fontWeight: 700 }}
|
||||
/>
|
||||
)}
|
||||
</Typography>
|
||||
<Typography variant="body2" style={{ opacity: 0.7 }} noWrap>
|
||||
{server.address}
|
||||
</Typography>
|
||||
</div>
|
||||
<div style={{ display: "flex", gap: "8px" }}>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
handleServerChange.mutate(server);
|
||||
}}
|
||||
disabled={handleServerChange.isPending}
|
||||
size="small"
|
||||
sx={{
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
"&:hover": { bgcolor: "var(--mui-palette-primary-main)" },
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">login</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => handleDelete(server)}
|
||||
size="small"
|
||||
sx={{
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
"&:hover": { bgcolor: "var(--mui-palette-error-main)" },
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">delete</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</Paper>
|
||||
<AddServerDialog
|
||||
open={addServerDialog}
|
||||
sideEffect={() => servers.refetch()}
|
||||
setAddServerDialog={setAddServerDialog}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,5 +91,43 @@ export const theme = createTheme({
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiInputLabel: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
marginLeft: "6px",
|
||||
color: "rgba(255, 255, 255, 0.5)",
|
||||
"&.Mui-focused": {
|
||||
color: clrAccentDefault,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiOutlinedInput: {
|
||||
styleOverrides: {
|
||||
notchedOutline: {
|
||||
paddingLeft: "15px",
|
||||
},
|
||||
root: {
|
||||
backgroundColor: "rgba(0,0,0,0.2)",
|
||||
borderRadius: "16px",
|
||||
transition: "border-color 0.2s, background-color 0.2s",
|
||||
"&.Mui-focused": {
|
||||
backgroundColor: "rgba(0,0,0,0.3)",
|
||||
},
|
||||
"&:hover": {
|
||||
backgroundColor: "rgba(0,0,0,0.25)",
|
||||
},
|
||||
"& .MuiOutlinedInput-notchedOutline": {
|
||||
borderColor: "rgba(255,255,255,0.1)",
|
||||
},
|
||||
"&:hover .MuiOutlinedInput-notchedOutline": {
|
||||
borderColor: "rgba(255,255,255,0.3)",
|
||||
},
|
||||
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
||||
borderColor: clrAccentDefault,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user