2022-05-17 08:37:30 -05:00
|
|
|
import { LogtoProvider } from '@logto/react';
|
|
|
|
import React from 'react';
|
|
|
|
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
|
|
|
import { SWRConfig } from 'swr';
|
2022-02-27 21:35:14 -05:00
|
|
|
import './scss/normalized.scss';
|
2022-05-14 07:51:55 -05:00
|
|
|
// eslint-disable-next-line import/no-unassigned-import
|
|
|
|
import '@fontsource/roboto-mono';
|
2022-03-04 04:26:34 -05:00
|
|
|
|
2022-03-03 02:15:33 -05:00
|
|
|
import AppContent from './components/AppContent';
|
2022-05-05 00:24:01 -05:00
|
|
|
import ErrorBoundary from './components/ErrorBoundary';
|
2022-03-09 23:52:56 -05:00
|
|
|
import Toast from './components/Toast';
|
2022-05-17 08:37:30 -05:00
|
|
|
import { logtoApiResource } from './consts';
|
2022-03-16 02:34:03 -05:00
|
|
|
import useSwrFetcher from './hooks/use-swr-fetcher';
|
2022-02-28 09:18:01 -05:00
|
|
|
import initI18n from './i18n/init';
|
2022-03-09 04:56:50 -05:00
|
|
|
import ApiResourceDetails from './pages/ApiResourceDetails';
|
2022-03-03 04:44:25 -05:00
|
|
|
import ApiResources from './pages/ApiResources';
|
2022-03-08 01:53:49 -05:00
|
|
|
import ApplicationDetails from './pages/ApplicationDetails';
|
2022-03-03 23:47:02 -05:00
|
|
|
import Applications from './pages/Applications';
|
2022-03-15 00:22:07 -05:00
|
|
|
import Callback from './pages/Callback';
|
2022-03-09 02:54:46 -05:00
|
|
|
import ConnectorDetails from './pages/ConnectorDetails';
|
2022-03-07 22:10:46 -05:00
|
|
|
import Connectors from './pages/Connectors';
|
2022-05-09 10:55:25 -05:00
|
|
|
import GetStarted from './pages/GetStarted';
|
2022-03-16 02:49:30 -05:00
|
|
|
import NotFound from './pages/NotFound';
|
2022-04-23 22:46:35 -05:00
|
|
|
import Settings from './pages/Settings';
|
2022-04-12 02:30:43 -05:00
|
|
|
import SignInExperience from './pages/SignInExperience';
|
2022-03-14 23:54:15 -05:00
|
|
|
import UserDetails from './pages/UserDetails';
|
2022-03-14 04:13:24 -05:00
|
|
|
import Users from './pages/Users';
|
2022-05-17 08:37:30 -05:00
|
|
|
import { getBasename } from './utilities/app';
|
2022-03-03 02:44:42 -05:00
|
|
|
|
2022-02-28 09:18:01 -05:00
|
|
|
void initI18n();
|
2022-02-16 02:04:34 -05:00
|
|
|
|
2022-03-03 02:02:30 -05:00
|
|
|
const Main = () => {
|
2022-03-16 02:34:03 -05:00
|
|
|
const fetcher = useSwrFetcher();
|
2022-05-05 05:42:10 -05:00
|
|
|
|
2022-02-27 21:35:14 -05:00
|
|
|
return (
|
2022-05-05 00:24:01 -05:00
|
|
|
<ErrorBoundary>
|
|
|
|
<SWRConfig value={{ fetcher }}>
|
|
|
|
<Toast />
|
|
|
|
<Routes>
|
|
|
|
<Route path="callback" element={<Callback />} />
|
|
|
|
<Route element={<AppContent />}>
|
|
|
|
<Route path="*" element={<NotFound />} />
|
2022-05-09 10:55:25 -05:00
|
|
|
<Route path="get-started" element={<GetStarted />} />
|
2022-05-05 00:24:01 -05:00
|
|
|
<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>
|
2022-03-11 06:04:27 -05:00
|
|
|
</Route>
|
2022-05-05 00:24:01 -05:00
|
|
|
<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>
|
|
|
|
<Route path="sign-in-experience">
|
|
|
|
<Route index element={<Navigate to="experience" />} />
|
|
|
|
<Route path=":tab" element={<SignInExperience />} />
|
|
|
|
</Route>
|
|
|
|
<Route path="settings" element={<Settings />} />
|
2022-03-11 06:04:27 -05:00
|
|
|
</Route>
|
2022-05-05 00:24:01 -05:00
|
|
|
</Routes>
|
|
|
|
</SWRConfig>
|
|
|
|
</ErrorBoundary>
|
2022-02-27 21:35:14 -05:00
|
|
|
);
|
2022-02-16 02:04:34 -05:00
|
|
|
};
|
2022-03-03 02:02:30 -05:00
|
|
|
|
|
|
|
const App = () => (
|
2022-05-17 08:37:30 -05:00
|
|
|
<BrowserRouter basename={getBasename()}>
|
2022-03-16 02:34:03 -05:00
|
|
|
<LogtoProvider
|
2022-05-05 08:01:58 -05:00
|
|
|
config={{ endpoint: window.location.origin, appId: 'foo', resources: [logtoApiResource] }}
|
2022-03-16 02:34:03 -05:00
|
|
|
>
|
|
|
|
<Main />
|
|
|
|
</LogtoProvider>
|
2022-03-03 02:02:30 -05:00
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|