generated from Dicken/dickendock
140 lines
3.5 KiB
TypeScript
140 lines
3.5 KiB
TypeScript
import { Outlet, createRootRoute, createRoute, createRouter, redirect } from "@tanstack/react-router";
|
|
import { HomePage } from "./routes/HomePage.js";
|
|
import { SearchRedirectPage } from "./routes/SearchRedirectPage.js";
|
|
import { AdminLayout } from "./routes/admin/AdminLayout.js";
|
|
import { DashboardPage } from "./routes/admin/DashboardPage.js";
|
|
import { DevicesPage } from "./routes/admin/DevicesPage.js";
|
|
import { ServicesPage } from "./routes/admin/ServicesPage.js";
|
|
import { BookmarksPage } from "./routes/admin/BookmarksPage.js";
|
|
import { CategoriesPage } from "./routes/admin/CategoriesPage.js";
|
|
import { ScannerPage } from "./routes/admin/ScannerPage.js";
|
|
import { ApisPage } from "./routes/admin/ApisPage.js";
|
|
import { ReadLaterPage } from "./routes/admin/ReadLaterPage.js";
|
|
import { PluginsPage } from "./routes/admin/PluginsPage.js";
|
|
import { SettingsPage } from "./routes/admin/SettingsPage.js";
|
|
import { LogsPage } from "./routes/admin/LogsPage.js";
|
|
|
|
const rootRoute = createRootRoute({
|
|
component: () => <Outlet />,
|
|
});
|
|
|
|
const indexRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: "/",
|
|
component: HomePage,
|
|
});
|
|
|
|
const searchRedirectRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: "/search",
|
|
component: SearchRedirectPage,
|
|
});
|
|
|
|
const adminRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: "/admin",
|
|
component: AdminLayout,
|
|
});
|
|
|
|
// /admin ohne weiteren Pfad -> Dashboard
|
|
const adminIndexRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/",
|
|
loader: () => {
|
|
throw redirect({ to: "/admin/dashboard" });
|
|
},
|
|
});
|
|
|
|
const adminDashboardRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/dashboard",
|
|
component: DashboardPage,
|
|
});
|
|
|
|
const adminDevicesRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/devices",
|
|
component: DevicesPage,
|
|
});
|
|
|
|
const adminServicesRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/services",
|
|
component: ServicesPage,
|
|
});
|
|
|
|
const adminBookmarksRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/bookmarks",
|
|
component: BookmarksPage,
|
|
});
|
|
|
|
const adminCategoriesRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/categories",
|
|
component: CategoriesPage,
|
|
});
|
|
|
|
const adminScannerRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/scanner",
|
|
component: ScannerPage,
|
|
});
|
|
|
|
const adminApisRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/apis",
|
|
component: ApisPage,
|
|
});
|
|
|
|
const adminReadLaterRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/read-later",
|
|
component: ReadLaterPage,
|
|
});
|
|
|
|
const adminPluginsRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/plugins",
|
|
component: PluginsPage,
|
|
});
|
|
|
|
const adminSettingsRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/settings",
|
|
component: SettingsPage,
|
|
});
|
|
|
|
const adminLogsRoute = createRoute({
|
|
getParentRoute: () => adminRoute,
|
|
path: "/logs",
|
|
component: LogsPage,
|
|
});
|
|
|
|
const routeTree = rootRoute.addChildren([
|
|
indexRoute,
|
|
searchRedirectRoute,
|
|
adminRoute.addChildren([
|
|
adminIndexRoute,
|
|
adminDashboardRoute,
|
|
adminDevicesRoute,
|
|
adminServicesRoute,
|
|
adminBookmarksRoute,
|
|
adminCategoriesRoute,
|
|
adminScannerRoute,
|
|
adminApisRoute,
|
|
adminReadLaterRoute,
|
|
adminPluginsRoute,
|
|
adminSettingsRoute,
|
|
adminLogsRoute,
|
|
]),
|
|
]);
|
|
|
|
export const router = createRouter({ routeTree });
|
|
|
|
declare module "@tanstack/react-router" {
|
|
interface Register {
|
|
router: typeof router;
|
|
}
|
|
}
|