diff --git a/src/App.jsx b/src/App.jsx
index fd53659..e604665 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -57,6 +57,7 @@ import { version as appVer } from "../package.json";
import { v4 as uuidv4 } from "uuid";
import { delServer, getServer } from "./utils/storage/servers.js";
import { getUser } from "./utils/storage/user.js";
+import { AppBar } from "./components/appBar/appBar.jsx";
const jellyfin = new Jellyfin({
clientInfo: {
@@ -306,6 +307,7 @@ function App() {
+
{
+ const visible = useSelector((state) => state.appBar.visible);
+ const backdropVisible = useSelector((state) => state.appBar.backdrop);
+
+ // console.log(backdropVisible);
+
+ // const trigger = useScrollTrigger({
+ // disableHysteresis: true,
+ // threshold: 0,
+ // // target: document.querySelector(".scrollY"),
+ // });
+
+ // console.log(trigger);
+
+ return (
+ visible && (
+
+
+
+
+
+
+
+ ),
+ }}
+ size="small"
+ />
+
+
+ )
+ );
+};
diff --git a/src/components/appBar/appBar.module.scss b/src/components/appBar/appBar.module.scss
new file mode 100644
index 0000000..cc2dfda
--- /dev/null
+++ b/src/components/appBar/appBar.module.scss
@@ -0,0 +1,5 @@
+/** @format */
+
+.appBar {
+ transition: background $transition-time-default;
+}
diff --git a/src/components/icons/mdiMagnify.jsx b/src/components/icons/mdiMagnify.jsx
new file mode 100644
index 0000000..cdd63f3
--- /dev/null
+++ b/src/components/icons/mdiMagnify.jsx
@@ -0,0 +1,12 @@
+/** @format */
+import SvgIcon from "@mui/material/SvgIcon";
+
+import { mdiMagnify } from "@mdi/js";
+
+export const MdiMagnify = (props) => {
+ return (
+
+
+
+ );
+};
diff --git a/src/components/menu/sidemenu.jsx b/src/components/menu/sidemenu.jsx
index db349d6..846934a 100644
--- a/src/components/menu/sidemenu.jsx
+++ b/src/components/menu/sidemenu.jsx
@@ -57,6 +57,7 @@ const MiniDrawer = styled(MuiDrawer, {
export const SideMenu = ({}) => {
const queryClient = useQueryClient();
+
const visible = useSelector((state) => state.sidebar.visible);
const navigate = useNavigate();
const user = useQuery({
diff --git a/src/routes/home/home.module.scss b/src/routes/home/home.module.scss
index d61c484..58a8fcc 100644
--- a/src/routes/home/home.module.scss
+++ b/src/routes/home/home.module.scss
@@ -106,3 +106,11 @@
border-radius: 0;
}
}
+
+.backdropContainer {
+ background: linear-gradient(
+ 45deg,
+ $clr-background-default,
+ $clr-background-light
+ );
+}
diff --git a/src/routes/home/root.jsx b/src/routes/home/root.jsx
index dccb929..5a09232 100644
--- a/src/routes/home/root.jsx
+++ b/src/routes/home/root.jsx
@@ -1,6 +1,6 @@
/** @format */
-import { useState, useEffect, useLayoutEffect } from "react";
+import { useState, useEffect, useRef } from "react";
import { Blurhash } from "react-blurhash";
@@ -20,6 +20,7 @@ import Paper from "@mui/material/Paper";
import Typography from "@mui/material/Typography";
import Chip from "@mui/material/Chip";
import Divider from "@mui/material/Divider";
+import useScrollTrigger from "@mui/material/useScrollTrigger";
import { yellow } from "@mui/material/colors";
@@ -40,6 +41,7 @@ import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
import { useDispatch, useSelector } from "react-redux";
import { showSidemenu } from "../../utils/slice/sidemenu";
+import { showAppBar, setBackdrop } from "../../utils/slice/appBar";
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
@@ -84,10 +86,10 @@ const Home = () => {
const libraries = useQuery({
queryKey: ["home", "libraries"],
queryFn: async () => {
+ dispatch(showSidemenu());
let libs = await getUserViewsApi(window.api).getUserViews({
userId: user.data.Id,
});
- dispatch(showSidemenu());
return libs.data;
},
enabled: !!user.data,
@@ -187,6 +189,24 @@ const Home = () => {
});
}
+ const appBarVisiblity = useSelector((state) => state.appBar.visible);
+
+ if (!appBarVisiblity) {
+ dispatch(showAppBar());
+ }
+
+ const [scrollTarget, setScrollTarget] = useState(undefined);
+
+ const trigger = useScrollTrigger({
+ disableHysteresis: true,
+ threshold: 0,
+ target: scrollTarget,
+ });
+
+ useEffect(() => {
+ dispatch(setBackdrop(trigger));
+ }, [trigger]);
+
return (
<>
{
{
+ if (node) {
+ setScrollTarget(node);
+ }
+ }}
>
{
/>
);
})}
+
diff --git a/src/store.js b/src/store.js
index fd31d01..0854c89 100644
--- a/src/store.js
+++ b/src/store.js
@@ -2,9 +2,10 @@
import { configureStore } from "@reduxjs/toolkit";
import sideBarReducer from "./utils/slice/sidemenu";
-
+import appBarReducer from "./utils/slice/appBar";
export default configureStore({
reducer: {
sidebar: sideBarReducer,
+ appBar: appBarReducer,
},
});
diff --git a/src/utils/slice/appBar.js b/src/utils/slice/appBar.js
new file mode 100644
index 0000000..fdc8435
--- /dev/null
+++ b/src/utils/slice/appBar.js
@@ -0,0 +1,24 @@
+/** @format */
+
+import { createSlice } from "@reduxjs/toolkit";
+export const appBarSlice = createSlice({
+ name: "appBar",
+ initialState: {
+ visible: false,
+ backdrop: false,
+ },
+ reducers: {
+ showAppBar: (state) => {
+ state.visible = true;
+ },
+ hideAppBar: (state) => {
+ state.visible = false;
+ },
+ setBackdrop: (state, action) => {
+ state.backdrop = action.payload;
+ },
+ },
+});
+
+export const { showAppBar, hideAppBar, setBackdrop } = appBarSlice.actions;
+export default appBarSlice.reducer;
diff --git a/src/utils/slice/sidemenu.js b/src/utils/slice/sidemenu.js
index 9d54d02..abde53f 100644
--- a/src/utils/slice/sidemenu.js
+++ b/src/utils/slice/sidemenu.js
@@ -11,7 +11,7 @@ export const sideBarSlice = createSlice({
state.visible = true;
},
hideSidemenu: (state) => {
- state.visible - false;
+ state.visible = false;
},
},
});