diff --git a/src/app/_models/series.ts b/src/app/_models/series.ts index b54ebf135..78085a077 100644 --- a/src/app/_models/series.ts +++ b/src/app/_models/series.ts @@ -6,5 +6,6 @@ export interface Series { originalName: string; sortName: string; summary: string; + coverImage: string; volumes: Volume[]; } diff --git a/src/app/_models/volume.ts b/src/app/_models/volume.ts index 35f390d4d..77a7629fa 100644 --- a/src/app/_models/volume.ts +++ b/src/app/_models/volume.ts @@ -1,5 +1,6 @@ export interface Volume { id: number; number: string; - files: Array; // In future, we can refactor this to be a type with extra metadata around it -} \ No newline at end of file + files: Array; + coverImage: string; +} diff --git a/src/app/_services/series.service.ts b/src/app/_services/series.service.ts index 4ffd75f2a..c1fc3f188 100644 --- a/src/app/_services/series.service.ts +++ b/src/app/_services/series.service.ts @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { environment } from 'src/environments/environment'; import { Series } from '../_models/series'; +import { Volume } from '../_models/volume'; @Injectable({ providedIn: 'root' @@ -12,7 +13,15 @@ export class SeriesService { constructor(private httpClient: HttpClient) { } - getSeries(libraryId: number) { + getSeriesForLibrary(libraryId: number) { return this.httpClient.get(this.baseUrl + 'library/series?libraryId=' + libraryId); } + + getSeries(seriesId: number) { + return this.httpClient.get(this.baseUrl + 'series/' + seriesId); + } + + getVolumes(seriesId: number) { + return this.httpClient.get(this.baseUrl + 'series/volumes?seriesId=' + seriesId); + } } diff --git a/src/app/library-detail/library-detail.component.html b/src/app/library-detail/library-detail.component.html index 237312e99..15bd6e363 100644 --- a/src/app/library-detail/library-detail.component.html +++ b/src/app/library-detail/library-detail.component.html @@ -1,6 +1,12 @@ -

Title (Manga/Recently Added)

-
-
- +
+

Title (Manga/Recently Added)

+
+
+ +
+ + + Nothing here.... +
\ No newline at end of file diff --git a/src/app/library-detail/library-detail.component.ts b/src/app/library-detail/library-detail.component.ts index 43c3d5460..686726624 100644 --- a/src/app/library-detail/library-detail.component.ts +++ b/src/app/library-detail/library-detail.component.ts @@ -23,7 +23,7 @@ export class LibraryDetailComponent implements OnInit { return; } this.libraryId = parseInt(routeId, 10); - this.seriesService.getSeries(this.libraryId).subscribe(series => { + this.seriesService.getSeriesForLibrary(this.libraryId).subscribe(series => { this.series = series; }); } diff --git a/src/app/series-detail/series-detail.component.html b/src/app/series-detail/series-detail.component.html index 4ad9e0f2b..7154f9845 100644 --- a/src/app/series-detail/series-detail.component.html +++ b/src/app/series-detail/series-detail.component.html @@ -1,20 +1,29 @@ -
+
-
-
- -

title

-
+
+ +
-
-

Title

- - (metadata here) +
+

{{series.name | titlecase}}

+
+ +
+
+ +
+
+

{{series?.summary}}

+
+
+

Volumes

- Volumes here +
+ +
\ No newline at end of file diff --git a/src/app/series-detail/series-detail.component.ts b/src/app/series-detail/series-detail.component.ts index 93df5173a..f0e8a0455 100644 --- a/src/app/series-detail/series-detail.component.ts +++ b/src/app/series-detail/series-detail.component.ts @@ -1,5 +1,8 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; import { Series } from '../_models/series'; +import { Volume } from '../_models/volume'; +import { SeriesService } from '../_services/series.service'; @Component({ selector: 'app-series-detail', @@ -9,10 +12,29 @@ import { Series } from '../_models/series'; export class SeriesDetailComponent implements OnInit { series: Series | undefined; + volumes: Volume[] = []; - constructor() { } + constructor(private route: ActivatedRoute, private seriesService: SeriesService) { } ngOnInit(): void { + + const routeId = this.route.snapshot.paramMap.get('id'); + if (routeId === null) { + console.error('No library id was passed. Redirecting to home'); + //this.router.navigateByUrl('/home'); + return; + } + const seriesId = parseInt(routeId, 10); + this.seriesService.getSeries(seriesId).subscribe(series => { + this.series = series; + this.seriesService.getVolumes(this.series.id).subscribe(volumes => { + this.volumes = volumes; + }); + }); + } + + openVolume(volume: Volume) { + alert('TODO: Let user read Manga'); } } diff --git a/src/app/shared/card-item/card-item.component.html b/src/app/shared/card-item/card-item.component.html index 41523ea92..976a075f8 100644 --- a/src/app/shared/card-item/card-item.component.html +++ b/src/app/shared/card-item/card-item.component.html @@ -1,7 +1,7 @@
{{title}} -
+
{{title}}
diff --git a/src/app/shared/card-item/card-item.component.ts b/src/app/shared/card-item/card-item.component.ts index ec10d3f28..ff41443ee 100644 --- a/src/app/shared/card-item/card-item.component.ts +++ b/src/app/shared/card-item/card-item.component.ts @@ -15,7 +15,7 @@ export class CardItemComponent implements OnInit { @Input() imageUrl = ''; @Input() title = ''; - @Input() actions: CardItemAction[] = []; + @Input() actions: CardItemAction[] = []; // TODO: Create a factory that generates actions based on if admin, etc. for each card type. @Input() entity: any; // This is the entity we are representing. It will be returned if an action is executed. @Output() clicked = new EventEmitter();