web: improve file structure, separate routes from outlet

This commit is contained in:
Jens Langhammer
2020-12-01 17:41:27 +01:00
parent e6391b64f0
commit 8c8ff4643a
9 changed files with 103 additions and 85 deletions

14
web/src/routes.ts Normal file
View File

@ -0,0 +1,14 @@
import { html } from "lit-html";
import { Route, SLUG_REGEX } from "./pages/router/Route";
export const ROUTES: Route[] = [
// Prevent infinite Shell loops
new Route(new RegExp("^/$")).redirect("/library/"),
new Route(new RegExp("^#.*")).redirect("/library/"),
new Route(new RegExp("^/library/$"), html`<pb-library></pb-library>`),
new Route(new RegExp("^/administration/overview-ng/$"), html`<pb-admin-overview></pb-admin-overview>`),
new Route(new RegExp("^/applications/$"), html`<pb-application-list></pb-application-list>`),
new Route(new RegExp(`^/applications/(?<slug>${SLUG_REGEX})/$`)).then((args) => {
return html`<pb-application-view .args=${args}></pb-application-view>`;
}),
];