2026-06-01 18:48:12 +00:00
|
|
|
// apps/web/src/routes/app-routes.tsx
|
2026-03-07 18:27:23 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
import { Navigate, createBrowserRouter } from "react-router-dom";
|
|
|
|
|
|
|
|
|
|
import { buildModuleRoutes } from "@/components/module-routes";
|
2026-08-06 11:03:48 +00:00
|
|
|
import {
|
|
|
|
|
AppFullscreenLayout,
|
|
|
|
|
AppFullscreenLayoutFrame,
|
|
|
|
|
AppSidebarLayout,
|
|
|
|
|
AppSidebarLayoutFrame,
|
|
|
|
|
AuthLayout,
|
|
|
|
|
AuthLayoutFrame,
|
|
|
|
|
} from "@/layout";
|
2026-08-10 22:01:33 +00:00
|
|
|
import { UiKitPage } from "@/development/ui-kit";
|
2026-08-13 09:04:57 +00:00
|
|
|
import { HomePage } from "@/home";
|
2026-04-12 10:07:15 +00:00
|
|
|
import ShadcnShowcasePage from "@/pages/shadcn-ui-page";
|
2026-08-12 11:31:31 +00:00
|
|
|
import { buildSettingsRoute } from "@/settings";
|
2026-04-12 10:07:15 +00:00
|
|
|
import TailwindV4ShowcasePage from "@/pages/tailwindcss-page";
|
2026-03-07 18:27:23 +00:00
|
|
|
|
2026-08-06 11:03:48 +00:00
|
|
|
import { RouteErrorPage, StaticRouteErrorPage } from "../pages";
|
2026-06-01 18:48:12 +00:00
|
|
|
import { modules } from "../register-modules";
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-08-06 11:03:48 +00:00
|
|
|
const AuthRouteErrorElement = () => (
|
|
|
|
|
<AuthLayoutFrame>
|
|
|
|
|
<RouteErrorPage />
|
|
|
|
|
</AuthLayoutFrame>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const AppFullscreenRouteErrorElement = () => (
|
|
|
|
|
<AppFullscreenLayoutFrame>
|
|
|
|
|
<RouteErrorPage />
|
|
|
|
|
</AppFullscreenLayoutFrame>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const AppSidebarRouteErrorElement = () => (
|
|
|
|
|
<AppSidebarLayoutFrame>
|
|
|
|
|
<RouteErrorPage />
|
|
|
|
|
</AppSidebarLayoutFrame>
|
|
|
|
|
);
|
|
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
export const getAppRouter = () => {
|
|
|
|
|
const params = {
|
|
|
|
|
...import.meta.env,
|
2025-05-28 14:21:09 +00:00
|
|
|
};
|
|
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
const authRoutes = buildModuleRoutes({
|
|
|
|
|
modules,
|
|
|
|
|
params,
|
|
|
|
|
layout: "auth",
|
|
|
|
|
});
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
const appSidebarRoutes = buildModuleRoutes({
|
|
|
|
|
modules,
|
|
|
|
|
params,
|
2026-08-12 11:31:31 +00:00
|
|
|
excludePathPrefix: "settings",
|
2026-06-02 16:40:23 +00:00
|
|
|
layout: "app-sidebar",
|
|
|
|
|
});
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
const appFullscreenRoutes = buildModuleRoutes({
|
|
|
|
|
modules,
|
|
|
|
|
params,
|
|
|
|
|
layout: "app-fullscreen",
|
|
|
|
|
});
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-08-10 22:01:33 +00:00
|
|
|
const developmentRoutes = import.meta.env.DEV
|
|
|
|
|
? [
|
|
|
|
|
{
|
|
|
|
|
path: "development/ui-kit",
|
|
|
|
|
element: <UiKitPage />,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
: [];
|
|
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
const appRoutes = createBrowserRouter([
|
|
|
|
|
{
|
|
|
|
|
path: "/",
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
index: true,
|
2026-08-13 09:04:57 +00:00
|
|
|
element: <Navigate replace to="/dashboard" />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
{
|
|
|
|
|
element: <AuthLayout />,
|
2026-08-06 11:03:48 +00:00
|
|
|
errorElement: <AuthRouteErrorElement />,
|
2026-07-05 11:43:13 +00:00
|
|
|
children: authRoutes,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
path: "auth",
|
2026-06-02 16:40:23 +00:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
index: true,
|
2026-07-05 11:43:13 +00:00
|
|
|
element: <Navigate replace to="/login" />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: "*",
|
|
|
|
|
element: <Navigate replace to="/login" />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2025-05-28 14:21:09 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
{
|
|
|
|
|
element: <AppFullscreenLayout />,
|
2026-08-06 11:03:48 +00:00
|
|
|
errorElement: <AppFullscreenRouteErrorElement />,
|
2026-06-02 16:40:23 +00:00
|
|
|
children: appFullscreenRoutes,
|
|
|
|
|
},
|
2026-06-01 18:48:12 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
{
|
|
|
|
|
element: <AppSidebarLayout />,
|
2026-08-06 11:03:48 +00:00
|
|
|
errorElement: <AppSidebarRouteErrorElement />,
|
2026-06-02 16:40:23 +00:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: "shadcnui",
|
|
|
|
|
element: <ShadcnShowcasePage />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: "tailwindcss4",
|
|
|
|
|
element: <TailwindV4ShowcasePage />,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: "dashboard",
|
2026-08-13 09:04:57 +00:00
|
|
|
element: <HomePage />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: "catalog",
|
2026-08-06 11:03:48 +00:00
|
|
|
element: <StaticRouteErrorPage variant="notFound" />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: "quotes",
|
2026-08-06 11:03:48 +00:00
|
|
|
element: <StaticRouteErrorPage variant="notFound" />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
2026-08-12 11:31:31 +00:00
|
|
|
buildSettingsRoute({
|
|
|
|
|
modules,
|
|
|
|
|
params,
|
|
|
|
|
}),
|
2026-08-10 22:01:33 +00:00
|
|
|
...developmentRoutes,
|
2025-08-24 10:14:20 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
...appSidebarRoutes,
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-04-12 10:07:15 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
{
|
|
|
|
|
path: "*",
|
2026-08-06 11:03:48 +00:00
|
|
|
element: <StaticRouteErrorPage variant="notFound" />,
|
2026-06-02 16:40:23 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
]);
|
2026-06-01 18:48:12 +00:00
|
|
|
|
2026-06-02 16:40:23 +00:00
|
|
|
return appRoutes;
|
2025-05-28 14:21:09 +00:00
|
|
|
};
|