Skip to content

Commit

Permalink
create lece-leoo component
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijeinath committed Dec 10, 2023
1 parent 36015d6 commit 184d657
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Expand Up @@ -64,6 +64,7 @@ import { TeiLinkDirective } from './directives/tei-link.directive';
import { CommentComponent } from './resource/comment/comment.component';
import { HttpClientModule } from '@angular/common/http';
import { BiographyComponent } from './biography/biography.component';
import { LeceLeooComponent } from './lece-leoo/lece-leoo.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -102,6 +103,7 @@ import { BiographyComponent } from './biography/biography.component';
CommentComponent,
PublishedLetterComponent,
BiographyComponent,
LeceLeooComponent,
],
imports: [
AppRouting,
Expand Down
5 changes: 5 additions & 0 deletions src/app/app.routing.ts
Expand Up @@ -24,6 +24,7 @@ import { TranscriptionComponent } from './resource/transcription/transcription.c
import { ManuscriptEntryComponent } from './resource/manuscript-entry/manuscript-entry.component';
import { CommentComponent } from './resource/comment/comment.component';
import { BiographyComponent } from './biography/biography.component';
import { LeceLeooComponent } from './lece-leoo/lece-leoo.component';


const appRoutes: Routes = [
Expand All @@ -43,6 +44,10 @@ const appRoutes: Routes = [
path: 'correspondence/:project',
component: CorrespondenceComponent,
},
{
path: 'lece-leoo/:project',
component: LeceLeooComponent
},
{
path: 'resource/:id',
component: ResourceComponent
Expand Down
16 changes: 15 additions & 1 deletion src/app/biography/biography.component.html
Expand Up @@ -2,7 +2,7 @@

<dsp-progress-indicator *ngIf="isLoading" [color]="'#D88958'"></dsp-progress-indicator>

<div *ngIf="!isLoading && props">
<div *ngIf="!isLoading">

<div class="sidebar">
<button mat-stroked-button class="previousBtn" (click)="location.back()">
Expand Down Expand Up @@ -266,6 +266,20 @@ <h2>Additional</h2>
</mat-select>
</mat-form-field>
</p>
<p>
<mat-card class="intro-card" appearance="outlined" (click)="openPage('lece')">
<mat-card-content>
<mat-card-title>Introduction</mat-card-title>
Leonhard Euler's correspondence with Goldbach
</mat-card-content>
</mat-card>
<mat-card class="intro-card" appearance="outlined" (click)="openPage('leoo')">
<mat-card-content>
<mat-card-title>Introduction</mat-card-title>
Correspondance d'Euler avec Condorcet et Turgot
</mat-card-content>
</mat-card>
</p>
</section>
</ng-container>

Expand Down
6 changes: 4 additions & 2 deletions src/app/biography/biography.component.ts
Expand Up @@ -74,7 +74,6 @@ class CorrespondenceGroup {
})
export class BiographyComponent implements OnInit, OnDestroy{
isLoading = true;
props: any;
name: string;
navigationSubscription: Subscription;

Expand All @@ -94,7 +93,6 @@ export class BiographyComponent implements OnInit, OnDestroy{
private _beol: BeolService
) {
this.isLoading = false;
this.props = {};
}

ngOnInit() {
Expand Down Expand Up @@ -461,6 +459,10 @@ 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
83 changes: 83 additions & 0 deletions src/app/lece-leoo/lece-leoo.component.html
@@ -0,0 +1,83 @@
<div class="full-size scroll-y-only">

<dsp-progress-indicator *ngIf="isLoading" [color]="'#D88958'"></dsp-progress-indicator>

<div *ngIf="!isLoading">

<div class="sidebar">
<button mat-stroked-button class="previousBtn" (click)="location.back()">
<mat-icon>arrow_back</mat-icon>
Previous
</button>
</div>

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

<ng-container *ngSwitchCase="'lece'">
<h1>[Title]</h1>
<div>
<div fxFlex fxLayout="row wrap" fxLayout.sm="column" fxlayout.xs="column" fxFlexFill>
<div fxFlex routerLink="introduction/leoo/goldbach_preface">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Preface</mat-card-content>
</mat-card>
</div>
<div fxFlex routerLink="introduction/leoo/goldbach_abbreviations">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>List of Abbreviations</mat-card-content>
</mat-card>
</div>
</div>
</div>

<div>
<div fxFlex fxLayout="row wrap" fxLayout.sm="column" fxlayout.xs="column" fxFlexFill>
<div fxFlex routerLink="introduction/leoo/goldbach_introduction_1">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Historical and biographical setting</mat-card-content>
</mat-card>
</div>
<div fxFlex routerLink="introduction/leoo/goldbach_introduction_2">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Main subjects of the correspondence</mat-card-content>
</mat-card>
</div>
<div fxFlex routerLink="introduction/leoo/goldbach_introduction_3.1">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Editing the Euler-Goldbach correspondence</mat-card-content>
</mat-card>
</div>
</div>
</div>
</ng-container>

<ng-container *ngSwitchCase="'leoo'">
<h1>[Title]</h1>
<div class="container">
<div fxFlex fxLayout="row wrap" fxLayout.sm="column" fxlayout.xs="column" fxFlexFill>
<div fxFlex routerLink="introduction/lece/CondorcetTurgot_preface">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Préface</mat-card-content>
</mat-card>
</div>
</div>
</div>
<div class="container">
<div fxFlex fxLayout="row wrap" fxLayout.sm="column" fxlayout.xs="column" fxFlexFill>
<div fxFlex routerLink="introduction/lece/CondorcetMJA_Introduction">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Correspondance d'Euler avec Condorcet</mat-card-content>
</mat-card>
</div>
<div fxFlex routerLink="introduction/lece/Turgot_Introduction">
<mat-card class="intro-card" appearance="outlined">
<mat-card-content>Correspondance d'Euler avec Turgot</mat-card-content>
</mat-card>
</div>
</div>
</div>
</ng-container>

</div>
</div>
</div>
Empty file.
40 changes: 40 additions & 0 deletions src/app/lece-leoo/lece-leoo.component.spec.ts
@@ -0,0 +1,40 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { LeceLeooComponent } from './lece-leoo.component';
import { RouterTestingModule } from '@angular/router/testing';
import { BeolService } from '../services/beol.service';
import { AppInitService } from '../dsp-ui-lib/core';

describe('LeceLeooComponent', () => {
let component: LeceLeooComponent;
let fixture: ComponentFixture<LeceLeooComponent>;

beforeEach(waitForAsync(() => {
const appInitServiceMock = {
config: {
ontologyIRI: 'http://0.0.0.0:3333'
}
};

const beolServiceSpy = jasmine.createSpyObj('BeolService', ['getEntriesForManuscript']); // see https://angular.io/guide/testing#angular-testbed

TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
declarations: [LeceLeooComponent],
providers: [
{ provide: BeolService, useValue: beolServiceSpy },
{ provide: AppInitService, useValue: appInitServiceMock }
]
})
.compileComponents();

fixture = TestBed.createComponent(LeceLeooComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
});
31 changes: 31 additions & 0 deletions src/app/lece-leoo/lece-leoo.component.ts
@@ -0,0 +1,31 @@
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Subscription } from 'rxjs';

@Component({
selector: 'app-lece-leoo',
templateUrl: './lece-leoo.component.html',
styleUrls: ['./lece-leoo.component.scss']
})
export class LeceLeooComponent implements OnInit {
isLoading = true;
project: string;
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');
});
}

ngOnDestroy() {
if (this.navigationSubscription !== undefined) {
this.navigationSubscription.unsubscribe();
}
}
}

0 comments on commit 184d657

Please sign in to comment.