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