Skip to content

Commit

Permalink
setup routes for leoo and lece pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijeinath committed Dec 14, 2023
1 parent b4f0d5e commit 95da2dd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/app/app.routing.ts
Expand Up @@ -45,7 +45,11 @@ const appRoutes: Routes = [
component: CorrespondenceComponent,
},
{
path: 'lece-leoo/:project',
path: 'leooIVA_IV_intro',
component: LeceLeooComponent
},
{
path: 'lece_intro',
component: LeceLeooComponent
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/biography/biography.component.html
Expand Up @@ -267,13 +267,13 @@ <h2>Additional</h2>
</mat-form-field>
</p>
<p>
<mat-card class="intro-card" appearance="outlined" (click)="openPage('lece')">
<mat-card class="intro-card" appearance="outlined" routerLink="/leooIVA_IV_intro">
<mat-card-content>
<mat-card-title>Introduction</mat-card-title>
Leonhardi Euleri Opera Omnia IVA/IV
</mat-card-content>
</mat-card>
<mat-card class="intro-card" appearance="outlined" (click)="openPage('leoo')">
<mat-card class="intro-card" appearance="outlined" routerLink="/lece_intro">
<mat-card-content>
<mat-card-title>Introduction</mat-card-title>
Leonhardi Euleri Commercium Epistolicum
Expand Down
4 changes: 0 additions & 4 deletions src/app/biography/biography.component.ts
Expand Up @@ -459,10 +459,6 @@ export class BiographyComponent implements OnInit, OnDestroy{
);
}

openPage(project: string) {
this._router.navigate(['/lece-leoo/', project], { relativeTo: this._route });
}

ngOnDestroy() {
if (this.navigationSubscription !== undefined) {
this.navigationSubscription.unsubscribe();
Expand Down
6 changes: 3 additions & 3 deletions src/app/lece-leoo/lece-leoo.component.html
Expand Up @@ -11,9 +11,9 @@
</button>
</div>

<div class="main-content" [ngSwitch]="project">
<div class="main-content" [ngSwitch]="url">

<ng-container *ngSwitchCase="'lece'">
<ng-container *ngSwitchCase="'leooIVA_IV_intro'">
<h1>Leonhardi Euleri Opera Omnia IVA/IV</h1>

<div class="row">
Expand All @@ -38,7 +38,7 @@ <h1>Leonhardi Euleri Opera Omnia IVA/IV</h1>
</div>
</ng-container>

<ng-container *ngSwitchCase="'leoo'">
<ng-container *ngSwitchCase="'lece_intro'">
<h1>Leonhardi Euleri Commercium Epistolicum</h1>
<div class="row">
<mat-card class="intro-card" appearance="outlined" routerLink="/introduction/lece/CondorcetTurgot_preface">
Expand Down
10 changes: 5 additions & 5 deletions src/app/lece-leoo/lece-leoo.component.ts
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { ActivatedRoute, UrlSegment } from '@angular/router';
import { Subscription } from 'rxjs';

@Component({
Expand All @@ -10,17 +10,17 @@ import { Subscription } from 'rxjs';
})
export class LeceLeooComponent implements OnInit {
isLoading = true;
project: string;
url: UrlSegment;
navigationSubscription: Subscription;

constructor(public location: Location, private _route: ActivatedRoute) {
this.isLoading = false;
}

ngOnInit() {
this.navigationSubscription = this._route.paramMap.subscribe((params: ParamMap) => {
this.project = params.get('project');
});
this.navigationSubscription = this._route.url.subscribe((url: UrlSegment[]) => {
this.url = url[0];
})
}

ngOnDestroy() {
Expand Down

0 comments on commit 95da2dd

Please sign in to comment.