Skip to content

Commit

Permalink
fix: navigation in season detail
Browse files Browse the repository at this point in the history
  • Loading branch information
69pmb committed Oct 11, 2023
1 parent aa40704 commit 05d765c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 class="detail-title">
<button
class="btn btn-outline-primary"
(click)="goPrev()"
*ngIf="season.seasonNumber !== 0"
*ngIf="season.seasonNumber !== minSeason"
>
<fa-icon [icon]="faArrowCircleLeft"></fa-icon
>{{ 'season.previous' | translate }}
Expand All @@ -30,7 +30,7 @@ <h1 class="detail-title">
<button
class="btn btn-outline-primary"
(click)="goNext()"
*ngIf="season.seasonNumber + 1 < maxSeason"
*ngIf="season.seasonNumber < maxSeason"
>
{{ 'season.next' | translate
}}<fa-icon [icon]="faArrowCircleRight"></fa-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {TitleService} from '../../../service/title.service';
export class SeasonDetailComponent implements OnInit, OnDestroy {
serieId!: number;
season!: Season;
minSeason!: number;
maxSeason!: number;
serie!: string;
isImagesVisible = false;
Expand All @@ -40,6 +41,7 @@ export class SeasonDetailComponent implements OnInit, OnDestroy {
) {}

ngOnInit(): void {
this.minSeason = +(sessionStorage.getItem('season_min') ?? 0);
this.maxSeason = +(sessionStorage.getItem('season_max') ?? 1);
this.serie = sessionStorage.getItem('serie') ?? '';
this.title.setTitle(this.serie);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class SeasonsComponent implements OnInit, OnChanges {

goToSeasonDetail(season: number): void {
sessionStorage.setItem('serie', this.serie);
sessionStorage.setItem('season_min', '' + this.seasons[0].seasonNumber);
sessionStorage.setItem('season_max', '' + this.seasons.length);
this.router.navigate(['./' + season], {relativeTo: this.route});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class SerieDetailComponent implements OnInit, OnDestroy {

ngOnInit(): void {
sessionStorage.removeItem('serie');
sessionStorage.removeItem('season_min');
sessionStorage.removeItem('season_max');
this.config = new DetailConfig(
true,
Expand Down

0 comments on commit 05d765c

Please sign in to comment.