From d90b26461a85567d47ecf2100736bef6e7386b41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9ophile=20HUSS?= <theophile.huss@etu.unistra.fr>
Date: Sun, 1 Dec 2024 18:14:26 +0100
Subject: [PATCH] feat: Add option to disable header when current route is
 play-quiz

---
 src/app/app.component.html |  2 +-
 src/app/app.component.ts   | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/app/app.component.html b/src/app/app.component.html
index 1e15754..2471e3c 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,2 +1,2 @@
-<app-header></app-header>
+<app-header *ngIf="!playQuiz"></app-header>
 <router-outlet></router-outlet>
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index ad4958d..7ac1d11 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,8 +1,20 @@
-import { Component } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';
+import { filter } from 'rxjs';
 
 @Component({
     selector: 'app-root',
     templateUrl: './app.component.html',
     styleUrl: './app.component.css',
 })
-export class AppComponent {}
+export class AppComponent implements OnInit {
+    playQuiz: boolean = false;
+
+    constructor(private router: Router, private route: ActivatedRoute) {}
+
+    ngOnInit(): void {
+        this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
+            this.playQuiz = this.router.url.includes('play-quiz');
+        });
+    }
+}
-- 
GitLab