70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
|
|
import { createBrowserRouter, Navigate } from 'react-router';
|
||
|
|
|
||
|
|
import { AuthGuard } from '@/components/AuthGuard';
|
||
|
|
import {
|
||
|
|
AppearanceSettingsPage,
|
||
|
|
AppLayout,
|
||
|
|
IndexRedirect,
|
||
|
|
GuildView,
|
||
|
|
InstanceSettingsPage,
|
||
|
|
LoginPage,
|
||
|
|
NoGuildView,
|
||
|
|
OnboardingPage,
|
||
|
|
ProfileSettingsPage,
|
||
|
|
RegisterPage,
|
||
|
|
SecuritySettingsPage,
|
||
|
|
SettingsLayout,
|
||
|
|
StatusPage,
|
||
|
|
} from '@/pages/lazyPages';
|
||
|
|
|
||
|
|
/** Таблица маршрутов: публичные страницы, защищённые и настройки. */
|
||
|
|
export const routes = [
|
||
|
|
{
|
||
|
|
path: '/',
|
||
|
|
children: [
|
||
|
|
{ index: true, element: <IndexRedirect /> },
|
||
|
|
{ path: 'login', element: <LoginPage /> },
|
||
|
|
{ path: 'register', element: <RegisterPage /> },
|
||
|
|
{ path: 'status', element: <StatusPage /> },
|
||
|
|
{
|
||
|
|
element: <AuthGuard allowIncompleteOnboarding />,
|
||
|
|
children: [{ path: 'onboarding', element: <OnboardingPage /> }],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
element: <AuthGuard />,
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
path: 'app',
|
||
|
|
element: <AppLayout />,
|
||
|
|
children: [
|
||
|
|
{ index: true, element: <Navigate to="empty" replace /> },
|
||
|
|
{ path: 'empty', element: <NoGuildView /> },
|
||
|
|
{ path: ':guildId', element: <GuildView /> },
|
||
|
|
{ path: ':guildId/:channelId', element: <GuildView /> },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
element: <AuthGuard allowIncompleteOnboarding />,
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
path: 'settings',
|
||
|
|
element: <SettingsLayout />,
|
||
|
|
children: [
|
||
|
|
{ index: true, element: <Navigate to="profile" replace /> },
|
||
|
|
{ path: 'profile', element: <ProfileSettingsPage /> },
|
||
|
|
{ path: 'security', element: <SecuritySettingsPage /> },
|
||
|
|
{ path: 'appearance', element: <AppearanceSettingsPage /> },
|
||
|
|
{ path: 'instance', element: <InstanceSettingsPage /> },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{ path: '*', element: <Navigate to="/" replace /> },
|
||
|
|
],
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
export const router = createBrowserRouter(routes);
|