From 580f152c03e552d4568b024aeeb7f2c8d5209c7a Mon Sep 17 00:00:00 2001 From: Isahann Hanacleto Date: Mon, 7 Aug 2023 11:55:44 -0300 Subject: [PATCH] #14 adding point specification --- src/app/app-routing.module.ts | 4 +-- .../correct-answer-window.component.sass | 3 +-- .../correct-answer-window.component.ts | 6 +++-- .../question-window.component.html | 1 + .../question-window.component.sass | 4 +++ .../question-window.component.ts | 25 ++++++++++++++++--- src/model/PathsEnum.ts | 3 +-- 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e63830c..e9675d9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -31,11 +31,11 @@ const routes: Routes = [ component: QuestionWindowComponent, }, { - path: PathsEnum.CORRECT_ANSWER, + path: `${PathsEnum.CORRECT_ANSWER}/:points`, component: CorrectAnswerWindowComponent, }, { - path: PathsEnum.WRONG_ANSWER, + path: `${PathsEnum.WRONG_ANSWER}/:answer`, component: WrongAnswerWindowComponent } ] diff --git a/src/app/correct-answer-window/correct-answer-window.component.sass b/src/app/correct-answer-window/correct-answer-window.component.sass index a30ccbd..5ed149c 100644 --- a/src/app/correct-answer-window/correct-answer-window.component.sass +++ b/src/app/correct-answer-window/correct-answer-window.component.sass @@ -13,5 +13,4 @@ label text-align: center - - + margin: 5px diff --git a/src/app/correct-answer-window/correct-answer-window.component.ts b/src/app/correct-answer-window/correct-answer-window.component.ts index 1f91843..52f4691 100644 --- a/src/app/correct-answer-window/correct-answer-window.component.ts +++ b/src/app/correct-answer-window/correct-answer-window.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit} from '@angular/core'; -import {Router} from "@angular/router"; +import {ActivatedRoute, Router} from "@angular/router"; import {PathsEnum} from "../../model/PathsEnum"; import {StorageService} from "../../service/storage.service"; import {AppStorage} from "../../model/AppStorage"; @@ -11,14 +11,16 @@ import {AppStorage} from "../../model/AppStorage"; }) export class CorrectAnswerWindowComponent implements OnInit { - public questionScore: number = 10; + public questionScore: number = 0; private correctAnswerSound: HTMLAudioElement = new Audio('assets/sounds/tada.wav'); constructor( private readonly router: Router, + private readonly route: ActivatedRoute, private readonly storageService: StorageService ) { + this.questionScore = parseInt(this.route.snapshot.paramMap.get('points') ?? '0'); } public async ngOnInit(): Promise { diff --git a/src/app/question-window/question-window.component.html b/src/app/question-window/question-window.component.html index 5a0b515..2d4104e 100644 --- a/src/app/question-window/question-window.component.html +++ b/src/app/question-window/question-window.component.html @@ -12,6 +12,7 @@
+