diff --git a/components/_App/Layout.js b/components/_App/Layout.js
index 848acdf..8f0ca2d 100644
--- a/components/_App/Layout.js
+++ b/components/_App/Layout.js
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import LeftSidebar from "@/components/_App/LeftSidebar";
@@ -12,20 +12,30 @@ const Layout = ({ children }) => {
const router = useRouter();
const [active, setActive] = useState(false);
+ const [isAuthenticationPage, setIsAuthenticationPage] = useState(false);
+
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);
+ useEffect(() => {
+ const authenticationPages = [
+ "/auth",
+ "/auth/sign-in",
+ "/auth/sign-up",
+ "/auth/forgot-password",
+ "/auth/lock-screen",
+ "/auth/confirm-mail",
+ "/auth/logout",
+ ];
- const title = isAuthenticationPage ? "CMC - Authentication" : "CMC - Client";
+ setIsAuthenticationPage(authenticationPages.includes(router.pathname));
+ }, [router.pathname]);
+
+ // Debugging: Log the value of isAuthenticationPage
+ console.log("isAuthenticationPage:", isAuthenticationPage, router.pathname);
+
+ const title = isAuthenticationPage ? "CMC - auth" : "CMC - dashboard";
return (
<>
@@ -34,24 +44,22 @@ const Layout = ({ children }) => {
-
-
- {!isAuthenticationPage && (
- <>
-
-
- >
- )}
+
+ {!isAuthenticationPage && (
+ <>
+
+
+ >
+ )}
-
{children}
+
{children}
- {!isAuthenticationPage &&
}
-
+ {!isAuthenticationPage &&
}
+
-
+
- {!isAuthenticationPage && }
-
+ {!isAuthenticationPage && }
>
);
};
diff --git a/components/_App/LeftSidebar/index.js b/components/_App/LeftSidebar/index.js
index 1db8c0a..bbd1224 100644
--- a/components/_App/LeftSidebar/index.js
+++ b/components/_App/LeftSidebar/index.js
@@ -29,7 +29,7 @@ const SidebarWrap = styled("div")(({ theme }) => ({
width: '100%'
}));
-const Sidebar = ({ toogleActive }) => {
+const Sidebar = ({ toggleActive }) => {
return (
<>
@@ -58,11 +58,12 @@ const Sidebar = ({ toogleActive }) => {
diff --git a/components/_App/TopNavbar/index.js b/components/_App/TopNavbar/index.js
index 5b893ab..111190f 100644
--- a/components/_App/TopNavbar/index.js
+++ b/components/_App/TopNavbar/index.js
@@ -7,7 +7,7 @@ import Profile from "./Profile";
import Tooltip from "@mui/material/Tooltip";
import CurrentDate from "./CurrentDate";
-const TopNavbar = ({ toogleActive }) => {
+const TopNavbar = ({ toggleActive }) => {
return (
<>
@@ -28,7 +28,7 @@ const TopNavbar = ({ toogleActive }) => {
size="sm"
edge="start"
color="inherit"
- onClick={toogleActive}
+ onClick={toggleActive}
>
diff --git a/middlewares/AuthRoute.js b/middlewares/AuthRoute.js
index ebccbf3..7d59713 100644
--- a/middlewares/AuthRoute.js
+++ b/middlewares/AuthRoute.js
@@ -14,7 +14,7 @@ const AuthRoute = ({ children }) => {
const isAuthenticated = true; // In a real application, this would be determined based on the user's authentication status.
if (!isAuthenticated) {
- router.push("/authentication/sign-in/");
+ router.push("/auth/");
}
}, [router]);
diff --git a/pages/_app.js b/pages/_app.js
index 357fad2..feaebbe 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -1,34 +1,36 @@
-import React from 'react';
-import '../styles/remixicon.css'
-import 'react-tabs/style/react-tabs.css';
+import React from "react";
+import "../styles/remixicon.css";
+import "react-tabs/style/react-tabs.css";
import "swiper/css";
import "swiper/css/bundle";
// Chat Styles
-import '../styles/chat.css'
+import "../styles/chat.css";
// Globals Styles
-import '../styles/globals.css'
+import "../styles/globals.css";
// Rtl Styles
-import '../styles/rtl.css'
+import "../styles/rtl.css";
// Dark Mode Styles
-import '../styles/dark.css'
+import "../styles/dark.css";
// Theme Styles
-import theme from '../styles/theme'
+import theme from "../styles/theme";
import { ThemeProvider, CssBaseline } from "@mui/material";
import Layout from "@/components/_App/Layout";
+import AuthRoute from "middlewares/AuthRoute";
function MyApp({ Component, pageProps }) {
-
return (
<>
-
-
-
+
+
+
+
+
>
);
}
-export default MyApp
+export default MyApp;
diff --git a/pages/authentication/confirm-mail.js b/pages/auth/confirm-mail.js
similarity index 100%
rename from pages/authentication/confirm-mail.js
rename to pages/auth/confirm-mail.js
diff --git a/pages/authentication/forgot-password.js b/pages/auth/forgot-password.js
similarity index 100%
rename from pages/authentication/forgot-password.js
rename to pages/auth/forgot-password.js
diff --git a/pages/auth/index.js b/pages/auth/index.js
new file mode 100644
index 0000000..030724c
--- /dev/null
+++ b/pages/auth/index.js
@@ -0,0 +1,5 @@
+import SignInForm from "@/components/Authentication/SignInForm";
+
+export default function Index() {
+ return
;
+}
diff --git a/pages/authentication/lock-screen.js b/pages/auth/lock-screen.js
similarity index 100%
rename from pages/authentication/lock-screen.js
rename to pages/auth/lock-screen.js
diff --git a/pages/authentication/logout.js b/pages/auth/logout.js
similarity index 100%
rename from pages/authentication/logout.js
rename to pages/auth/logout.js
diff --git a/pages/authentication/sign-in.js b/pages/auth/sign-in.js
similarity index 100%
rename from pages/authentication/sign-in.js
rename to pages/auth/sign-in.js
diff --git a/pages/authentication/sign-up.js b/pages/auth/sign-up.js
similarity index 100%
rename from pages/authentication/sign-up.js
rename to pages/auth/sign-up.js