Fix scrollbar
This commit is contained in:
9 files changed
+65
-107
No files matched your search
@@ -7,7 +7,7 @@ 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 Zoom from "@mui/material/Zoom";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
|
||||
import { MdiMagnify } from "../icons/mdiMagnify";
|
||||
import { theme } from "../../theme";
|
||||
@@ -44,6 +44,11 @@ export const AppBar = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname == "/home") {
|
||||
dispatch(hideBackButton());
|
||||
@@ -54,13 +59,11 @@ export const AppBar = () => {
|
||||
visible && (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
// mr: "10px",
|
||||
background: "transparent",
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
className={
|
||||
backdropVisible ? "appBar backdropVisible" : "appBar"
|
||||
}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={backdropVisible ? 6 : 0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/** @format */
|
||||
|
||||
.appBar {
|
||||
transition: background $transition-time-default,
|
||||
box-shadow $transition-time-default;
|
||||
transition: background-color $transition-time-fast,
|
||||
box-shadow $transition-time-default !important;
|
||||
&.backdropVisible {
|
||||
background: $clr-background-dark;
|
||||
background-color: $clr-background-dark;
|
||||
}
|
||||
&-avatar {
|
||||
background: $clr-gradient-dark;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @format */
|
||||
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
@@ -14,13 +14,11 @@ import { theme } from "../../theme";
|
||||
import "./home.module.scss";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Button from "@mui/material/Button";
|
||||
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,8 +38,7 @@ import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
|
||||
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 { showAppBar } 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";
|
||||
@@ -49,14 +46,12 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import { useNavigate, useLocation, Link } from "react-router-dom";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
|
||||
import { formateDate } from "../../utils/date/formateDate";
|
||||
import { getRuntime } from "../../utils/date/time";
|
||||
|
||||
const Home = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
queryFn: async () => {
|
||||
@@ -193,18 +188,6 @@ const Home = () => {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(setBackdrop(trigger));
|
||||
}, [trigger]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@@ -217,11 +200,6 @@ const Home = () => {
|
||||
pb: 3,
|
||||
position: "relative",
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Carousel
|
||||
className="hero-carousel"
|
||||
|
||||
@@ -6,17 +6,12 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { showAppBar, showBackButton } from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
@@ -36,23 +31,15 @@ const ItemMovie = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
}, []);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
@@ -78,7 +65,7 @@ const ItemMovie = () => {
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
@@ -122,11 +109,6 @@ const ItemMovie = () => {
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
|
||||
@@ -6,17 +6,12 @@ import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Chip from "@mui/material/Chip";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import {
|
||||
setBackdrop,
|
||||
showAppBar,
|
||||
showBackButton,
|
||||
} from "../../../utils/slice/appBar";
|
||||
import { showAppBar, showBackButton } from "../../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
@@ -36,23 +31,15 @@ const ItemSeries = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 0,
|
||||
target: scrollTarget,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(setBackdrop(trigger));
|
||||
dispatch(showBackButton());
|
||||
}, [trigger]);
|
||||
}, []);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
@@ -78,7 +65,7 @@ const ItemSeries = () => {
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
@@ -122,11 +109,6 @@ const ItemSeries = () => {
|
||||
flexFlow: "column",
|
||||
gap: 5,
|
||||
}}
|
||||
ref={(node) => {
|
||||
if (node) {
|
||||
setScrollTarget(node);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Box className="item-detail-header">
|
||||
<Box className="item-detail-header-backdrop">
|
||||
|
||||
+25
-10
@@ -1,15 +1,12 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
showAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
} from "../../utils/slice/appBar";
|
||||
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import Box from "@mui/material/Box";
|
||||
import Grid2 from "@mui/material/Unstable_Grid2";
|
||||
import Stack from "@mui/material/Stack";
|
||||
@@ -301,8 +298,6 @@ const LibraryView = () => {
|
||||
enabled: !!user.data,
|
||||
});
|
||||
|
||||
dispatch(setBackdrop(true));
|
||||
|
||||
const handleCurrentViewType = (e) => {
|
||||
setCurrentViewType(e.target.value);
|
||||
};
|
||||
@@ -324,6 +319,11 @@ const LibraryView = () => {
|
||||
setFilterButtonAnchorEl(null);
|
||||
};
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 1,
|
||||
});
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -343,13 +343,28 @@ const LibraryView = () => {
|
||||
>
|
||||
<AppBar
|
||||
position="fixed"
|
||||
elevation={0}
|
||||
elevation={trigger ? 1 : 0}
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
mt: 8,
|
||||
background: "transparent",
|
||||
backgroundColor: trigger
|
||||
? `${theme.palette.background.paper} !important`
|
||||
: "transparent",
|
||||
transition:
|
||||
"transition: background-color 150ms, box-shadow 150ms !important",
|
||||
}}
|
||||
>
|
||||
<Divider />
|
||||
<Divider
|
||||
sx={{
|
||||
transform: trigger
|
||||
? "scaleX(1)"
|
||||
: "scaleX(0)",
|
||||
transition: "transform 150ms",
|
||||
transformOrigin: "left",
|
||||
transitionDelay: "50ms",
|
||||
}}
|
||||
/>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Stack alignItems="center" direction="row">
|
||||
<Typography
|
||||
|
||||
+16
-10
@@ -1,19 +1,22 @@
|
||||
/** @format */
|
||||
::-webkit-scrollbar {
|
||||
z-index: 10000;
|
||||
width: 10px;
|
||||
width: 14px;
|
||||
background: $clr-background-dark;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
z-index: 10000;
|
||||
background-color: transparent;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
background-color: rgb(255 255 255 / 0.15);
|
||||
}
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
z-index: 10000;
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
border: 4px solid transparent;
|
||||
background-clip: padding-box;
|
||||
border-radius: 9999px;
|
||||
background-color: rgb(255 255 255 / 0.25);
|
||||
&:hover {
|
||||
background-color: rgb(255 255 255 / 0.35);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -24,14 +27,17 @@ body {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: overlay;
|
||||
}
|
||||
|
||||
#root,
|
||||
.root-page {
|
||||
height: 100vh;
|
||||
height: fit-content;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
overflow-y: visible;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.centered {
|
||||
@@ -81,8 +87,8 @@ h1 {
|
||||
|
||||
.scrollY {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: 100vh;
|
||||
overflow-y: visible;
|
||||
height: fit-content;
|
||||
width: inherit;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -24,3 +24,4 @@ $border-radius-default: 10px;
|
||||
$border-radius-intensity-1: 5px;
|
||||
|
||||
$transition-time-default: 250ms;
|
||||
$transition-time-fast: 150ms;
|
||||
@@ -5,7 +5,6 @@ export const appBarSlice = createSlice({
|
||||
name: "appBar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backdrop: false,
|
||||
backButtonVisible: false,
|
||||
},
|
||||
reducers: {
|
||||
@@ -15,9 +14,6 @@ export const appBarSlice = createSlice({
|
||||
hideAppBar: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
setBackdrop: (state, action) => {
|
||||
state.backdrop = action.payload;
|
||||
},
|
||||
showBackButton: (state, action) => {
|
||||
state.backButtonVisible = true;
|
||||
},
|
||||
@@ -27,11 +23,6 @@ export const appBarSlice = createSlice({
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
showAppBar,
|
||||
hideAppBar,
|
||||
setBackdrop,
|
||||
showBackButton,
|
||||
hideBackButton,
|
||||
} = appBarSlice.actions;
|
||||
export const { showAppBar, hideAppBar, showBackButton, hideBackButton } =
|
||||
appBarSlice.actions;
|
||||
export default appBarSlice.reducer;
|
||||
Reference in new issue
Block a user