94 lines
1.7 KiB
TypeScript
94 lines
1.7 KiB
TypeScript
import { NgModule } from "@angular/core";
|
|
import { Routes, RouterModule, UrlSegment, UrlMatchResult } from "@angular/router";
|
|
import { ArticleComponent } from "./article/article.component";
|
|
import { RouterEmptyComponent } from "./gui/router-empty/router-empty.component";
|
|
import { NavigationLink } from "./symbols/NavigationLink";
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: "",
|
|
component: ArticleComponent,
|
|
data: {
|
|
resolveUrlPaths: false
|
|
},
|
|
},
|
|
{
|
|
matcher: pageMatcher,
|
|
component: RouterEmptyComponent,
|
|
children: [{
|
|
path: "**",
|
|
data: {
|
|
resolveUrlPaths: false
|
|
},
|
|
component: ArticleComponent
|
|
}]
|
|
},
|
|
{
|
|
matcher: fwlinkMatcher,
|
|
component: RouterEmptyComponent,
|
|
children: [{
|
|
path: "**",
|
|
data: {
|
|
resolveUrlPaths: true
|
|
},
|
|
component: ArticleComponent
|
|
}]
|
|
},
|
|
{
|
|
path: "**",
|
|
data: {
|
|
notFound: true
|
|
},
|
|
component: ArticleComponent
|
|
}
|
|
];
|
|
|
|
export const navigationLinks: NavigationLink[] = [
|
|
{
|
|
text: "Home",
|
|
address: "/"
|
|
},
|
|
{
|
|
text: "WarpPI",
|
|
address: "/page/WarpPI"
|
|
},
|
|
{
|
|
text: "Midi23D",
|
|
address: "/page/software/Midi23D"
|
|
},
|
|
{
|
|
text: "Contacts",
|
|
address: "/page/contacts"
|
|
},
|
|
{
|
|
text: "Github ↗",
|
|
address: "https://github.com/Cavallium",
|
|
external: true,
|
|
newtab: true
|
|
},
|
|
];
|
|
|
|
export function pageMatcher(url: UrlSegment[]): UrlMatchResult {
|
|
if (url.length > 1) {
|
|
if (url[0].path === "page") {
|
|
return { consumed: [url[0]] };
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function fwlinkMatcher(url: UrlSegment[]): UrlMatchResult {
|
|
if (url.length === 1) {
|
|
if (url[0].path === "fwlink.php") {
|
|
return { consumed: url };
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@NgModule({
|
|
imports: [RouterModule.forRoot(routes, {scrollPositionRestoration: "enabled"})],
|
|
exports: [RouterModule]
|
|
})
|
|
export class AppRoutingModule { }
|