// react import React, { useEffect, useState } from "react"; // next import { useRouter } from "next/router"; // hooks import useUser from "lib/hooks/useUser"; // layouts import Container from "layouts/container"; import Sidebar from "layouts/navbar/main-sidebar"; import Header from "layouts/navbar/header"; // components import CreateProjectModal from "components/project/create-project-modal"; // types import type { Props } from "./types"; const AppLayout: React.FC = ({ meta, children, noPadding = false, bg = "primary", noHeader = false, breadcrumbs, left, right, }) => { const [isOpen, setIsOpen] = useState(false); const router = useRouter(); const { user, isUserLoading } = useUser(); useEffect(() => { if (!isUserLoading && (!user || user === null)) router.push("/signin"); }, [isUserLoading, user, router]); return (
{noHeader ? null :
}
{children}
); }; export default AppLayout;