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}> <Grid item xs={12} md={12} lg={12} xl={12}>
<Box> <Box>
<Typography as="h1" fontSize="28px" fontWeight="700" mb="5px"> <Typography as="h1" fontSize="28px" fontWeight="700" mb="65px">
Sign In{" "} Sign In{" "}
<img <img
src="/images/favicon.png" src="/images/favicon.png"
@@ -42,7 +42,7 @@ const SignInForm = () => {
/> />
</Typography> </Typography>
<Typography fontSize="15px" mb="30px"> {/* <Typography fontSize="15px" mb="30px">
Already have an account?{" "} Already have an account?{" "}
<Link <Link
href="/authentication/sign-up" href="/authentication/sign-up"
@@ -73,7 +73,7 @@ const SignInForm = () => {
<div className={styles.or}> <div className={styles.or}>
<span>or</span> <span>or</span>
</div> </div> */}
<Box component="form" noValidate onSubmit={handleSubmit}> <Box component="form" noValidate onSubmit={handleSubmit}>
<Box <Box
+28 -43
View File
@@ -6,68 +6,53 @@ import TopNavbar from "@/components/_App/TopNavbar";
import Footer from "@/components/_App/Footer"; import Footer from "@/components/_App/Footer";
import ScrollToTop from "./ScrollToTop"; import ScrollToTop from "./ScrollToTop";
import ControlPanelModal from "./ControlPanelModal"; import ControlPanelModal from "./ControlPanelModal";
import AuthRoute from "middlewares/AuthRoute";
const Layout = ({ children }) => { const Layout = ({ children }) => {
const router = useRouter(); const router = useRouter();
const [active, setActive] = useState(false); const [active, setActive] = useState(false);
const isAuthenticated = false; // Replace with your authentication logic
const toogleActive = () => { const toggleActive = () => {
setActive(!active); 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 ( return (
<> <>
<Head> <Head>
<title> <title>
CMC - Client {isAuthenticated ? "CMC - Client" : "CMC - Authentication"}
</title> </title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" /> <meta name="viewport" content="initial-scale=1.0, width=device-width" />
</Head> </Head>
<div className={`main-wrapper-content ${active && "active"}`}> <AuthRoute>
{!( <div className={`main-wrapper-content ${active ? "active" : ""}`}>
router.pathname === "/authentication/sign-in" || {!isAuthenticationPage && (
router.pathname === "/authentication/sign-up" || <>
router.pathname === "/authentication/forgot-password" || <TopNavbar toggleActive={toggleActive} />
router.pathname === "/authentication/lock-screen" || <LeftSidebar toggleActive={toggleActive} />
router.pathname === "/authentication/confirm-mail" || </>
router.pathname === "/authentication/logout" )}
) && (
<>
<TopNavbar toogleActive={toogleActive} />
<LeftSidebar toogleActive={toogleActive} /> <div className="main-content">{children}</div>
</>
)}
<div className="main-content"> {!isAuthenticationPage && <Footer />}
{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 />}
</div> </div>
</div>
<ScrollToTop />
{/* ScrollToTop */}
<ScrollToTop /> {!isAuthenticationPage && <ControlPanelModal />}
</AuthRoute>
{!(
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 />
}
</> </>
); );
}; };
+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() { export default function SignIn() {
return ( return <SignInForm />;
<>
<SignInForm />
</>
);
} }
+9 -23
View File
@@ -1,7 +1,7 @@
import React from 'react'; import React from "react";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import Link from 'next/link'; import Link from "next/link";
import styles from '@/styles/PageTitle.module.css' import styles from "@/styles/PageTitle.module.css";
import Features from "@/components/Dashboard/eCommerce/Features"; import Features from "@/components/Dashboard/eCommerce/Features";
import Ratings from "@/components/Dashboard/eCommerce/Ratings"; import Ratings from "@/components/Dashboard/eCommerce/Ratings";
import AudienceOverview from "@/components/Dashboard/eCommerce/AudienceOverview"; 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 TeamMembersList from "@/components/Dashboard/eCommerce/TeamMembersList";
import BestSellingProducts from "@/components/Dashboard/eCommerce/BestSellingProducts"; import BestSellingProducts from "@/components/Dashboard/eCommerce/BestSellingProducts";
import LiveVisitsOnOurSite from "@/components/Dashboard/eCommerce/LiveVisitsOnOurSite"; import LiveVisitsOnOurSite from "@/components/Dashboard/eCommerce/LiveVisitsOnOurSite";
import AuthRoute from "middlewares/AuthRoute";
export default function eCommerce() { function MainPage() {
return ( return (
<> <>
{/* Page title */} {/* Page title */}
@@ -26,29 +27,20 @@ export default function eCommerce() {
<li> <li>
<Link href="/">Dashboard</Link> <Link href="/">Dashboard</Link>
</li> </li>
<li> <li>eCommerce</li>
eCommerce
</li>
</ul> </ul>
</div> </div>
<Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 2 }}> <Grid container rowSpacing={1} columnSpacing={{ xs: 1, sm: 2, md: 2 }}>
<Grid item xs={12} md={12} lg={12} xl={8}> <Grid item xs={12} md={12} lg={12} xl={8}>
{/* Features */} {/* Features */}
<Features /> <Features />
{/* AudienceOverview */} {/* AudienceOverview */}
<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}> <Grid item xs={12} md={8}>
{/* VisitsByDay */} {/* VisitsByDay */}
<VisitsByDay /> <VisitsByDay />
</Grid> </Grid>
<Grid item xs={12} md={4}> <Grid item xs={12} md={4}>
{/* Impressions */} {/* Impressions */}
<Impressions /> <Impressions />
@@ -56,32 +48,25 @@ export default function eCommerce() {
{/* ActivityTimeline */} {/* ActivityTimeline */}
<ActivityTimeline /> <ActivityTimeline />
</Grid> </Grid>
<Grid item xs={12} md={12}> <Grid item xs={12} md={12}>
{/* RevenuStatus */} {/* RevenuStatus */}
<RevenuStatus /> <RevenuStatus />
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item xs={12} md={12} lg={12} xl={4}> <Grid item xs={12} md={12} lg={12} xl={4}>
{/* Ratings */} {/* Ratings */}
<Ratings /> <Ratings />
{/* LiveVisitsOnOurSite */} {/* LiveVisitsOnOurSite */}
<LiveVisitsOnOurSite /> <LiveVisitsOnOurSite />
{/* SalesByLocations */} {/* SalesByLocations */}
<SalesByCountries /> <SalesByCountries />
{/* NewCustomers */} {/* NewCustomers */}
<NewCustomers /> <NewCustomers />
</Grid> </Grid>
</Grid> </Grid>
{/* Recent Orders */} {/* Recent Orders */}
<RecentOrders /> <RecentOrders />
<Grid <Grid
container container
rowSpacing={1} rowSpacing={1}
@@ -91,7 +76,6 @@ export default function eCommerce() {
{/* TeamMembersList */} {/* TeamMembersList */}
<TeamMembersList /> <TeamMembersList />
</Grid> </Grid>
<Grid item xs={12} md={12} lg={12} xl={4}> <Grid item xs={12} md={12} lg={12} xl={4}>
{/* BestSellingProducts */} {/* BestSellingProducts */}
<BestSellingProducts /> <BestSellingProducts />
@@ -100,3 +84,5 @@ export default function eCommerce() {
</> </>
); );
} }
export default MainPage