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

+8 -13
View File
@@ -5,6 +5,7 @@ import { AnimatePresence, motion } from "framer-motion";
import { SnackbarProvider } from "notistack";
import {
Navigate,
Outlet,
Route,
Routes,
useLocation,
@@ -60,7 +61,6 @@ import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
import PlaylistTitlePage from "./routes/playlist/index.jsx";
import SearchPage from "./routes/search";
import SeriesTitlePage from "./routes/series/index.jsx";
import Settings from "./routes/settings";
import { ServerSetup } from "./routes/setup/server";
import ServerList from "./routes/setup/serverList/index.jsx";
@@ -108,6 +108,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { useSnackbar } from "notistack";
import { ErrorBoundary } from "react-error-boundary";
import Settings from "./components/settings";
import { EasterEgg } from "./components/utils/easterEgg.jsx";
import { handleRelaunch } from "./utils/misc/relaunch";
import {
@@ -240,10 +241,6 @@ function AppReady() {
undefined,
);
useEffect(() => {
window.scrollTo(0, 0);
}, [location.key]);
useLayoutEffect(() => {
async function checkForUpdates() {
try {
@@ -280,6 +277,8 @@ function AppReady() {
return (
<SnackbarProvider maxSnack={5}>
<ThemeProvider theme={theme}>
<CssBaseline />
{playbackDataLoading && (
<LinearProgress
sx={{
@@ -392,6 +391,8 @@ function AppReady() {
</>
)}
</Dialog>
<Settings />
<EasterEgg />
{/* Show Dialog if server not reachable */}
@@ -437,16 +438,11 @@ function AppReady() {
transition: "padding 250ms",
}}
>
<CssBaseline />
{/* <SideMenu /> */}
<AppBar />
{audioPlayerVisible && <AudioPlayer />}
<ErrorBoundary FallbackComponent={ErrorNotice} key={location.key}>
<Routes location={location}>
{/* <Route
// key={location.key}
element={<AnimationWrapper />}
> */}
<Route path="/" element={<Navigate to={initialRoute} />} />
<Route
path="/error"
@@ -503,14 +499,13 @@ function AppReady() {
<Route path="/series/:id" element={<SeriesTitlePage />} />
<Route path="/search" element={<SearchPage />} />
<Route path="/favorite" element={<FavoritePage />} />
<Route path="/settings" element={<Settings />} />
<Route path="/about" element={<About />} />
<Route path="/player" element={<VideoPlayer />} />
{/* </Route> */}
</Routes>
</ErrorBoundary>
</div>
<ReactQueryDevtools buttonPosition="top-left" />
<ReactQueryDevtools buttonPosition="bottom-right" />
</ThemeProvider>
</SnackbarProvider>
);
+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;
+2 -2
View File
@@ -157,8 +157,8 @@ $border-radius: 20px;
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+15 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useEffect, useLayoutEffect } from "react";
import React, { useEffect, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
@@ -11,7 +11,8 @@ import Typography from "@mui/material/Typography";
import { Link, NavLink, useParams } from "react-router-dom";
import { motion } from "framer-motion";
import { motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import {
BaseItemKind,
@@ -170,6 +171,13 @@ const MusicAlbumTitlePage = () => {
}
}, [item.isSuccess]);
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending || similarItems.isPending) {
return (
<Box
@@ -200,11 +208,12 @@ const MusicAlbumTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY padded-top item item-album"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(
item.data.ParentBackdropItemId,
@@ -217,6 +226,9 @@ const MusicAlbumTitlePage = () => {
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
) : (
<></>
+2 -2
View File
@@ -49,8 +49,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+15 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useEffect, useLayoutEffect } from "react";
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
@@ -8,7 +8,8 @@ import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
import Typography from "@mui/material/Typography";
import { AnimatePresence, motion } from "framer-motion";
import { AnimatePresence, motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import { Link, useParams } from "react-router-dom";
@@ -176,6 +177,13 @@ const ArtistTitlePage = () => {
}
}, [item.isSuccess]);
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending) {
return (
<Box
@@ -206,10 +214,11 @@ const ArtistTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY item item-artist"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
<img
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
@@ -218,6 +227,9 @@ const ArtistTitlePage = () => {
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
</div>
<div
+2 -2
View File
@@ -49,8 +49,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+15 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useEffect, useLayoutEffect } from "react";
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
@@ -9,7 +9,8 @@ import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { Link, useNavigate, useParams } from "react-router-dom";
import { motion } from "framer-motion";
import { motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import {
BaseItemKind,
@@ -128,6 +129,13 @@ const BoxSetTitlePage = () => {
}
}, [item.isSuccess]);
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending || similarItems.isPending) {
return (
<Box
@@ -158,17 +166,21 @@ const BoxSetTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY item item-boxset padded-top"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
<motion.img
alt={item.data.Name}
src={meshBg}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
) : (
<></>
+2 -2
View File
@@ -52,8 +52,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+18 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useLayoutEffect } from "react";
import React, { useState, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
@@ -16,7 +16,8 @@ import { Blurhash } from "react-blurhash";
import { Link, NavLink, useParams } from "react-router-dom";
import { motion } from "framer-motion";
import { motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import {
BaseItemKind,
@@ -219,6 +220,9 @@ const EpisodeTitlePage = () => {
) {
return "Dolby Digital+";
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("dd")) {
return "Dolby Digital";
}
return "";
};
@@ -233,6 +237,13 @@ const EpisodeTitlePage = () => {
return "2.0";
};
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending) {
return (
<Box
@@ -263,11 +274,12 @@ const EpisodeTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY padded-top flex flex-column item item-episode"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(
item.data.ParentBackdropItemId,
@@ -280,6 +292,9 @@ const EpisodeTitlePage = () => {
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
) : (
<></>
+1 -1
View File
@@ -421,4 +421,4 @@ const Home = () => {
);
};
export default Home;
export default React.memo(Home);
+33 -14
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useLayoutEffect } from "react";
import React, { useState, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
@@ -16,7 +16,8 @@ import { Blurhash } from "react-blurhash";
import { Link, NavLink, useParams } from "react-router-dom";
import { motion } from "framer-motion";
import { motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import {
BaseItemKind,
@@ -47,6 +48,8 @@ import { endsAt, getRuntime } from "../../utils/date/time";
import { useApi } from "../../utils/store/api";
import { useBackdropStore } from "../../utils/store/backdrop";
import ItemSkeleton from "../../components/skeleton/item";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -245,6 +248,9 @@ const ItemDetail = () => {
) {
return "Dolby Digital+";
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("dd")) {
return "Dolby Digital";
}
return "";
};
@@ -258,19 +264,28 @@ const ItemDetail = () => {
return "2.0";
};
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
layoutEffect: false,
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending || similarItems.isPending) {
return (
<Box
sx={{
width: "100%",
height: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<CircularProgress />
</Box>
// <Box
// sx={{
// width: "100%",
// height: "100vh",
// display: "flex",
// alignItems: "center",
// justifyContent: "center",
// }}
// >
// <CircularProgress />
// </Box>
<ItemSkeleton />
);
}
@@ -289,11 +304,12 @@ const ItemDetail = () => {
ease: "easeInOut",
}}
className="scrollY padded-top flex flex-column item item-default"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
@@ -302,6 +318,9 @@ const ItemDetail = () => {
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
) : (
<></>
+2 -2
View File
@@ -49,8 +49,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+21 -4
View File
@@ -33,7 +33,7 @@ import { useSnackbar } from "notistack";
import { AppBarBackOnly } from "../../components/appBar/backOnly.jsx";
import { AvatarImage } from "../../components/avatar/avatar.jsx";
import { Card } from "../../components/card/card.jsx";
import { Card } from "../../components/card/card";
import { getBrandingApi } from "@jellyfin/sdk/lib/utils/api/branding-api";
import { getQuickConnectApi } from "@jellyfin/sdk/lib/utils/api/quick-connect-api";
@@ -117,7 +117,14 @@ export const LoginWithImage = () => {
);
return auth;
} catch (error) {
enqueueSnackbar("Incorrect Password!", { variant: "error" });
if (error.response.status === 500) {
enqueueSnackbar(
"Unable to connect to server. Please try again after some time.",
{ variant: "error" },
);
} else {
enqueueSnackbar("Incorrect Password.", { variant: "error" });
}
setLoading(false);
console.error(error);
}
@@ -175,12 +182,22 @@ export const LoginWithImage = () => {
elevation={2}
>
<Typography
textAlign="left"
textAlign="center"
variant="h5"
sx={{ opacity: 0.8 }}
mb={2}
>
Login as {userName}:
Login as{" "}
<Typography
variant="h5"
style={{
display: "inline",
}}
fontWeight={700}
className="gradient-text"
>
{userName}
</Typography>
</Typography>
<FormGroup
sx={{
+15 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useEffect, useLayoutEffect } from "react";
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
@@ -8,7 +8,8 @@ import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
import Typography from "@mui/material/Typography";
import { AnimatePresence, motion } from "framer-motion";
import { AnimatePresence, motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import { Link, useParams } from "react-router-dom";
@@ -242,6 +243,13 @@ const PersonTitlePage = () => {
const [animationDirection, setAnimationDirection] = useState("forward");
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending) {
return (
<Box
@@ -273,16 +281,20 @@ const PersonTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY padded-top item item-person flex flex-column"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
<img
<motion.img
alt={item.data.Name}
src={meshBg}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
</div>
<div
+2 -2
View File
@@ -71,8 +71,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
+15 -3
View File
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useEffect, useLayoutEffect } from "react";
import React, { useState, useEffect, useLayoutEffect, useRef } from "react";
import Box from "@mui/material/Box";
import MuiCard from "@mui/material/Card";
@@ -16,7 +16,8 @@ import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import { green, red, yellow } from "@mui/material/colors";
import { motion } from "framer-motion";
import { motion, useScroll } from "framer-motion";
import useParallax from "../../utils/hooks/useParallax";
import { useParams } from "react-router-dom";
@@ -240,6 +241,13 @@ const SeriesTitlePage = () => {
}
}, [seasons.isSuccess]);
const pageRef = useRef(null);
const { scrollYProgress } = useScroll({
target: pageRef,
offset: ["start start", "60vh start"],
});
const parallax = useParallax(scrollYProgress, 50);
if (item.isPending || similarItems.isPending) {
return (
<Box
@@ -271,11 +279,12 @@ const SeriesTitlePage = () => {
ease: "easeInOut",
}}
className="scrollY padded-top flex flex-column item item-series"
ref={pageRef}
>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
@@ -284,6 +293,9 @@ const SeriesTitlePage = () => {
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
) : (
<></>
+2 -2
View File
@@ -50,8 +50,8 @@
}
}
&-backdrop {
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
object-fit: cover;
object-position: top;
opacity: 0;
-5
View File
@@ -1,5 +0,0 @@
const Settings = () => {
return <h1>WIP Settings</h1>;
};
export default Settings;
+7
View File
@@ -231,3 +231,10 @@ h1 {
opacity: 0.1;
}
}
.gradient-text{
background: $clr-gradient-default;
color: transparent;
-webkit-background-clip: text;
background-clip: text;
}
+8
View File
@@ -0,0 +1,8 @@
import { MotionValue, useTransform } from "framer-motion";
export default function useParallax(
value: MotionValue<number>,
distance: number,
) {
return useTransform(value, [0, 1], [-distance, distance]);
}
+16
View File
@@ -0,0 +1,16 @@
import { matchPath, useLocation } from "react-router-dom";
function useRouteMatch(patterns: readonly string[]) {
const { pathname } = useLocation();
for (let i = 0; i < patterns.length; i += 1) {
const pattern = patterns[i];
const possibleMatch = matchPath(pattern, pathname);
if (possibleMatch !== null) {
return possibleMatch;
}
}
return null;
}
export default useRouteMatch;
+19
View File
@@ -0,0 +1,19 @@
import { create } from "zustand";
const useSettingsStore = create(() => ({
dialogOpen: false,
tabValue: 0,
}));
const setDialogOpen = (dialog: boolean) =>
useSettingsStore.setState((state) => ({ ...state, dialogOpen: dialog }));
const setTabValue = (value: number) => {
useSettingsStore.setState((state) => ({ ...state, tabValue: value }));
};
export default useSettingsStore;
export {
setDialogOpen as setSettingsDialogOpen,
setTabValue as setSettingsTabValue,
};