Mantis MUI React
v3.5.0
v3.5.0
  • Documentation
  • Pre-requisites
  • Quick Start
  • Package
  • Folder Structure
  • State Management
  • Internationalization
  • Authentication
    • Switch to Auth0
    • Switch to Firebase
    • Switch to AWS Cognito
    • Switch to Supabase
  • Axios API Calls
  • Routing
  • Project Configuration
  • Color Presets
  • Theme/Style Configuration
  • How to
    • Login as First Page
    • Dashboard as First Page
    • Render Menu from the backend
    • Remove menu render from Backend
    • Remove Authentication
      • Vite
      • NextJS
  • Figma
  • Integration
    • Seed
    • To Existing Project
    • Comparison
  • Components
    • Avatar
    • BreadCrumb
    • Button
    • Dot
    • Main Card
    • Progress
    • SnackBar
    • Tooltip
    • Transitions
  • Dependencies
  • Roadmap
  • Support
  • Changelog
  • Mantis Eco System
  • FAQ
Powered by GitBook
On this page
  1. How to

Dashboard as First Page

How to set Dashboards First page instead landing

This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.

  1. Update route at:- src/routes/index.tsx

src/routes/index.tsx
// import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';

// project import
import MainRoutes from './MainRoutes';
// import LoginRoutes from './LoginRoutes';
import ComponentsRoutes from './ComponentsRoutes';

// import { SimpleLayoutType } from 'config';
// import SimpleLayout from 'layout/Simple';
// import Loadable from 'components/Loadable';

// render - landing page
// const PagesLanding = Loadable(lazy(() => import('pages/landing')));

// ==============================|| ROUTING RENDER ||============================== //

const router = createBrowserRouter(
  [
    // {
    //   path: '/',
    //   element: <SimpleLayout layout={SimpleLayoutType.LANDING} />,
    //   children: [
    //     {
    //       index: true,
    //       element: <PagesLanding />
    //     }
    //   ]
    // },
    // LoginRoutes,
    MainRoutes,
    ComponentsRoutes
  ],
  { basename: import.meta.env.VITE_APP_BASE_NAME }
);

export default router;
  1. Add default dashboard route: src\routes\MainRoutes.tsx

src/routes/MainRoutes.tsx
....

const MainRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: <DashboardLayout />,
      children: [
        {
          path: '/',
          element: <DashboardDefault />
        },
        {
          path: 'dashboard',
          children: [
            {
              path: 'default',
              element: <DashboardDefault />
            },
            ....
          ]
        }
        ...
      ]
  };
  1. Comment out the AuthGuard wrapper for the routes within the DashboardLayout element:

src/layout/Dashboard/index.tsx
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)

Disabling authentication within the system would render certain applications non-functional, particularly those reliant on backend APIs. These applications require a valid token to access and load data seamlessly.

This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.

  1. Update route at:- src/routes/index.jsx

src/routes/index.jsx
// import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';

// project import
import MainRoutes from './MainRoutes';
// import LoginRoutes from './LoginRoutes';
import ComponentsRoutes from './ComponentsRoutes';

// import { SimpleLayoutType } from 'config';
// import SimpleLayout from 'layout/Simple';
// import Loadable from 'components/Loadable';

// render - landing page
// const PagesLanding = Loadable(lazy(() => import('pages/landing')));

// ==============================|| ROUTING RENDER ||============================== //

const router = createBrowserRouter(
  [
    //   {
    //     path: '/',
    //     element: <SimpleLayout layout={SimpleLayoutType.LANDING} />,
    //     children: [
    //       {
    //         index: true,
    //         element: <PagesLanding />
    //       }
    //     ]
    //   },
    //   LoginRoutes,
    MainRoutes,
    ComponentsRoutes
  ],
  { basename: import.meta.env.VITE_APP_BASE_NAME }
);

export default router;
  1. Add default dashboard route: src\routes\MainRoutes.jsx

src\routes\MainRoutes.jsx
....

const MainRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: <DashboardLayout />,
      children: [
        {
          path: '/',
          element: <DashboardDefault />
        },
        {
          path: 'dashboard',
          children: [
            {
              path: 'default',
              element: <DashboardDefault />
            },
            ....
          ]
        }
        ...
      ]
  };
  1. Comment out the AuthGuard wrapper for the routes within the DashboardLayout element:

src/layout/Dashboard/index.jsx
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)

Disabling authentication within the system would render certain applications non-functional, particularly those reliant on backend APIs. These applications require a valid token to access and load data seamlessly.

This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.

  1. Update route at:- src/app/page.tsx

src/app/page.tsx
// project imports
// import SimpleLayout from 'layout/SimpleLayout';
// import Landing from 'views/landing';
import DashboardLayout from 'layout/DashboardLayout';

export default function HomePage({ children }: { children: React.ReactNode }) {
  return (
    // <SimpleLayout>
    //   <Landing />
    // </SimpleLayout>
    // <AuthGuard>

    <DashboardLayout>{children}</DashboardLayout>
  );
}
  1. Comment out the AuthGuard wrapper for the routes within the DashboardLayout element:

src/layout/DashboardLayout/index.tsx
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)

Disabling authentication within the system would render certain applications non-functional, particularly those reliant on backend APIs. These applications require a valid token to access and load data seamlessly.

This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.

  1. Update route at:- src/app/page.jsx

src/app/page.jsx
// project imports
// import SimpleLayout from 'layout/SimpleLayout';
// import Landing from 'views/landing';
import DashboardLayout from 'layout/DashboardLayout';

export default function HomePage({ children } {
  return (
    // <SimpleLayout>
    //   <Landing />
    // </SimpleLayout>
    // <AuthGuard>

    <DashboardLayout>{children}</DashboardLayout>
  );
}
  1. Comment out the AuthGuard wrapper for the routes within the DashboardLayout element:

src/layout/DashboardLayout/index.jsx
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)

Disabling authentication within the system would render certain applications non-functional, particularly those reliant on backend APIs. These applications require a valid token to access and load data seamlessly.

PreviousLogin as First PageNextRender Menu from the backend