-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CerealKiller97
committed
Sep 2, 2019
1 parent
c31d8b9
commit 4ce3c47
Showing
17 changed files
with
1,577 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
README.md | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 36 additions & 5 deletions
41
src/app/modules/gaming/components/game-list/game-list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,46 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
import { Router, ActivatedRoute, Params, ParamMap } from '@angular/router'; | ||
import { Subscription, Observable } from 'rxjs'; | ||
import { GamesService } from '@service/games/games.service.ts'; | ||
import { switchMap } from 'rxjs/operators'; | ||
@Component({ | ||
selector: 'app-game-list', | ||
templateUrl: './game-list.component.html', | ||
styleUrls: ['./game-list.component.css'] | ||
}) | ||
export class GameListComponent implements OnInit { | ||
export class GameListComponent implements OnInit, OnDestroy { | ||
private subscriptions: Array<Subscription> = new Array<Subscription>(); | ||
|
||
constructor( | ||
private readonly router: Router, | ||
private readonly route: ActivatedRoute, | ||
private readonly gamingService: GamesService | ||
) {} | ||
|
||
constructor() { } | ||
public ngOnInit() { | ||
this.handleUrl(); | ||
} | ||
|
||
ngOnInit() { | ||
private handleUrl(): void { | ||
this.subscriptions.push( | ||
this.route.paramMap | ||
.pipe( | ||
switchMap((params: ParamMap) => { | ||
if (this.router.url.startsWith('/gaming/genres/')) { | ||
return this.gamingService.getGamesByGenre(params.get('genre')); | ||
} else if (this.router.url.startsWith('/gaming/platform/')) { | ||
return this.gamingService.getGamesByPlatform(params.get('platform')); | ||
} | ||
}) | ||
) | ||
.subscribe(data => console.log(data)) | ||
); | ||
} | ||
|
||
public ngOnDestroy(): void { | ||
// Performance reason | ||
for (let i = 0; i < this.subscriptions.length; i++) { | ||
this.subscriptions[i].unsubscribe(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
...p/modules/shared-components/components/bug-report-dialog/bug-report-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
<h1 mat-dialog-title class="text-center">Bug Report</h1> | ||
<div mat-dialog-content class="text-center"> | ||
<form class="example-form"> | ||
<form class="example-form" [formGroup]="bugReportForm"> | ||
<mat-form-field class="example-full-width"> | ||
<input matInput placeholder="Favorite food" [(ngModel)]="data.fullName"> | ||
<input matInput placeholder="Enter your full name..." formControlName="fullName" /> | ||
<span *ngIf="!bugReportForm.get('fullName').valid && bugReportForm.get('fullName').touched">Full name is | ||
required.</span> | ||
</mat-form-field> | ||
|
||
<mat-form-field class="example-full-width"> | ||
<textarea matInput placeholder="Report a bug..." [(ngModel)]="data.bug"></textarea> | ||
<textarea matInput placeholder="Report a bug..." formControlName="bug"></textarea> | ||
<span *ngIf="!bugReportForm.get('bug').valid && bugReportForm.get('bug').touched">Bug field is required.</span> | ||
</mat-form-field> | ||
</form> | ||
|
||
</div> | ||
<div mat-dialog-actions> | ||
<button mat-raised-button color="primary" [mat-dialog-close]="data.fullName" cdkFocusInitial>Submit bug</button> | ||
<button mat-raised-button color="primary" (click)="submitReport();" cdkFocusInitial>Submit bug</button> | ||
<!-- [mat-dialog-close]="data.fullName" --> | ||
<button mat-raised-button color="warn" (click)="onNoClick()">Cancel</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.