feat(web): Add new About page #258

This commit is contained in:
Prayag Prajapati committed 2024-02-17 16:56:58 +05:30
1 parent bf89f35ddd
commit b155daa83b
34 files changed
+1749 -758

No files matched your search

+2 -2
View File
@@ -8,9 +8,9 @@
backdrop-filter: blur(10px);
}
&-avatar {
background: $clr-gradient-dark;
background: rgb(255 255 255 / 0.1) !important;
&-icon {
fill: url(#clr-gradient-default) !important;
color: white;
}
}
&-text {
@@ -18,7 +18,7 @@ import useScrollTrigger from "@mui/material/useScrollTrigger";
import { red } from "@mui/material/colors";
import { NavLink, useLocation, useNavigate } from "react-router-dom";
import { Link, NavLink, useLocation, useNavigate } from "react-router-dom";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
@@ -33,9 +33,13 @@ import "./appBar.module.scss";
import { EventEmitter as event } from "../../eventEmitter";
import { useApi } from "../../utils/store/api";
import { getTypeIcon } from "../../components/utils/iconsCollection";
import { getTypeIcon } from "../utils/iconsCollection";
import logo from "../../assets/icon.svg";
import {
setSettingsDialogOpen,
setSettingsTabValue,
} from "../../utils/store/settings";
const forwardRefNavLink = React.forwardRef({
displayName: "NavLink",
@@ -380,13 +384,23 @@ export const AppBar = () => {
sx={{ mt: 2 }}
disableScrollLock
>
<MenuItem onClick={() => navigate("/settings")} disabled>
<MenuItem
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(1);
}}
>
<ListItemIcon>
<div className="material-symbols-rounded">settings</div>
</ListItemIcon>
Settings
</MenuItem>
<MenuItem onClick={() => navigate("/about")}>
<MenuItem
onClick={() => {
setSettingsDialogOpen(true);
setSettingsTabValue(10);
}}
>
<ListItemIcon>
<div className="material-symbols-rounded">info</div>
</ListItemIcon>
+2 -2
View File
@@ -17,8 +17,8 @@
&-icon {
height: 100%;
padding: 0.2em;
background: $clr-gradient-dark;
fill: url(#clr-gradient-default) !important;
background: rgb(255 255 255 / 0.1);
color: white;
font-size: 7em !important;
}
}
+11 -2
View File
@@ -30,12 +30,21 @@
overflow: hidden;
height: auto;
z-index: 0;
&.thumb{
aspect-ratio: 1.777777;
}
&.portrait{
aspect-ratio: 0.666666;
}
&.square {
aspect-ratio: 1;
}
}
&-icon {
font-size: 5.4em !important;
fill: url(#clr-gradient-default) !important;
&-container {
background: rgb(255 255 255 / 0.1);
background: linear-gradient(45deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.1));
height: 100%;
width: 100%;
position: absolute;
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
@@ -8,7 +8,7 @@ import Typography from "@mui/material/Typography";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.module.scss";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { BaseItemDto, BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import { useApi } from "../../utils/store/api";
import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton";
@@ -29,43 +29,32 @@ const availableSpecialRoutes = [
BaseItemKind.Playlist,
];
/**
* @typedef {Object} Props
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
* @property {string} cardTitle
* @property {string | number} cardCaption
* @property {string} imageType
* @property {string} imageBlurhash
* @property {'thumb' | 'portrait' | 'square'} cardType
* @property {Array} queryKey
* @property {string} userId
* @property {string} seriesId
* @property {boolean} hideText
* @property {() => {}} onClick
* @property {boolean} disableOverlay
* @property {boolean} disablePadding
* @property {any} overrideIcon
*/
/**
* @description Hero section for item pages
* @param {Props}
* @returns {React.Component}
*/
export const Card = ({
item,
cardTitle,
cardCaption,
imageType = "Primary",
cardType,
cardType = "square",
queryKey,
userId,
seriesId,
hideText,
hideText = false,
onClick,
disableOverlay = false,
overrideIcon,
}: {
item: BaseItemDto;
cardTitle: string | null;
cardCaption: string | null;
imageType: string;
cardType: string;
queryKey: [];
userId: string;
seriesId: string | null;
hideText: boolean;
onClick: Function | null;
disableOverlay: boolean;
overrideIcon: React.Component | null;
}) => {
const [api] = useApi((state) => [state.api]);
const navigate = useNavigate();
@@ -80,18 +69,14 @@ export const Card = ({
navigate(`/item/${item.Id}`);
}
};
return (
<div
className="card"
elevation={0}
onClick={onClick ? onClick : defaultOnClick}
>
<div
className="card-image-container"
style={{
aspectRatio: cardImageAspectRatios[cardType],
}}
>
<div className={`card-image-container ${cardType}`}>
<ErrorBoundary fallback>
<div
className="card-indicator check"
@@ -157,8 +142,9 @@ export const Card = ({
}}
loading="lazy"
onLoad={(e) => {
e.target.style.opacity = 1;
e.currentTarget.style.setProperty("opacity", "1");
}}
onLoadStart={(e) => console.log(e)}
className="card-image"
/>
<div className="card-overlay">
+524
View File
@@ -0,0 +1,524 @@
import {
Chip,
Dialog,
FormControlLabel,
Link,
Skeleton,
Switch,
Tab,
Tabs,
Typography,
styled,
withStyles,
} from "@mui/material";
import { AnimatePresence, motion, transform } from "framer-motion";
import React, { useState } from "react";
import useSettingsStore, {
setSettingsDialogOpen,
setSettingsTabValue,
} from "../../utils/store/settings";
import logo from "../../assets/logoBlack.png";
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
import { useQuery } from "@tanstack/react-query";
import { useApi } from "../../utils/store/api";
import { useCentralStore } from "../../utils/store/central";
import "./settings.module.scss";
import { LoadingButton } from "@mui/lab";
import { relaunch } from "@tauri-apps/api/process";
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
import { enqueueSnackbar, useSnackbar } from "notistack";
const motionConfig = {
forward: {
opacity: 0,
transform: "translateY(-20px)",
},
visible: {
opacity: 1,
transform: "translateY(0px)",
},
backward: {
opacity: 0,
transform: "translateY(20px)",
},
};
const Settings = () => {
const [api] = useApi((state) => [state.api]);
const systemInfo = useQuery({
queryKey: ["about", "systemInfo"],
queryFn: async () => {
const result = await getSystemApi(api).getSystemInfo();
return result.data;
},
enabled: Boolean(api),
});
const updateInfo = useQuery({
queryKey: ["about", "updater"],
queryFn: async () => {
const result = await checkUpdate();
return result;
},
});
const { enqueueSnackbar } = useSnackbar();
const [open, tabValue] = useSettingsStore((state) => [
state.dialogOpen,
state.tabValue,
]);
const [applicationVersion] = useCentralStore((state) => [
state.clientVersion,
]);
const [updating, setUpdating] = useState(false);
const [animDirection, setAnimDirection] = useState("forward");
return (
<Dialog
open={open}
fullWidth
maxWidth="md"
PaperProps={{
className: "settings",
}}
onClose={() => setSettingsDialogOpen(false)}
>
<Tabs
orientation="vertical"
value={tabValue}
onChange={(e, newValue) => {
if (newValue > tabValue) {
setAnimDirection("backward");
} else {
setAnimDirection("forward");
}
setSettingsTabValue(newValue);
}}
style={{
borderRight: "1.2px solid rgb(255 255 255 / 0.1)",
}}
>
<Tab
icon={<span className="material-symbols-rounded">settings</span>}
iconPosition="start"
value={1}
label="General"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
}}
/>
<Tab
icon={<span className="material-symbols-rounded">info</span>}
iconPosition="start"
value={10}
label="About"
className="settings-tab"
sx={{
minHeight: "48px",
height: "48px",
}}
/>
</Tabs>
<AnimatePresence mode="wait">
<motion.div
variants={motionConfig}
initial={animDirection === "backward" ? "backward" : "forward"}
animate="visible"
exit={animDirection === "backward" ? "backward" : "forward"}
key={tabValue}
transition={{
duration: 0.1,
}}
className="settings-scroll "
>
{/* About */}
{tabValue === 10 && (
<div className="settings-container settings-about">
<img src={logo} className="settings-logo" alt="JellyPlayer" />
<div className="settings-grid">
<div className="settings-info-container">
<div className="settings-info">
<Typography>Client Version:</Typography>
<Chip
icon={
<span className="material-symbols-rounded">
{updateInfo.data?.shouldUpdate
? "update"
: "update_disabled"}
</span>
}
label={
<Typography variant="subtitle1">
{applicationVersion}
</Typography>
}
color={
updateInfo.data?.shouldUpdate ? "error" : "success"
}
size="medium"
style={{
width: "fit-content !important",
}}
/>
</div>
<div className="settings-info">
<Typography>Update Available:</Typography>
<Typography>
{updateInfo.isFetching
? "Checking for new updates..."
: updateInfo.data?.shouldUpdate
? updateInfo.data.manifest?.version
: "No update found."}
</Typography>
</div>
<LoadingButton
style={{
marginTop: "auto",
}}
loading={updateInfo.isFetching || updating}
variant="contained"
disabled={!updateInfo.data?.shouldUpdate}
loadingPosition="start"
onClick={async () => {
if (updateInfo.data?.shouldUpdate) {
setUpdating(true);
await installUpdate();
enqueueSnackbar(
"Update has been installed! You need to relaunch JellyPlayer.",
{
variant: "success",
},
);
await relaunch();
}
}}
>
{updateInfo.isFetching
? "Checking for Update..."
: updateInfo.data?.shouldUpdate
? "Update"
: "No Update Found"}
</LoadingButton>
</div>
{systemInfo.isSuccess ? (
<div className="settings-info-container">
<div className="settings-info">
<Typography>Server:</Typography>
<Typography>{systemInfo.data?.ServerName}</Typography>
</div>
<div className="settings-info">
<Typography>Jellyfin Version:</Typography>
<Typography>{systemInfo.data?.Version}</Typography>
</div>
<div className="settings-info">
<Typography>Operating System:</Typography>
<Typography>
{systemInfo.data?.OperatingSystemDisplayName}
</Typography>
</div>
<div className="settings-info">
<Typography>Server Architecture:</Typography>
<Typography>
{systemInfo.data?.SystemArchitecture}
</Typography>
</div>
</div>
) : (
<Skeleton
variant="rectangular"
sx={{
height: "100%",
borderRadius: "10px",
}}
/>
)}
</div>
<div
style={{
marginTop: "1em",
background: "rgb(0 0 0 / 0.3)",
padding: "1em",
borderRadius: "10px",
border: "1px solid rgb(255 255 255 / 0.1)",
}}
>
<Typography variant="h6" fontWeight={300} mb={1}>
Links:
</Typography>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
gap: "0.1em",
}}
>
<Link href="https://github.com/prayag17/JellyPlayer">
https://github.com/prayag17/JellyPlayer
</Link>
<Link href="https://jellyfin.org">https://jellyfin.org</Link>
</div>
</div>
</div>
)}
{/* General */}
{tabValue === 1 && (
<div className="settings-container">
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
<FormControlLabel
value="start"
control={<Switch color="primary" />}
label={
<div className="settings-option-info">
<Typography variant="h6" fontWeight={400}>
Enable DiscordRPC
</Typography>
<Typography variant="subtitle2" fontWeight={200}>
this a test
</Typography>
</div>
}
labelPlacement="start"
className="settings-option"
/>
</div>
)}
</motion.div>
</AnimatePresence>
</Dialog>
);
};
export default Settings;
@@ -0,0 +1,85 @@
.settings{
display: grid !important;
grid-template-columns: 20% 1fr;
height: 60vh;
overflow: hidden !important;
&-container{
margin: 14px 0em 14px 14px;
}
&-tab{
display: grid !important;
grid-template-columns: 2em 1fr;
align-items: center;
justify-items: start !important;
gap:1em;
& .material-symbols-rounded{
justify-self: center !important;
}
}
&-scroll{
overflow-y: auto;
mask-image: linear-gradient(to top, transparent, black 15px calc(100% - 15px), transparent);
// Magic scrollbar
&::-webkit-scrollbar {
&-thumb {
height: 150px;
max-height: 33%;
}
&-track {
margin-top: 15px;
margin-bottom: 15px;
background: transparent !important;
}
}
}
// About page
&-grid{
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap:1em;
}
&-logo{
width: 100%;
background: rgb(255 255 255 / 1);
padding: 2em;
margin-bottom: 1em;
border-radius: $border-radius-default;
}
&-info{
display: grid;
grid-template-columns: 40% 1fr;
gap: 1em;
justify-items: start;
align-items: center;
&-container{
background: rgb(0 0 0 / 0.3);
border: 1px solid rgb(255 255 255 / 0.1);
padding: 1em;
border-radius: $border-radius-default;
display: flex;
flex-direction: column;
gap:0.4em;
width: 100%;
}
}
//settings
&-option{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 0 !important;
margin: 0 0 0.4em 0!important;
}
}
.Mui-selected .material-symbols-rounded{
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
}
+132
View File
@@ -0,0 +1,132 @@
import React from "react";
import { Divider, LinearProgress, Skeleton } from "@mui/material";
const ItemSkeleton = () => {
return (
<div
className="item item-default scrollY padded-top flex flex-column"
style={{
width: "100vw",
}}
>
<LinearProgress
sx={{
position: "fixed",
top: "0",
left: 0,
right: 0,
}}
/>
<div
className="item-hero flex flex-row"
style={{
height: "50vh",
}}
>
<div
className="item-hero-image-container"
style={{
aspectRatio: 0.6666,
boxShadow: "0 0 black",
}}
>
<Skeleton
variant="rounded"
style={{
height: "50vh",
}}
/>
</div>
<div
className="item-hero-detail flex flex-column"
style={
{
// width: "50vw",
}
}
>
<Skeleton variant="text" sx={{ fontSize: "4rem" }} width="50%" />
{/* </Typography> */}
<div
className="item-hero-buttons-container flex flex-row"
style={{
width: "70%",
gap: "1em",
justifyContent: "flex-start",
}}
>
<Skeleton
width="10rem"
height="3rem"
sx={{
fontSize: "3rem",
borderRadius: "3em",
transform: "scale(1)",
}}
/>
<div className="flex flex-row" style={{ gap: "1em" }}>
<Skeleton
width="3rem"
height="3rem"
sx={{
fontSize: "3rem",
borderRadius: "3em",
transform: "scale(1)",
aspectRatio: "1",
}}
/>
<Skeleton
width="3rem"
height="3rem"
sx={{
fontSize: "3rem",
borderRadius: "3em",
transform: "scale(1)",
aspectRatio: "1",
}}
/>
</div>
</div>
</div>
</div>
<div className="item-detail">
<div style={{ width: "100%" }}>
<Skeleton variant="text" />
<Skeleton variant="text" />
<Skeleton variant="text" />
</div>
<Divider flexItem orientation="vertical" />
<div
style={{
width: "100%",
}}
>
<Skeleton
variant="rounded"
sx={{
fontSize: "2.4rem",
mb: 1,
}}
/>
<Skeleton
variant="rounded"
sx={{
fontSize: "2.4rem",
mb: 1,
}}
/>
<Skeleton
variant="rounded"
sx={{
fontSize: "2.4rem",
}}
/>
</div>
</div>
</div>
);
};
export default ItemSkeleton;