// 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 SettingsSidebar from "layouts/Navbar/settings-sidebar"; import Header from "layouts/Navbar/Header"; // components import CreateProjectModal from "components/project/create-project-modal"; // types import { Meta } from "./types"; type Props = { meta?: Meta; children: React.ReactNode; noPadding?: boolean; bg?: "primary" | "secondary"; breadcrumbs?: JSX.Element; right?: JSX.Element; links: Array<{ label: string; href: string; }>; }; const SettingsLayout: React.FC = ({ meta, children, noPadding = false, bg = "primary", breadcrumbs, right, links, }) => { 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 (
{children}
); }; export default SettingsLayout;