bug fixes + improvements

This commit is contained in:
Daniel
2023-07-16 11:51:24 -04:00
parent c7cfbc3846
commit 4ee74dc232
9 changed files with 35 additions and 14 deletions
+10 -1
View File
@@ -1,11 +1,12 @@
import Navbar from "@/components/Navbar";
import Sidebar from "@/components/Sidebar";
import { ReactNode } from "react";
import { ReactNode, useEffect } from "react";
import { useSession } from "next-auth/react";
import Loader from "../components/Loader";
import useRedirect from "@/hooks/useRedirect";
import { useRouter } from "next/router";
import ModalManagement from "@/components/ModalManagement";
import useModalStore from "@/store/modals";
interface Props {
children: ReactNode;
@@ -17,6 +18,14 @@ export default function MainLayout({ children }: Props) {
const redirect = useRedirect();
const routeExists = router.route === "/_error" ? false : true;
const { modal } = useModalStore();
useEffect(() => {
modal
? (document.body.style.overflow = "hidden")
: (document.body.style.overflow = "auto");
}, [modal]);
if (status === "authenticated" && !redirect && routeExists)
return (
<>