From 6554c7e91984d1cf3d137d144f92eb1696719e23 Mon Sep 17 00:00:00 2001
From: "narindra.rajohnso" <narindra-hasimanjaka-david.rajohnson@etu.hesge.ch>
Date: Mon, 12 Jun 2023 01:15:04 +0200
Subject: [PATCH] app fonctionnal but certain bug like the list of players
 persist

---
 .../app/homepage/quizz-play/quizz-play.component.html  | 10 ++++++++++
 .../app/homepage/quizz-play/quizz-play.component.ts    |  8 ++++++++
 2 files changed, 18 insertions(+)

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 442ba46..c8b5b86 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 e4b7204..8820d52 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() {
   }
 
-- 
GitLab