Add sidemenu highlighter animations
This commit is contained in:
8 files changed
+132
-72
No files matched your search
Generated
+16
@@ -31,6 +31,7 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.2",
|
"react-multi-carousel": "^2.8.2",
|
||||||
|
"react-parallax": "^3.5.1",
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"react-router-dom": "^6.9.0",
|
"react-router-dom": "^6.9.0",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1",
|
||||||
@@ -2892,6 +2893,15 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-parallax": {
|
||||||
|
"version": "3.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-parallax/-/react-parallax-3.5.1.tgz",
|
||||||
|
"integrity": "sha512-p5zPsPsqELlIOGaPS01O0IRx8R2bxcBAtrdF/RHf9nIxxk5hijbM2y89tk4rJQBcNH6ESSLe7J2NV4/ms7FLFw==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "16.x.x || 17.x.x || 18.x.x",
|
||||||
|
"react-dom": "16.x.x || 17.x.x || 18.x.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-redux": {
|
"node_modules/react-redux": {
|
||||||
"version": "8.0.5",
|
"version": "8.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
|
||||||
@@ -5098,6 +5108,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-multi-carousel/-/react-multi-carousel-2.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-multi-carousel/-/react-multi-carousel-2.8.2.tgz",
|
||||||
"integrity": "sha512-M9Y7DfAp8bA/r6yexttU6RLA7uyppje4c0ELRuCHZWswH+u7nr0uVP6qHNPjc4XGOEY1MYFOb5nBg7JvoKutuQ=="
|
"integrity": "sha512-M9Y7DfAp8bA/r6yexttU6RLA7uyppje4c0ELRuCHZWswH+u7nr0uVP6qHNPjc4XGOEY1MYFOb5nBg7JvoKutuQ=="
|
||||||
},
|
},
|
||||||
|
"react-parallax": {
|
||||||
|
"version": "3.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-parallax/-/react-parallax-3.5.1.tgz",
|
||||||
|
"integrity": "sha512-p5zPsPsqELlIOGaPS01O0IRx8R2bxcBAtrdF/RHf9nIxxk5hijbM2y89tk4rJQBcNH6ESSLe7J2NV4/ms7FLFw==",
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
"react-redux": {
|
"react-redux": {
|
||||||
"version": "8.0.5",
|
"version": "8.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.2",
|
"react-multi-carousel": "^2.8.2",
|
||||||
|
"react-parallax": "^3.5.1",
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"react-router-dom": "^6.9.0",
|
"react-router-dom": "^6.9.0",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1",
|
||||||
|
|||||||
+67
-49
@@ -1,6 +1,6 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import { useState, useMemo } from "react";
|
import React, { useState, Suspense } from "react";
|
||||||
import { ThemeProvider } from "@mui/material/styles";
|
import { ThemeProvider } from "@mui/material/styles";
|
||||||
import { SnackbarProvider } from "notistack";
|
import { SnackbarProvider } from "notistack";
|
||||||
import { useCookies, Cookies } from "react-cookie";
|
import { useCookies, Cookies } from "react-cookie";
|
||||||
@@ -40,7 +40,7 @@ import CircularProgress from "@mui/material/CircularProgress";
|
|||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
import { ServerSetup, ServerList } from "./routes/setup/server/root";
|
||||||
import { Home } from "./routes/home/root";
|
import Home from "./routes/home/root";
|
||||||
import {
|
import {
|
||||||
UserLogin,
|
UserLogin,
|
||||||
LoginWithImage,
|
LoginWithImage,
|
||||||
@@ -292,56 +292,74 @@ function App() {
|
|||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex" }}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<SideMenu />
|
<SideMenu />
|
||||||
<Routes
|
<Suspense
|
||||||
key={location.pathname}
|
fallback={
|
||||||
location={location}
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
width: "100%",
|
||||||
|
height: "100vh",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircularProgress />
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Route element={<AnimationWrapper />}>
|
<Routes
|
||||||
{/* Main Routes */}
|
key={location.pathname}
|
||||||
<Route
|
location={location}
|
||||||
path="/home"
|
>
|
||||||
element={<Home />}
|
<Route element={<AnimationWrapper />}>
|
||||||
/>
|
{/* Main Routes */}
|
||||||
<Route
|
<Route
|
||||||
path="/setup/server"
|
path="/home"
|
||||||
element={<ServerSetup />}
|
element={<Home />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/servers/list"
|
path="/setup/server"
|
||||||
element={<ServerList />}
|
element={<ServerSetup />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
path="/servers/list"
|
||||||
path="/login/withImg/:userName/:userId/"
|
element={<ServerList />}
|
||||||
element={<LoginWithImage />}
|
/>
|
||||||
/>
|
<Route
|
||||||
<Route
|
exact
|
||||||
exact
|
path="/login/withImg/:userName/:userId/"
|
||||||
path="/login/users"
|
element={<LoginWithImage />}
|
||||||
element={<UserLogin />}
|
/>
|
||||||
/>
|
<Route
|
||||||
<Route
|
exact
|
||||||
path="/login/manual"
|
path="/login/users"
|
||||||
element={<UserLoginManual />}
|
element={<UserLogin />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/library/:id"
|
path="/login/manual"
|
||||||
element={<></>}
|
element={<UserLoginManual />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/library/:id"
|
||||||
|
element={<></>}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Logical Routes */}
|
{/* Logical Routes */}
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="/"
|
path="/"
|
||||||
element={<LogicalRoutes />}
|
element={<LogicalRoutes />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="/login"
|
path="/login"
|
||||||
element={<LoginLogicalRoutes />}
|
element={
|
||||||
/>
|
<LoginLogicalRoutes />
|
||||||
</Route>
|
}
|
||||||
</Routes>
|
/>
|
||||||
|
</Route>
|
||||||
|
</Routes>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<ReactQueryDevtools />
|
<ReactQueryDevtools />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
import PropTypes from "prop-types";
|
import { delUser } from "../../utils/storage/user";
|
||||||
|
|
||||||
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
|
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
|
||||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||||
@@ -62,13 +62,15 @@ export const SideMenu = ({}) => {
|
|||||||
let libs = await getLibraryApi(window.api).getMediaFolders();
|
let libs = await getLibraryApi(window.api).getMediaFolders();
|
||||||
return libs.data;
|
return libs.data;
|
||||||
},
|
},
|
||||||
|
enabled: visible,
|
||||||
});
|
});
|
||||||
const handleDrawerOpen = () => {};
|
const handleDrawerOpen = () => {};
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
|
console.log("Logging out user...");
|
||||||
await window.api.logout();
|
await window.api.logout();
|
||||||
|
delUser();
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
console.log("logged out user");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -133,7 +135,7 @@ export const SideMenu = ({}) => {
|
|||||||
key={index}
|
key={index}
|
||||||
>
|
>
|
||||||
<ListItem
|
<ListItem
|
||||||
className="sidemenu-item"
|
className="sidemenu-item-container"
|
||||||
disablePadding
|
disablePadding
|
||||||
>
|
>
|
||||||
<NavLink
|
<NavLink
|
||||||
@@ -146,10 +148,10 @@ export const SideMenu = ({}) => {
|
|||||||
isPending,
|
isPending,
|
||||||
}) =>
|
}) =>
|
||||||
isPending
|
isPending
|
||||||
? "sidemenu-item-pending"
|
? "sidemenu-item-pending sidemenu-item"
|
||||||
: isActive
|
: isActive
|
||||||
? "sidemenu-item-active"
|
? "sidemenu-item-active sidemenu-item"
|
||||||
: ""
|
: "sidemenu-item"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
@@ -159,6 +161,7 @@ export const SideMenu = ({}) => {
|
|||||||
"center",
|
"center",
|
||||||
px: 2.5,
|
px: 2.5,
|
||||||
}}
|
}}
|
||||||
|
color="white"
|
||||||
>
|
>
|
||||||
<ListItemIcon
|
<ListItemIcon
|
||||||
sx={{
|
sx={{
|
||||||
@@ -189,7 +192,7 @@ export const SideMenu = ({}) => {
|
|||||||
arrow
|
arrow
|
||||||
>
|
>
|
||||||
<ListItem
|
<ListItem
|
||||||
className="sidemenu-item"
|
className="sidemenu-item-container"
|
||||||
disablePadding
|
disablePadding
|
||||||
>
|
>
|
||||||
<NavLink
|
<NavLink
|
||||||
@@ -199,10 +202,10 @@ export const SideMenu = ({}) => {
|
|||||||
isPending,
|
isPending,
|
||||||
}) =>
|
}) =>
|
||||||
isPending
|
isPending
|
||||||
? "sidemenu-item-pending"
|
? "sidemenu-item-pending sidemenu-item"
|
||||||
: isActive
|
: isActive
|
||||||
? "sidemenu-item-active"
|
? "sidemenu-item-active sidemenu-item"
|
||||||
: ""
|
: "sidemenu-item"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
.sidemenu {
|
.sidemenu {
|
||||||
&-item {
|
&-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
&-active::before {
|
&::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 15%;
|
top: 15%;
|
||||||
@@ -16,6 +16,14 @@
|
|||||||
$clr-accent-default,
|
$clr-accent-default,
|
||||||
$clr-secondary-default
|
$clr-secondary-default
|
||||||
);
|
);
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-10px);
|
||||||
|
transition: transform $transition-time-default,
|
||||||
|
opacity $transition-time-default;
|
||||||
|
}
|
||||||
|
&-active::before {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import { useQueryClient, useQuery } from "@tanstack/react-query";
|
|||||||
|
|
||||||
import { EventEmitter as event } from "../../eventEmitter";
|
import { EventEmitter as event } from "../../eventEmitter";
|
||||||
import { getServer } from "../../utils/storage/servers";
|
import { getServer } from "../../utils/storage/servers";
|
||||||
import { getUser } from "../../utils/storage/user";
|
import { getUser, delUser } from "../../utils/storage/user";
|
||||||
|
|
||||||
import { theme } from "../../theme";
|
import { theme } from "../../theme";
|
||||||
import "./home.module.scss";
|
import "./home.module.scss";
|
||||||
@@ -49,7 +49,7 @@ import { formateDate } from "../../utils/date/formateDate";
|
|||||||
import { getRuntime } from "../../utils/date/time";
|
import { getRuntime } from "../../utils/date/time";
|
||||||
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
import { CarouselSkeleton } from "../../components/skeleton/carousel";
|
||||||
|
|
||||||
export const Home = () => {
|
const Home = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const authUser = useQuery({
|
const authUser = useQuery({
|
||||||
@@ -58,7 +58,7 @@ export const Home = () => {
|
|||||||
const server = await getServer();
|
const server = await getServer();
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
event.emit("create-jellyfin-api", server.Ip);
|
event.emit("create-jellyfin-api", server.Ip);
|
||||||
const auth = await api.authenticateUserByName(
|
const auth = await window.api.authenticateUserByName(
|
||||||
user.Name,
|
user.Name,
|
||||||
user.Password,
|
user.Password,
|
||||||
);
|
);
|
||||||
@@ -228,9 +228,10 @@ export const Home = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
|
console.log("Logging out user...");
|
||||||
await window.api.logout();
|
await window.api.logout();
|
||||||
|
delUser();
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
console.log("logged out user");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -311,7 +312,7 @@ export const Home = () => {
|
|||||||
{item.ImageBlurHashes
|
{item.ImageBlurHashes
|
||||||
.Backdrop ? (
|
.Backdrop ? (
|
||||||
<>
|
<>
|
||||||
<BlurhashCanvas
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
item
|
item
|
||||||
.ImageBlurHashes
|
.ImageBlurHashes
|
||||||
@@ -361,7 +362,9 @@ export const Home = () => {
|
|||||||
<Typography
|
<Typography
|
||||||
variant="h3"
|
variant="h3"
|
||||||
className="hero-carousel-text"
|
className="hero-carousel-text"
|
||||||
sx={{ mb: 2.5 }}
|
sx={{
|
||||||
|
mb: 2.5,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{!item.ImageTags
|
{!item.ImageTags
|
||||||
.Logo ? (
|
.Logo ? (
|
||||||
@@ -511,7 +514,9 @@ export const Home = () => {
|
|||||||
)}
|
)}
|
||||||
</Carousel>
|
</Carousel>
|
||||||
<CardScroller displayCards={4} title={"Libraries"}>
|
<CardScroller displayCards={4} title={"Libraries"}>
|
||||||
{libraries.isLoading == false &&
|
{libraries.isLoading ? (
|
||||||
|
<>"loading...</>
|
||||||
|
) : (
|
||||||
libraries.data.Items.map((item, index) => {
|
libraries.data.Items.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<CardLandscape
|
<CardLandscape
|
||||||
@@ -525,7 +530,8 @@ export const Home = () => {
|
|||||||
iconType={item.CollectionType}
|
iconType={item.CollectionType}
|
||||||
></CardLandscape>
|
></CardLandscape>
|
||||||
);
|
);
|
||||||
})}
|
})
|
||||||
|
)}
|
||||||
</CardScroller>
|
</CardScroller>
|
||||||
|
|
||||||
{/* <Box className="home-section">
|
{/* <Box className="home-section">
|
||||||
@@ -628,3 +634,5 @@ export const Home = () => {
|
|||||||
})}
|
})}
|
||||||
</List>
|
</List>
|
||||||
</MuiDrawer> */
|
</MuiDrawer> */
|
||||||
|
|
||||||
|
export default Home;
|
||||||
@@ -66,7 +66,7 @@ export const LoginWithImage = () => {
|
|||||||
|
|
||||||
const authUser = async () => {
|
const authUser = async () => {
|
||||||
try {
|
try {
|
||||||
const auth = await api.authenticateUserByName(
|
const auth = await window.api.authenticateUserByName(
|
||||||
userName,
|
userName,
|
||||||
password.password,
|
password.password,
|
||||||
);
|
);
|
||||||
@@ -331,7 +331,7 @@ export const UserLoginManual = () => {
|
|||||||
|
|
||||||
const authUser = async () => {
|
const authUser = async () => {
|
||||||
try {
|
try {
|
||||||
const auth = await api.authenticateUserByName(
|
const auth = await window.api.authenticateUserByName(
|
||||||
userName,
|
userName,
|
||||||
password.password,
|
password.password,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const saveUser = async (userName, userPassword) => {
|
|||||||
Name: userName,
|
Name: userName,
|
||||||
Password: userPassword || "",
|
Password: userPassword || "",
|
||||||
});
|
});
|
||||||
await servers.save();
|
await user.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,4 +26,10 @@ const getUser = async () => {
|
|||||||
return details;
|
return details;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { saveUser, getUser };
|
/**
|
||||||
|
* Delete user from storage
|
||||||
|
*/
|
||||||
|
const delUser = async () => {
|
||||||
|
await user.clear();
|
||||||
|
};
|
||||||
|
export { saveUser, getUser, delUser };
|
||||||
Reference in new issue
Block a user