text: import React, { Suspense, Fragment, lazy } from 'react';
  import { Switch, Redirect, Route } from 'react-router-dom';
  
  import Loader from './components/Loader/Loader';
  import AdminLayout from './layouts/AdminLayout';
  
  import GuestGuard from './components/Auth/GuestGuard';
  import AuthGuard from './components/Auth/AuthGuard';
  
  import { BASE_URL } from './config/constant';
  
  export const renderRoutes = (routes = []) => (
      <Suspense fallback={<Loader />}>
          <Switch>
              {routes.map((route, i) => {
                  const Guard = route.guard || Fragment;
                  const Layout = route.layout || Fragment;
                  const Component = route.component;
  
                  return (
                      <Route
                          key={i}
                          path={route.path}
                          exact={route.exact}
                          render={(props) => (
                              <Guard>
                                  <Layout>{route.routes ? renderRoutes(route.routes) : <Component {...props} />}</Layout>
                              </Guard>
                          )}
                      />
                  );
              })}
          </Switch>
      </Suspense>
  );
  
  const routes = [
      {
          exact: true,
          guard: GuestGuard,
          path: '/auth/signin',
          component: lazy(() => import('./views/auth/signin/SignIn1'))
      },
      {
          exact: true,
          guard: GuestGuard,
          path: '/auth/signup',
          component: lazy(() => import('./views/auth/signup/SignUp1'))
      },
      {
          exact: true,
          path: '/auth/signin-2',
          component: lazy(() => import('./views/auth/signin/SignIn2'))
      },
      {
          exact: true,
          path: '/auth/signup-2',
          component: lazy(() => import('./views/auth/signup/SignUp2'))
      },
      {
          exact: true,
          layout: AdminLayout,
          path: '/main/home',
          component: lazy(() => import('./views/main/HomePage'))
      },
      {
          exact: true,
          layout: AdminLayout,
          path: '/',
          component: () => <Redirect to={BASE_URL} />
      },
      {
          path: '*',
          layout: AdminLayout,
          guard: AuthGuard,
          routes: [
              {
                  exact: true,
                  path: '/app/dashboard/default',
                  component: lazy(() => import('./views/dashboard/DashDefault'))
              },
  
              {
                  exact: true,
                  path: '/basic/button',
                  component: lazy(() => import('./views/ui-elements/basic/BasicButton'))
              },
              {
                  exact: true,
                  path: '/basic/badges',
                  component: lazy(() => import('./views/ui-elements/basic/BasicBadges'))
              },
              {
                  exact: true,
                  path: '/basic/breadcrumb',
                  component: lazy(() => import('./views/ui-elements/basic/BasicBreadcrumb'))
              },
              {
                  exact: true,
                  path: '/basic/collapse',
                  component: lazy(() => import('./views/ui-elements/basic/BasicCollapse'))
              },
              {
                  exact: true,
                  path: '/basic/tabs-pills',
                  component: lazy(() => import('./views/ui-elements/basic/BasicTabsPills'))
              },
              {
                  exact: true,
                  path: '/basic/typography',
                  component: lazy(() => import('./views/ui-elements/basic/BasicTypography'))
              },
  
              {
                  exact: true,
                  path: '/forms/form-basic',
                  component: lazy(() => import('./views/forms/FormsElements'))
              },
              {
                  exact: true,
                  path: '/tables/bootstrap',
                  component: lazy(() => import('./views/tables/BootstrapTable'))
              },
  
              {
                  exact: true,
                  path: '/charts/nvd3',
                  component: lazy(() => import('./views/charts/nvd3-chart'))
              },
              {
                  exact: true,
                  path: '/maps/google-map',
                  component: lazy(() => import('./views/maps/GoogleMaps'))
              },
  
              {
                  exact: true,
                  path: '/sample-page',
                  component: lazy(() => import('./views/extra/SamplePage'))
              },
              {
                  exact: true,
                  path: '/test-page',
                  component: lazy(() => import('./views/testPage/TestPage'))
              },
  
              {
                  exact: true,
                  path: '/data/targets',
                  component: lazy(() => import('./views/data/TargetsPage'))
              },
  
              {
                  exact: true,
                  path: '/data/rankings',
                  component: lazy(() => import('./views/data/RankingsPage'))
              },
  
              {
                  exact: true,
                  path: '/tools/find-selector',
                  component: lazy(() => import('./views/tools/FindSelectorPage'))
              },
  
              {
                  exact: true,
                  path: '/tools/verify-selector',
                  component: lazy(() => import('./views/tools/ScanRankingsPage'))
              }
          ]
      },
      {
          path: '*',
          exact: true,
          component: () => <Redirect to={BASE_URL} />
      }
  ];
  
  export default routes;
  