mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-26 14:58:55 +08:00
45df4568a4
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new admin routes: "auth", "setup", and "notFound" for improved navigation and access within the admin interface. - Introduced a utility for simplified and flexible lazy loading of React components with fallback support. - **Improvements** - Updated routing structure in the admin frontend for clearer route management and enhanced Sentry integration. - Centralized route definitions for easier maintenance and consistency. - Upgraded dependencies to support the latest React Router and React versions. - Enhanced asynchronous handling in setup form navigation. - **Chores** - Updated project references and workspace dependencies for better package management. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
// #region Path Parameter Types
|
|
export interface RouteParamsTypes {
|
|
admin: { settings: { module: { module: string } } };
|
|
}
|
|
// #endregion
|
|
|
|
// #region Absolute Paths
|
|
export const ROUTES = {
|
|
index: '/',
|
|
admin: {
|
|
index: '/admin',
|
|
auth: '/admin/auth',
|
|
setup: '/admin/setup',
|
|
accounts: '/admin/accounts',
|
|
ai: '/admin/ai',
|
|
settings: { index: '/admin/settings', module: '/admin/settings/:module' },
|
|
about: '/admin/about',
|
|
notFound: '/admin/404',
|
|
},
|
|
};
|
|
// #endregion
|
|
|
|
// #region Relative Paths
|
|
export const RELATIVE_ROUTES = {
|
|
index: '/',
|
|
admin: {
|
|
index: 'admin',
|
|
auth: 'auth',
|
|
setup: 'setup',
|
|
accounts: 'accounts',
|
|
ai: 'ai',
|
|
settings: { index: 'settings', module: ':module' },
|
|
about: 'about',
|
|
notFound: '404',
|
|
},
|
|
};
|
|
// #endregion
|
|
|
|
// #region Path Factories
|
|
const home = () => '/';
|
|
const admin = () => '/admin';
|
|
admin.auth = () => '/admin/auth';
|
|
admin.setup = () => '/admin/setup';
|
|
admin.accounts = () => '/admin/accounts';
|
|
admin.ai = () => '/admin/ai';
|
|
const admin_settings = () => '/admin/settings';
|
|
admin_settings.module = (params: { module: string }) =>
|
|
`/admin/settings/${params.module}`;
|
|
admin.settings = admin_settings;
|
|
admin.about = () => '/admin/about';
|
|
admin.notFound = () => '/admin/404';
|
|
export const FACTORIES = { admin, home };
|
|
// #endregion
|