Do not show modal on sign-in page

This commit is contained in:
Valtteri Karesto
2021-12-13 17:22:18 +02:00
parent df47158f29
commit fad5e13430

View File

@@ -17,15 +17,13 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
const slug = router.query?.slug; const slug = router.query?.slug;
const gistId = (Array.isArray(slug) && slug[0]) ?? null; const gistId = (Array.isArray(slug) && slug[0]) ?? null;
useEffect(() => { useEffect(() => {
if (router.pathname.includes("/develop")) {
if (gistId && router.isReady) { if (gistId && router.isReady) {
fetchFiles(gistId); fetchFiles(gistId);
} else { } else {
if (!gistId && router.isReady) { if (!gistId && router.isReady && !router.pathname.includes("/sign-in")) {
state.mainModalOpen = true; state.mainModalOpen = true;
} }
} }
}
}, [gistId, router.isReady, router.pathname]); }, [gistId, router.isReady, router.pathname]);
return ( return (
@@ -52,6 +50,7 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
backgroundColor: "$mauve1", backgroundColor: "$mauve1",
color: "$mauve10", color: "$mauve10",
fontSize: "$sm", fontSize: "$sm",
zIndex: 9999,
".dark &": { ".dark &": {
backgroundColor: "$mauve4", backgroundColor: "$mauve4",
color: "$mauve12", color: "$mauve12",