diff --git a/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.html b/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.html index 442ba460e442abefa1ba50aa1566afa085b5ca93..c8b5b866f07c8f1f348c25dfae80f837833a21ca 100644 --- a/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.html +++ b/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.html @@ -44,5 +44,15 @@ </tbody> </table> </div> + <div class="flex justify-center"> + <button (click)="restartGame()" + class="relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-teal-300 to-lime-300 group-hover:from-teal-300 group-hover:to-lime-300 dark:text-white dark:hover:text-gray-900 focus:ring-4 focus:outline-none focus:ring-lime-200 dark:focus:ring-lime-800"> + <span + class="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0"> + Rejouer + </span> + </button> + </div> + </div> diff --git a/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.ts b/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.ts index e4b7204292a333601df6d4927172cac9defaf735..8820d52a4ec5229a5dcc889078a24ecf3b4dec00 100644 --- a/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.ts +++ b/Frontend/quizz-game/src/app/homepage/quizz-play/quizz-play.component.ts @@ -26,6 +26,7 @@ export class QuizzPlayComponent implements OnInit, OnDestroy { this.loadingQuestion = true; this.loadingPlayers = true; this.quizzService.onPlayerReady(); + this.quizzService.onPlayerNotReady(); this.quizzService.onGameFinished(); this.quizzService.socket.emit("player-ready"); this.quizzService.socket.emit("on-game"); @@ -45,6 +46,13 @@ export class QuizzPlayComponent implements OnInit, OnDestroy { this.quizzService.socket.emit("validate-question", this.selectedResponseIndex); } + restartGame(){ + this.quizzService.gameFinished=false; + this.quizzService.socket.emit("player-not-ready"); + this.quizzService.socket.emit("restart-game"); + this.router.navigate([`/${this.quizzService.username}/play/waiting-players`]); + } + ngOnDestroy() { }