Home Page Customization

This commit is contained in:
Ebube
2023-10-16 21:11:18 +01:00
parent 5f95d857d4
commit 857ef15dd2
5 changed files with 62 additions and 75 deletions
+28 -43
View File
@@ -6,68 +6,53 @@ import TopNavbar from "@/components/_App/TopNavbar";
import Footer from "@/components/_App/Footer";
import ScrollToTop from "./ScrollToTop";
import ControlPanelModal from "./ControlPanelModal";
import AuthRoute from "middlewares/AuthRoute";
const Layout = ({ children }) => {
const router = useRouter();
const [active, setActive] = useState(false);
const isAuthenticated = false; // Replace with your authentication logic
const toogleActive = () => {
const toggleActive = () => {
setActive(!active);
};
const isAuthenticationPage = [
"/authentication/sign-in",
"/authentication/sign-up",
"/authentication/forgot-password",
"/authentication/lock-screen",
"/authentication/confirm-mail",
"/authentication/logout",
].includes(router.pathname);
return (
<>
<Head>
<title>
CMC - Client
{isAuthenticated ? "CMC - Client" : "CMC - Authentication"}
</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
</Head>
<div className={`main-wrapper-content ${active && "active"}`}>
{!(
router.pathname === "/authentication/sign-in" ||
router.pathname === "/authentication/sign-up" ||
router.pathname === "/authentication/forgot-password" ||
router.pathname === "/authentication/lock-screen" ||
router.pathname === "/authentication/confirm-mail" ||
router.pathname === "/authentication/logout"
) && (
<>
<TopNavbar toogleActive={toogleActive} />
<AuthRoute>
<div className={`main-wrapper-content ${active ? "active" : ""}`}>
{!isAuthenticationPage && (
<>
<TopNavbar toggleActive={toggleActive} />
<LeftSidebar toggleActive={toggleActive} />
</>
)}
<LeftSidebar toogleActive={toogleActive} />
</>
)}
<div className="main-content">{children}</div>
<div className="main-content">
{children}
{!(
router.pathname === "/authentication/sign-in" ||
router.pathname === "/authentication/sign-up" ||
router.pathname === "/authentication/forgot-password" ||
router.pathname === "/authentication/lock-screen" ||
router.pathname === "/authentication/confirm-mail" ||
router.pathname === "/authentication/logout"
) && <Footer />}
{!isAuthenticationPage && <Footer />}
</div>
</div>
{/* ScrollToTop */}
<ScrollToTop />
{!(
router.pathname === "/authentication/sign-in" ||
router.pathname === "/authentication/sign-up" ||
router.pathname === "/authentication/forgot-password" ||
router.pathname === "/authentication/lock-screen" ||
router.pathname === "/authentication/confirm-mail" ||
router.pathname === "/authentication/logout"
) &&
<ControlPanelModal />
}
<ScrollToTop />
{!isAuthenticationPage && <ControlPanelModal />}
</AuthRoute>
</>
);
};