fix(router): Remove ScrollRestoration and improve episodeSkeleton
This commit is contained in:
5 files changed
+14
-5
No files matched your search
+2
-4
@@ -5,10 +5,8 @@ import { AnimatePresence, motion } from "framer-motion";
|
|||||||
import { SnackbarProvider } from "notistack";
|
import { SnackbarProvider } from "notistack";
|
||||||
import {
|
import {
|
||||||
Navigate,
|
Navigate,
|
||||||
Outlet,
|
|
||||||
Route,
|
Route,
|
||||||
Routes,
|
Routes,
|
||||||
ScrollRestoration,
|
|
||||||
useLocation,
|
useLocation,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
@@ -224,7 +222,6 @@ function App() {
|
|||||||
|
|
||||||
return <AppReady />;
|
return <AppReady />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AppReady() {
|
function AppReady() {
|
||||||
const [audioPlayerVisible] = useAudioPlayback((state) => [state.display]);
|
const [audioPlayerVisible] = useAudioPlayback((state) => [state.display]);
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
@@ -251,6 +248,8 @@ function AppReady() {
|
|||||||
const isQueryFetching = useIsFetching();
|
const isQueryFetching = useIsFetching();
|
||||||
const isMutating = useIsMutating();
|
const isMutating = useIsMutating();
|
||||||
|
|
||||||
|
useEffect(() => window.scrollTo(0, 0), [location.key]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
try {
|
try {
|
||||||
@@ -288,7 +287,6 @@ function AppReady() {
|
|||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<ScrollRestoration />
|
|
||||||
<NProgress
|
<NProgress
|
||||||
isAnimating={isQueryFetching}
|
isAnimating={isQueryFetching}
|
||||||
key={isQueryFetching || isMutating ? "fetching" : "notFetching"}
|
key={isQueryFetching || isMutating ? "fetching" : "notFetching"}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const NProgress: React.FC<{ isAnimating: boolean | number }> = ({
|
|||||||
>
|
>
|
||||||
<LinearProgress
|
<LinearProgress
|
||||||
sx={{
|
sx={{
|
||||||
|
height: 3,
|
||||||
transitionDuration: animationDuration,
|
transitionDuration: animationDuration,
|
||||||
}}
|
}}
|
||||||
value={progress * 100}
|
value={progress * 100}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</CardMedia>
|
</CardMedia>
|
||||||
@@ -80,6 +81,7 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -91,6 +93,7 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Skeleton
|
<Skeleton
|
||||||
@@ -99,6 +102,7 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -108,6 +112,7 @@ export const SeasonSelectorSkeleton = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import { BrowserRouter as Router } from "react-router-dom";
|
import { MemoryRouter as Router } from "react-router-dom";
|
||||||
|
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
|||||||
@@ -934,6 +934,7 @@ const SeriesTitlePage = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</CardMedia>
|
</CardMedia>
|
||||||
@@ -951,6 +952,7 @@ const SeriesTitlePage = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -962,6 +964,7 @@ const SeriesTitlePage = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Skeleton
|
<Skeleton
|
||||||
@@ -970,6 +973,7 @@ const SeriesTitlePage = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -979,6 +983,7 @@ const SeriesTitlePage = () => {
|
|||||||
animationDelay: `${index * 0.2}s`,
|
animationDelay: `${index * 0.2}s`,
|
||||||
animationDuration: "1.4s",
|
animationDuration: "1.4s",
|
||||||
animationName: "pulse",
|
animationName: "pulse",
|
||||||
|
opacity: 0.1,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
Reference in new issue
Block a user