diff --git a/src/app/components/game-queue/game-queue.component.html b/src/app/components/game-queue/game-queue.component.html
index b0a1549..09c4789 100644
--- a/src/app/components/game-queue/game-queue.component.html
+++ b/src/app/components/game-queue/game-queue.component.html
@@ -4,7 +4,7 @@
-
+
Ура, приз!
@@ -29,10 +29,9 @@
+
+ Question results
+
-
-
-
-
diff --git a/src/app/components/game-queue/game-queue.component.ts b/src/app/components/game-queue/game-queue.component.ts
index 868d12e..8fb4de7 100644
--- a/src/app/components/game-queue/game-queue.component.ts
+++ b/src/app/components/game-queue/game-queue.component.ts
@@ -16,7 +16,7 @@ import { PrizeDto } from "../../../types/prize.dto";
export class GameQueueComponent implements OnInit {
@Input() action: EventGameQueue;
readonly gameQueueTypes = QueueTypes
- participant: Participant;
+ participant: Participant | null;
destroyed$ = new Subject();
penalty = '';
countdown: number;
@@ -31,11 +31,14 @@ export class GameQueueComponent implements OnInit {
constructor(private apiService: ApiService) { }
ngOnInit(): void {
- this.apiService.getParticipant(this.action.target).pipe(
+ if(this.action.target) {
+ this.apiService.getParticipant(this.action.target).pipe(
takeUntil(this.destroyed$)
- ).subscribe(e => {
- this.participant = e;
- });
+ ).subscribe(e => {
+ this.participant = e;
+ });
+ }
+
if(this.action.type === this.gameQueueTypes.penalty) {
this.getPenalty();
}
@@ -98,10 +101,13 @@ export class GameQueueComponent implements OnInit {
}
private getPrize() {
+ if(!this.participant === null) {
+ return;
+ }
this.apiService.getPrize().pipe(takeUntil(this.destroyed$)).subscribe((r) => {
this.prize = r;
this.showPrize = true;
- this.prizeAudioSrc = getAudioPath(`Поздравляю, ${this.participant.name} получает ${this.prize.name}`);
+ this.prizeAudioSrc = getAudioPath(`Поздравляю, ${this.participant?.name} получает ${this.prize.name}`);
});
}
}
diff --git a/src/app/components/question/question.component.html b/src/app/components/question/question.component.html
index 3ad7618..4d1c066 100644
--- a/src/app/components/question/question.component.html
+++ b/src/app/components/question/question.component.html
@@ -1,10 +1,10 @@
-
- Вопрос
+
+ Вопрос
-
+
{{ question.text }}
@@ -15,7 +15,14 @@
+
+
+ = 0">{{ countdown }}
+
\ No newline at end of file
diff --git a/src/app/components/question/question.component.scss b/src/app/components/question/question.component.scss
index 9524995..3669dd9 100644
--- a/src/app/components/question/question.component.scss
+++ b/src/app/components/question/question.component.scss
@@ -25,8 +25,7 @@ section {
margin: 15px;
background: $yellow_gradient;
font-size: 1.5em;
- padding: 10px;
- padding-top: 20px;
+ padding: 20px 10px 10px;
border-radius: 23px;
p {
text-align: center;
@@ -34,3 +33,23 @@ section {
}
}
}
+
+.countdown {
+ &.warn {
+ color: $thg_red;
+ //background-color: $thg_black;
+ transition: color 2000ms linear, font-size 5000ms ease;
+ border-radius: 10px;
+ font-size: 3em;
+ }
+ min-width: 40px;
+ position: absolute;
+ bottom: 50px;
+ right: 20px;
+ z-index: 1000;
+ span {
+ font-size: 3em;
+ font-weight: bold;
+ }
+ color: $thg_brown;
+}
\ No newline at end of file
diff --git a/src/app/components/question/question.component.ts b/src/app/components/question/question.component.ts
index 5fcfa98..68f59e7 100644
--- a/src/app/components/question/question.component.ts
+++ b/src/app/components/question/question.component.ts
@@ -15,6 +15,8 @@ export class QuestionComponent implements OnInit, OnDestroy {
@Input() question: Question;
destroyed$ = new Subject();
private questionSubscription: Subscription;
+ countdown = 0;
+ readonly countDownTimer =20;
constructor(private apiService:ApiService, private eventService: EventService, private voiceService: VoiceService) { }
@@ -24,12 +26,25 @@ export class QuestionComponent implements OnInit, OnDestroy {
return;
}
setTimeout(() => this.getQuestion(), 3000);
+ this.countdown = this.countDownTimer;
+ setInterval(() => {
+ console.log(`question countdown`);
+ this.countdown--;
+ }, 1000)
+
this.questionSubscription = this.eventService.questionChangedEvent.subscribe(() =>{
this.getQuestion();
+ this.countdown = 20;
});
}
+ continueGame() {
+ this.apiService.continueGame().subscribe((r) => {
+ console.log(r);
+ });
+ }
+
getQuestion() {
this.apiService.getQuestion().pipe(
takeUntil(this.destroyed$)
diff --git a/src/app/views/onboarding/onboarding.component.ts b/src/app/views/onboarding/onboarding.component.ts
index beee989..53d5fc8 100644
--- a/src/app/views/onboarding/onboarding.component.ts
+++ b/src/app/views/onboarding/onboarding.component.ts
@@ -114,7 +114,7 @@ export class OnboardingComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
this.destroyed$.complete();
- this.voiceSubscription.unsubscribe();
+ this.voiceSubscription?.unsubscribe();
}
shakeCard(card: ElementRef) {
diff --git a/src/types/server-event.ts b/src/types/server-event.ts
index ba41064..d2b705f 100644
--- a/src/types/server-event.ts
+++ b/src/types/server-event.ts
@@ -6,6 +6,7 @@ export enum QueueTypes {
penalty = 'penalty',
playExtraCard = 'play_extra_card',
screpa = 'screpa',
+ showresults = 'show_results',
}
export interface EventPhotosUpdated {