Fix scrollbar
This commit is contained in:
9 files changed
+65
-107
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user