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

+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>
);
};