125 lines
4.1 KiB
TypeScript
125 lines
4.1 KiB
TypeScript
import React from 'react';
|
|
import { createBrowserRouter } from 'react-router-dom';
|
|
import { AppShell } from '../layouts/AppShell';
|
|
import {
|
|
DashboardPage,
|
|
OperationsPage,
|
|
CrmPage,
|
|
SalesPage,
|
|
InventoryPage,
|
|
FinancePage,
|
|
EmployeesPage,
|
|
CommunicationsPage,
|
|
HelpDeskPage,
|
|
TasksPage,
|
|
CmsPage,
|
|
MarketingPage,
|
|
AnalyticsPage,
|
|
AutomationPage,
|
|
AiPage,
|
|
AppsPage,
|
|
SettingsPage,
|
|
EntityCatalogPage,
|
|
FieldBuilderPage,
|
|
FormBuilderPage,
|
|
CardLayoutBuilderPage,
|
|
ViewBuilderPage,
|
|
CustomEntityRoutePage,
|
|
ForbiddenPage,
|
|
NotFoundPage,
|
|
} from '../../pages';
|
|
import { ErrorBoundary } from '../../shared/ui/ErrorBoundary';
|
|
import { ControlCenterShell } from '../../features/control-center/components/ControlCenterShell';
|
|
import { ControlRouteGuard } from '../../features/control-center/components/ControlRouteGuard';
|
|
import {
|
|
OverviewPage,
|
|
OrganizationsPage,
|
|
BillingPage,
|
|
ModulesPage,
|
|
InstallationsPage,
|
|
InfrastructurePage,
|
|
AnnouncementsPage,
|
|
IncidentsPage,
|
|
AuditPage,
|
|
ControlForbiddenPage,
|
|
ControlAccessGatePage,
|
|
} from '../../features/control-center/pages';
|
|
|
|
export const router = createBrowserRouter([
|
|
{
|
|
path: '/control/gate',
|
|
element: <ControlAccessGatePage />,
|
|
},
|
|
{
|
|
path: '/control/403',
|
|
element: <ControlForbiddenPage />,
|
|
},
|
|
{
|
|
path: '/control',
|
|
element: (
|
|
<ControlRouteGuard>
|
|
<ControlCenterShell />
|
|
</ControlRouteGuard>
|
|
),
|
|
errorElement: (
|
|
<div className="p-8 bg-[#07130e] text-zinc-100 min-h-screen">
|
|
<ErrorBoundary scope="Krona Control Center">
|
|
<ControlForbiddenPage />
|
|
</ErrorBoundary>
|
|
</div>
|
|
),
|
|
children: [
|
|
{ index: true, element: <OverviewPage /> },
|
|
{ path: 'organizations', element: <OrganizationsPage /> },
|
|
{ path: 'billing', element: <BillingPage /> },
|
|
{ path: 'modules', element: <ModulesPage /> },
|
|
{ path: 'installations', element: <InstallationsPage /> },
|
|
{ path: 'infrastructure', element: <InfrastructurePage /> },
|
|
{ path: 'announcements', element: <AnnouncementsPage /> },
|
|
{ path: 'incidents', element: <IncidentsPage /> },
|
|
{ path: 'audit', element: <AuditPage /> },
|
|
{ path: '*', element: <NotFoundPage /> },
|
|
],
|
|
},
|
|
{
|
|
path: '/',
|
|
element: <AppShell />,
|
|
errorElement: (
|
|
<div className="p-8">
|
|
<ErrorBoundary scope="Маршрутизатор приложения">
|
|
<NotFoundPage />
|
|
</ErrorBoundary>
|
|
</div>
|
|
),
|
|
children: [
|
|
{ index: true, element: <DashboardPage /> },
|
|
{ path: 'operations/*', element: <OperationsPage /> },
|
|
{ path: 'crm/*', element: <CrmPage /> },
|
|
{ path: 'sales/*', element: <SalesPage /> },
|
|
{ path: 'inventory/*', element: <InventoryPage /> },
|
|
{ path: 'finance/*', element: <FinancePage /> },
|
|
{ path: 'employees/*', element: <EmployeesPage /> },
|
|
{ path: 'communications/*', element: <CommunicationsPage /> },
|
|
{ path: 'helpdesk/*', element: <HelpDeskPage /> },
|
|
{ path: 'tasks/*', element: <TasksPage /> },
|
|
{ path: 'cms/*', element: <CmsPage /> },
|
|
{ path: 'marketing/*', element: <MarketingPage /> },
|
|
{ path: 'analytics/*', element: <AnalyticsPage /> },
|
|
{ path: 'automation/*', element: <AutomationPage /> },
|
|
{ path: 'ai/*', element: <AiPage /> },
|
|
{ path: 'apps/*', element: <AppsPage /> },
|
|
{ path: 'settings/entities', element: <EntityCatalogPage /> },
|
|
{ path: 'settings/entities/:entityCode/fields', element: <FieldBuilderPage /> },
|
|
{ path: 'settings/entities/:entityCode/forms', element: <FormBuilderPage /> },
|
|
{ path: 'settings/entities/:entityCode/card', element: <CardLayoutBuilderPage /> },
|
|
{ path: 'settings/entities/:entityCode/views', element: <ViewBuilderPage /> },
|
|
{ path: 'settings/*', element: <SettingsPage /> },
|
|
{ path: 'entities/:entityCode', element: <CustomEntityRoutePage /> },
|
|
{ path: 'entities/:entityCode/:recordId', element: <CustomEntityRoutePage /> },
|
|
{ path: 'forbidden', element: <ForbiddenPage /> },
|
|
{ path: '403', element: <ForbiddenPage /> },
|
|
{ path: '*', element: <NotFoundPage /> },
|
|
],
|
|
},
|
|
]);
|
|
|