diff --git a/package-lock.json b/package-lock.json
index 1b54f65..efb2a47 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -31,6 +31,7 @@
"react-dom": "^18.2.0",
"react-material-ui-carousel": "^3.4.2",
"react-multi-carousel": "^2.8.2",
+ "react-parallax": "^3.5.1",
"react-redux": "^8.0.5",
"react-router-dom": "^6.9.0",
"redux": "^4.2.1",
@@ -2892,6 +2893,15 @@
"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": {
"version": "8.0.5",
"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",
"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": {
"version": "8.0.5",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz",
diff --git a/package.json b/package.json
index 8711bea..9225cec 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"react-dom": "^18.2.0",
"react-material-ui-carousel": "^3.4.2",
"react-multi-carousel": "^2.8.2",
+ "react-parallax": "^3.5.1",
"react-redux": "^8.0.5",
"react-router-dom": "^6.9.0",
"redux": "^4.2.1",
diff --git a/src/App.jsx b/src/App.jsx
index 62cf427..f148345 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,6 +1,6 @@
/** @format */
-import { useState, useMemo } from "react";
+import React, { useState, Suspense } from "react";
import { ThemeProvider } from "@mui/material/styles";
import { SnackbarProvider } from "notistack";
import { useCookies, Cookies } from "react-cookie";
@@ -40,7 +40,7 @@ import CircularProgress from "@mui/material/CircularProgress";
// Routes
import { ServerSetup, ServerList } from "./routes/setup/server/root";
-import { Home } from "./routes/home/root";
+import Home from "./routes/home/root";
import {
UserLogin,
LoginWithImage,
@@ -292,56 +292,74 @@ function App() {
-
+
+
+ }
>
- }>
- {/* Main Routes */}
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- >}
- />
+
+ }>
+ {/* Main Routes */}
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ >}
+ />
- {/* Logical Routes */}
+ {/* Logical Routes */}
- }
- />
- }
- />
-
-
+ }
+ />
+
+ }
+ />
+
+
+
diff --git a/src/components/menu/sidemenu.jsx b/src/components/menu/sidemenu.jsx
index a521e1b..56d8d79 100644
--- a/src/components/menu/sidemenu.jsx
+++ b/src/components/menu/sidemenu.jsx
@@ -1,5 +1,5 @@
/** @format */
-import PropTypes from "prop-types";
+import { delUser } from "../../utils/storage/user";
import { useQueryClient, useQuery, QueryClient } from "@tanstack/react-query";
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
@@ -62,13 +62,15 @@ export const SideMenu = ({}) => {
let libs = await getLibraryApi(window.api).getMediaFolders();
return libs.data;
},
+ enabled: visible,
});
const handleDrawerOpen = () => {};
const handleLogout = async () => {
+ console.log("Logging out user...");
await window.api.logout();
+ delUser();
navigate("/login");
- console.log("logged out user");
};
return (
@@ -133,7 +135,7 @@ export const SideMenu = ({}) => {
key={index}
>
{
isPending,
}) =>
isPending
- ? "sidemenu-item-pending"
+ ? "sidemenu-item-pending sidemenu-item"
: isActive
- ? "sidemenu-item-active"
- : ""
+ ? "sidemenu-item-active sidemenu-item"
+ : "sidemenu-item"
}
>
{
"center",
px: 2.5,
}}
+ color="white"
>
{
arrow
>
{
isPending,
}) =>
isPending
- ? "sidemenu-item-pending"
+ ? "sidemenu-item-pending sidemenu-item"
: isActive
- ? "sidemenu-item-active"
- : ""
+ ? "sidemenu-item-active sidemenu-item"
+ : "sidemenu-item"
}
>
{
+const Home = () => {
const queryClient = useQueryClient();
const authUser = useQuery({
@@ -58,7 +58,7 @@ export const Home = () => {
const server = await getServer();
const user = await getUser();
event.emit("create-jellyfin-api", server.Ip);
- const auth = await api.authenticateUserByName(
+ const auth = await window.api.authenticateUserByName(
user.Name,
user.Password,
);
@@ -228,9 +228,10 @@ export const Home = () => {
};
const handleLogout = async () => {
+ console.log("Logging out user...");
await window.api.logout();
+ delUser();
navigate("/login");
- console.log("logged out user");
};
useEffect(() => {
@@ -311,7 +312,7 @@ export const Home = () => {
{item.ImageBlurHashes
.Backdrop ? (
<>
- {
{!item.ImageTags
.Logo ? (
@@ -511,7 +514,9 @@ export const Home = () => {
)}
- {libraries.isLoading == false &&
+ {libraries.isLoading ? (
+ <>"loading...>
+ ) : (
libraries.data.Items.map((item, index) => {
return (
{
iconType={item.CollectionType}
>
);
- })}
+ })
+ )}
{/*
@@ -628,3 +634,5 @@ export const Home = () => {
})}
*/
+
+export default Home;
diff --git a/src/routes/login/root.jsx b/src/routes/login/root.jsx
index 31cb84e..b9b4e75 100644
--- a/src/routes/login/root.jsx
+++ b/src/routes/login/root.jsx
@@ -66,7 +66,7 @@ export const LoginWithImage = () => {
const authUser = async () => {
try {
- const auth = await api.authenticateUserByName(
+ const auth = await window.api.authenticateUserByName(
userName,
password.password,
);
@@ -331,7 +331,7 @@ export const UserLoginManual = () => {
const authUser = async () => {
try {
- const auth = await api.authenticateUserByName(
+ const auth = await window.api.authenticateUserByName(
userName,
password.password,
);
diff --git a/src/utils/storage/user.js b/src/utils/storage/user.js
index 3b7d9d4..3213796 100644
--- a/src/utils/storage/user.js
+++ b/src/utils/storage/user.js
@@ -14,7 +14,7 @@ const saveUser = async (userName, userPassword) => {
Name: userName,
Password: userPassword || "",
});
- await servers.save();
+ await user.save();
};
/**
@@ -26,4 +26,10 @@ const getUser = async () => {
return details;
};
-export { saveUser, getUser };
+/**
+ * Delete user from storage
+ */
+const delUser = async () => {
+ await user.clear();
+};
+export { saveUser, getUser, delUser };