diff --git a/src/components/appBar/appBar.jsx b/src/components/appBar/appBar.jsx index 4a5454c..710d621 100644 --- a/src/components/appBar/appBar.jsx +++ b/src/components/appBar/appBar.jsx @@ -7,14 +7,14 @@ import IconButton from "@mui/material/IconButton"; import Toolbar from "@mui/material/Toolbar"; import Avatar from "@mui/material/Avatar"; import Box from "@mui/material/Box"; -import Typography from "@mui/material/Typography"; +import Zoom from "@mui/material/Zoom"; import { MdiMagnify } from "../icons/mdiMagnify"; import { theme } from "../../theme"; import { useDispatch, useSelector } from "react-redux"; import { useLocation, useNavigate } from "react-router-dom"; -import { removePage } from "../../utils/slice/appBar"; +import { hideBackButton } from "../../utils/slice/appBar"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { useQueryClient, useQuery } from "@tanstack/react-query"; @@ -29,7 +29,9 @@ export const AppBar = () => { const navigate = useNavigate(); const visible = useSelector((state) => state.appBar.visible); - const page = useSelector((state) => state.appBar.page); + const backButtonVisible = useSelector( + (state) => state.appBar.backButtonVisible, + ); const backdropVisible = useSelector((state) => state.appBar.backdrop); const location = useLocation(); @@ -44,7 +46,7 @@ export const AppBar = () => { useEffect(() => { if (location.pathname == "/home") { - dispatch(removePage()); + dispatch(hideBackButton()); } }); @@ -52,8 +54,8 @@ export const AppBar = () => { visible && ( { alignItems: "center", }} > - {page != undefined && ( - <> - navigate(-1)} - > - - - - {page} - - - )} + navigate(-1)} + sx={{ + transition: "transform 0.2s", + transform: backButtonVisible + ? "scale(1)" + : "scale(0)", + transformOrigin: "left", + }} + > + + { if (currentLib.isSuccess) { // console.log(currentLib.data.) - dispatch(setPage(currentLib.data.Items[0].Name)); + dispatch(showBackButton()); } const items = useQuery({ @@ -79,12 +86,12 @@ const LibraryView = () => { }); useEffect(() => { - dispatch(setBackdrop(trigger)); + dispatch(setBackdrop(true)); }, [trigger]); - if (currentLib.isLoading || items.isLoading) { - return

Loading...

; - } + // if (currentLib.isLoading || items.isLoading) { + // return

Loading...

; + // } return ( { className="scrollY" sx={{ flexGrow: 1, - pt: 11, + pt: 19, px: 3, pb: 3, position: "relative", @@ -108,6 +115,34 @@ const LibraryView = () => { } }} > + + + + + {currentLib.isLoading ? ( + + ) : ( + currentLib.data.Items[0].Name + )} + + + ) : ( + items.data.TotalRecordCount + ) + } + /> + + {items.isSuccess && items.data.Items.map((item, index) => { diff --git a/src/styles/global.scss b/src/styles/global.scss index ea5e6d1..879193a 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -1,15 +1,18 @@ /** @format */ ::-webkit-scrollbar { + z-index: 10000; width: 10px; background: $clr-background-dark; } ::-webkit-scrollbar-track { + z-index: 10000; background-color: transparent; &:hover { background: rgb(255 255 255 / 0.25); } } ::-webkit-scrollbar-thumb { + z-index: 10000; background: rgb(255 255 255 / 0.25); } diff --git a/src/utils/slice/appBar.js b/src/utils/slice/appBar.js index a2f4605..1fc6247 100644 --- a/src/utils/slice/appBar.js +++ b/src/utils/slice/appBar.js @@ -6,7 +6,7 @@ export const appBarSlice = createSlice({ initialState: { visible: false, backdrop: false, - page: undefined, + backButtonVisible: false, }, reducers: { showAppBar: (state) => { @@ -18,15 +18,20 @@ export const appBarSlice = createSlice({ setBackdrop: (state, action) => { state.backdrop = action.payload; }, - setPage: (state, action) => { - state.page = action.payload; + showBackButton: (state, action) => { + state.backButtonVisible = true; }, - removePage: (state) => { - state.page = undefined; + hideBackButton: (state) => { + state.backButtonVisible = false; }, }, }); -export const { showAppBar, hideAppBar, setBackdrop, setPage, removePage } = - appBarSlice.actions; +export const { + showAppBar, + hideAppBar, + setBackdrop, + showBackButton, + hideBackButton, +} = appBarSlice.actions; export default appBarSlice.reducer;