Merge branch 'siginup-customization-and-setup' of Controls/CMS-Client into master

This commit is contained in:
2023-10-17 06:03:25 +00:00
committed by Gogs
5 changed files with 65 additions and 75 deletions
+3 -3
View File
@@ -33,7 +33,7 @@ const SignInForm = () => {
>
<Grid item xs={12} md={12} lg={12} xl={12}>
<Box>
<Typography as="h1" fontSize="28px" fontWeight="700" mb="5px">
<Typography as="h1" fontSize="28px" fontWeight="700" mb="65px">
Sign In{" "}
<img
src="/images/favicon.png"
@@ -42,7 +42,7 @@ const SignInForm = () => {
/>
</Typography>
<Typography fontSize="15px" mb="30px">
{/* <Typography fontSize="15px" mb="30px">
Already have an account?{" "}
<Link
href="/authentication/sign-up"
@@ -73,7 +73,7 @@ const SignInForm = () => {
<div className={styles.or}>
<span>or</span>
</div>
</div> */}
<Box component="form" noValidate onSubmit={handleSubmit}>
<Box
+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>
</>
);
};
+23
View File
@@ -0,0 +1,23 @@
"use client"
import { useEffect } from "react";
import { useRouter } from "next/router";
/**
* This is used to protect routes in a web application.
* It checks if the user is authenticated and redirects them to the sign-in page if they are not.
*/
const AuthRoute = ({ children }) => {
const router = useRouter();
useEffect(() => {
const isAuthenticated = false; // In a real application, this would be determined based on the user's authentication status.
if (!isAuthenticated) {
router.push("/authentication/sign-in/");
}
}, [router]);
return <>{children}</>;
};
export default AuthRoute;
+2 -6
View File
@@ -1,9 +1,5 @@
import SignInForm from '@/components/Authentication/SignInForm';
import SignInForm from "@/components/Authentication/SignInForm";
export default function SignIn() {
return (
<>
<SignInForm />
</>
);
return <SignInForm />;
}
+9 -23
View File
@@ -1,7 +1,7 @@
import React from 'react';
import React from "react";
import Grid from "@mui/material/Grid";
import Link from 'next/link';
import styles from '@/styles/PageTitle.module.css'
import Link from "next/link";
import styles from "@/styles/PageTitle.module.css";
import Features from "@/components/Dashboard/eCommerce/Features";
import Ratings from "@/components/Dashboard/eCommerce/Ratings";
import AudienceOverview from "@/components/Dashboard/eCommerce/AudienceOverview";
@@ -15,8 +15,9 @@ import RecentOrders from "@/components/Dashboard/eCommerce/RecentOrders";
import TeamMembersList from "@/components/Dashboard/eCommerce/TeamMembersList";
import BestSellingProducts from "@/components/Dashboard/eCommerce/BestSellingProducts";
import LiveVisitsOnOurSite from "@/components/Dashboard/eCommerce/LiveVisitsOnOurSite";
import AuthRoute from "middlewares/AuthRoute";
export default function eCommerce() {
function MainPage() {
return (
<>
{/* Page title */}
@@ -26,29 +27,20 @@ export default function eCommerce() {
<li>
<Link href="/">Dashboard</Link>
</li>
<li>
eCommerce
</li>
<li>eCommerce</li>
</ul>
</div>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 2 }}>
<Grid item xs={12} md={12} lg={12} xl={8}>
{/* Features */}
<Features />
{/* AudienceOverview */}
<AudienceOverview />
<Grid
container
columnSpacing={{ xs: 1, sm: 2, md: 2 }}
>
<Grid container columnSpacing={{ xs: 1, sm: 2, md: 2 }}>
<Grid item xs={12} md={8}>
{/* VisitsByDay */}
<VisitsByDay />
</Grid>
<Grid item xs={12} md={4}>
{/* Impressions */}
<Impressions />
@@ -56,32 +48,25 @@ export default function eCommerce() {
{/* ActivityTimeline */}
<ActivityTimeline />
</Grid>
<Grid item xs={12} md={12}>
{/* RevenuStatus */}
<RevenuStatus />
</Grid>
</Grid>
</Grid>
<Grid item xs={12} md={12} lg={12} xl={4}>
{/* Ratings */}
<Ratings />
{/* LiveVisitsOnOurSite */}
<LiveVisitsOnOurSite />
{/* SalesByLocations */}
<SalesByCountries />
{/* NewCustomers */}
<NewCustomers />
</Grid>
</Grid>
{/* Recent Orders */}
<RecentOrders />
<Grid
container
rowSpacing={1}
@@ -91,7 +76,6 @@ export default function eCommerce() {
{/* TeamMembersList */}
<TeamMembersList />
</Grid>
<Grid item xs={12} md={12} lg={12} xl={4}>
{/* BestSellingProducts */}
<BestSellingProducts />
@@ -100,3 +84,5 @@ export default function eCommerce() {
</>
);
}
export default MainPage