0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

Merge pull request #1100 from logto-io/charles-revert-ac-lazy-loading

refactor(console): revert ac lazy loading
This commit is contained in:
Charles Zhao 2022-06-10 18:27:03 +08:00 committed by GitHub
commit 142f3f7b77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
import { LogtoProvider } from '@logto/react';
import { adminConsoleApplicationId, managementResource } from '@logto/schemas/lib/seeds';
import { getBasename } from '@logto/shared';
import React, { Suspense } from 'react';
import React from 'react';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import { SWRConfig } from 'swr';
@ -9,29 +9,27 @@ import './scss/normalized.scss';
// eslint-disable-next-line import/no-unassigned-import
import '@fontsource/roboto-mono';
import AppBoundary from '@/components/AppBoundary';
import AppLoading from '@/components/AppLoading';
import AppContent from '@/components/AppContent';
import ErrorBoundary from '@/components/ErrorBoundary';
import Toast from '@/components/Toast';
import useSwrOptions from '@/hooks/use-swr-options';
import initI18n from '@/i18n/init';
const AppContent = React.lazy(async () => import('@/components/AppContent'));
const ApiResourceDetails = React.lazy(async () => import('@/pages/ApiResourceDetails'));
const ApiResources = React.lazy(async () => import('@/pages/ApiResources'));
const ApplicationDetails = React.lazy(async () => import('@/pages/ApplicationDetails'));
const Applications = React.lazy(async () => import('@/pages/Applications'));
const AuditLogs = React.lazy(async () => import('@/pages/AuditLogs'));
const AuditLogDetails = React.lazy(async () => import('@/pages/AuditLogDetails'));
const Callback = React.lazy(async () => import('@/pages/Callback'));
const ConnectorDetails = React.lazy(async () => import('@/pages/ConnectorDetails'));
const Connectors = React.lazy(async () => import('@/pages/Connectors'));
const Dashboard = React.lazy(async () => import('@/pages/Dashboard'));
const GetStarted = React.lazy(async () => import('@/pages/GetStarted'));
const NotFound = React.lazy(async () => import('@/pages/NotFound'));
const Settings = React.lazy(async () => import('@/pages/Settings'));
const SignInExperience = React.lazy(async () => import('@/pages/SignInExperience'));
const UserDetails = React.lazy(async () => import('@/pages/UserDetails'));
const Users = React.lazy(async () => import('@/pages/Users'));
import ApiResourceDetails from '@/pages/ApiResourceDetails';
import ApiResources from '@/pages/ApiResources';
import ApplicationDetails from '@/pages/ApplicationDetails';
import Applications from '@/pages/Applications';
import AuditLogDetails from '@/pages/AuditLogDetails';
import AuditLogs from '@/pages/AuditLogs';
import Callback from '@/pages/Callback';
import ConnectorDetails from '@/pages/ConnectorDetails';
import Connectors from '@/pages/Connectors';
import Dashboard from '@/pages/Dashboard';
import GetStarted from '@/pages/GetStarted';
import NotFound from '@/pages/NotFound';
import Settings from '@/pages/Settings';
import SignInExperience from '@/pages/SignInExperience';
import UserDetails from '@/pages/UserDetails';
import Users from '@/pages/Users';
void initI18n();
@ -43,49 +41,47 @@ const Main = () => {
<SWRConfig value={swrOptions}>
<AppBoundary>
<Toast />
<Suspense fallback={<AppLoading />}>
<Routes>
<Route path="callback" element={<Callback />} />
{/* TODO: add register route */}
<Route path="register" element={<div>register</div>} />
<Route element={<AppContent />}>
<Route path="*" element={<NotFound />} />
<Route path="get-started" element={<GetStarted />} />
<Route path="applications">
<Route index element={<Applications />} />
<Route path=":id">
<Route index element={<Navigate to="settings" />} />
<Route path="settings" element={<ApplicationDetails />} />
<Route path="advanced-settings" element={<ApplicationDetails />} />
</Route>
<Routes>
<Route path="callback" element={<Callback />} />
{/* TODO: add register route */}
<Route path="register" element={<div>register</div>} />
<Route element={<AppContent />}>
<Route path="*" element={<NotFound />} />
<Route path="get-started" element={<GetStarted />} />
<Route path="applications">
<Route index element={<Applications />} />
<Route path=":id">
<Route index element={<Navigate to="settings" />} />
<Route path="settings" element={<ApplicationDetails />} />
<Route path="advanced-settings" element={<ApplicationDetails />} />
</Route>
<Route path="api-resources">
<Route index element={<ApiResources />} />
<Route path=":id" element={<ApiResourceDetails />} />
</Route>
<Route path="connectors">
<Route index element={<Connectors />} />
<Route path="social" element={<Connectors />} />
<Route path=":connectorId" element={<ConnectorDetails />} />
</Route>
<Route path="users">
<Route index element={<Users />} />
<Route path=":id" element={<UserDetails />} />
<Route path=":id/logs" element={<UserDetails />} />
</Route>
<Route path="sign-in-experience">
<Route index element={<Navigate to="experience" />} />
<Route path=":tab" element={<SignInExperience />} />
</Route>
<Route path="settings" element={<Settings />} />
<Route path="audit-logs">
<Route index element={<AuditLogs />} />
<Route path=":logId" element={<AuditLogDetails />} />
</Route>
<Route path="dashboard" element={<Dashboard />} />
</Route>
</Routes>
</Suspense>
<Route path="api-resources">
<Route index element={<ApiResources />} />
<Route path=":id" element={<ApiResourceDetails />} />
</Route>
<Route path="connectors">
<Route index element={<Connectors />} />
<Route path="social" element={<Connectors />} />
<Route path=":connectorId" element={<ConnectorDetails />} />
</Route>
<Route path="users">
<Route index element={<Users />} />
<Route path=":id" element={<UserDetails />} />
<Route path=":id/logs" element={<UserDetails />} />
</Route>
<Route path="sign-in-experience">
<Route index element={<Navigate to="experience" />} />
<Route path=":tab" element={<SignInExperience />} />
</Route>
<Route path="settings" element={<Settings />} />
<Route path="audit-logs">
<Route index element={<AuditLogs />} />
<Route path=":logId" element={<AuditLogDetails />} />
</Route>
<Route path="dashboard" element={<Dashboard />} />
</Route>
</Routes>
</AppBoundary>
</SWRConfig>
</ErrorBoundary>