Add about page #52 and fix changeServer

This commit is contained in:
Prayag Prajapati committed 2023-11-21 22:33:02 +05:30
1 parent 16c6a26a2e
commit 1dddbca3b2
10 files changed
+178 -140

No files matched your search

+20 -5
View File
@@ -1,16 +1,31 @@
/** @format */
.about {
&-sections {
&-container {
position: relative;
display: grid;
grid-template-columns: 1fr 1fr;
padding: 4em;
align-items: start;
&-section {
background: $clr-background-dark;
padding: 1em;
border-radius: 12px;
&.monospace * {
font-family: "JetBrains Mono Variable" !important;
}
}
&-logo {
width: 75% !important;
max-width: 50vw;
height: 15em;
height: 5em;
object-fit: contain;
object-position: center;
margin-bottom: 1em !important;
border-bottom: 1.4px solid rgb(255 255 255 / 0.05);
}
&-grid {
display: grid;
grid-template-columns: 1fr 1fr;
width: 100%;
padding: 0.5em 0;
gap: 1em;
}
}
+116 -119
View File
@@ -1,10 +1,10 @@
/** @format */
import React from "react";
import React, { useEffect } from "react";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Stack from "@mui/material/Stack";
import Paper from "@mui/material/Paper";
import TableContainer from "@mui/material/TableContainer";
import CircularProgress from "@mui/material/CircularProgress";
import Table from "@mui/material/Table";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
@@ -13,16 +13,15 @@ import TableCell from "@mui/material/TableCell";
import Link from "@mui/material/Link";
import logo from "../../assets/logo.svg";
import jellyfinLogo from "../../assets/jellyfinLogo.svg";
import { useQuery } from "@tanstack/react-query";
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
import { version } from "../../../package.json";
import "./about.module.scss";
import { useApi } from "../../utils/store/api";
import { axiosClient, useApi } from "../../utils/store/api";
import { useBackdropStore } from "../../utils/store/backdrop";
import { useCentralStore } from "../../utils/store/central";
const About = () => {
const [api] = useApi((state) => [state.api]);
@@ -35,130 +34,128 @@ const About = () => {
enabled: Boolean(api),
});
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
const [applicationVersion] = useCentralStore((state) => [
state.clientVersion,
]);
useEffect(() => {
setBackdrop("", "");
}, []);
if (systemInfo.isPending) {
return (
<div
style={{
position: "fixed",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
}}
>
<CircularProgress size={72} thickness={1.4} />
</div>
);
}
return (
<Box
component="main"
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
>
<main className="scrollY about">
<Stack
alignItems="center"
justifyContent="center"
className="about-sections"
className="about-section monospace"
width="75%"
>
<Link
<a
href="https://github.com/prayag17/JellyPlayer"
className="about-logo"
target="_blank"
rel="noreferrer"
>
<img width="100%" height="100%" src={logo} />
</Link>
<TableContainer
component={Paper}
sx={{ width: "50%", borderRadius: "15px" }}
</a>
<div
style={{
display: "flex",
flexDirection: "column",
opacity: 0.9,
}}
>
<Table>
<TableBody>
<TableRow
sx={{
"&:last-child td, &:last-child th":
{
border: 0,
},
"&:hover": {
background:
"rgb(255 255 255 / 0.05)",
},
}}
>
<TableCell>
<Typography
variant="h4"
fontWeight={100}
>
Version
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{ opacity: 0.7 }}
>
{version}
</Typography>
</TableCell>
</TableRow>
<TableRow
sx={{
"&:last-child td, &:last-child th":
{
border: 0,
},
"&:hover": {
background:
"rgb(255 255 255 / 0.05)",
},
}}
>
<TableCell>
<Typography
variant="h4"
fontWeight={100}
>
Jellyfin Version
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{ opacity: 0.7 }}
>
{systemInfo.isSuccess &&
systemInfo.data.Version}
</Typography>
</TableCell>
</TableRow>
<TableRow
sx={{
"&:last-child td, &:last-child th":
{
border: 0,
},
"&:hover": {
background:
"rgb(255 255 255 / 0.05)",
},
}}
>
<TableCell>
<Typography
variant="h4"
fontWeight={100}
>
Server OS
</Typography>
</TableCell>
<TableCell>
<Typography
variant="h4"
sx={{ opacity: 0.7 }}
>
{systemInfo.isSuccess &&
systemInfo.data
.OperatingSystemDisplayName}
</Typography>
</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
<div className="about-grid">
<Typography variant="h6" fontWeight={300}>
Server
</Typography>
<Typography
variant="h6"
fontWeight={300}
sx={{
opacity: 0.7,
}}
>
{systemInfo.data.ServerName}
</Typography>
</div>
<div className="about-grid">
<Typography variant="h6" fontWeight={300}>
Server Version
</Typography>
<Typography
variant="h6"
fontWeight={300}
sx={{
opacity: 0.7,
}}
>
{systemInfo.data.Version}
</Typography>
</div>
<div className="about-grid">
<Typography variant="h6" fontWeight={300}>
Operating System
</Typography>
<Typography
variant="h6"
fontWeight={300}
sx={{
opacity: 0.7,
}}
>
{systemInfo.data.OperatingSystemDisplayName}
</Typography>
</div>
<div className="about-grid">
<Typography variant="h6" fontWeight={300}>
Architecture
</Typography>
<Typography
variant="h6"
fontWeight={300}
sx={{
opacity: 0.7,
}}
>
{systemInfo.data.SystemArchitecture}
</Typography>
</div>
<div className="about-grid">
<Typography variant="h6" fontWeight={300}>
JellyPlayer Version
</Typography>
<Typography
variant="h6"
fontWeight={300}
sx={{
opacity: 0.7,
}}
>
{applicationVersion}
</Typography>
</div>
</div>
</Stack>
</Box>
</main>
);
};
+5 -4
View File
@@ -35,9 +35,9 @@ const ServerList = () => {
queryFn: async () => await getDefaultServer(),
});
const handleServerChange = useMutation({
mutationFn: () => {
setDefaultServer(serverState);
delUser();
mutationFn: async () => {
await delUser();
await setDefaultServer(serverState);
},
onSuccess: async () => {
await relaunch();
@@ -54,8 +54,9 @@ const ServerList = () => {
let tempList = servers.data.filter(
(item) => item[0] != defaultServer.data && item[0] != serverId,
);
delServer(serverId).then(() => {
delServer(serverId).then(async () => {
// console.log(serverId);
await delUser();
if (serverId == defaultServer.data) {
if (tempList.length > 0) {
setDefaultServer(tempList[0][0]);