From a728dbee61bf7a3c5bc33414e227e2f7c301917d Mon Sep 17 00:00:00 2001
From: Lukas Haase <lukas.haase@mni.thm.de>
Date: Sun, 22 Mar 2020 15:34:37 +0100
Subject: [PATCH] Change button position, make questionwall available for every
 role

---
 src/app/components/creator/creator-routing.module.ts |  8 +-------
 src/app/components/creator/creator.module.ts         |  2 +-
 .../room-creator-page.component.html                 |  4 ----
 .../components/shared/header/header.component.html   |  4 ++++
 .../questionwall/QuestionWallComment.ts              |  0
 .../question-wall/question-wall.component.html       |  2 +-
 .../question-wall/question-wall.component.scss       |  0
 .../question-wall/question-wall.component.spec.ts    |  0
 .../question-wall/question-wall.component.ts         |  2 ++
 src/app/components/shared/shared-routing.module.ts   | 12 ++++++++++++
 10 files changed, 21 insertions(+), 13 deletions(-)
 rename src/app/components/{creator => shared}/questionwall/QuestionWallComment.ts (100%)
 rename src/app/components/{creator => shared}/questionwall/question-wall/question-wall.component.html (94%)
 rename src/app/components/{creator => shared}/questionwall/question-wall/question-wall.component.scss (100%)
 rename src/app/components/{creator => shared}/questionwall/question-wall/question-wall.component.spec.ts (100%)
 rename src/app/components/{creator => shared}/questionwall/question-wall/question-wall.component.ts (98%)

diff --git a/src/app/components/creator/creator-routing.module.ts b/src/app/components/creator/creator-routing.module.ts
index d0a8a51f3..83d79e684 100644
--- a/src/app/components/creator/creator-routing.module.ts
+++ b/src/app/components/creator/creator-routing.module.ts
@@ -5,7 +5,7 @@ import { UserRole } from '../../models/user-roles.enum';
 import { RoomCreatorPageComponent } from './room-creator-page/room-creator-page.component';
 import { CommentPageComponent } from '../shared/comment-page/comment-page.component';
 import { CommentAnswerComponent } from '../shared/comment-answer/comment-answer.component';
-import { QuestionWallComponent } from './questionwall/question-wall/question-wall.component';
+import { QuestionWallComponent } from '../shared/questionwall/question-wall/question-wall.component';
 
 const routes: Routes = [
   {
@@ -24,12 +24,6 @@ const routes: Routes = [
     path: 'room/:shortId/comment/:commentId',
     component: CommentAnswerComponent,
     canActivate: [AuthenticationGuard],
-  },
-  {
-    path: 'room/:shortId/questionwall',
-    component: QuestionWallComponent,
-    canActivate: [AuthenticationGuard],
-    data: { roles: [UserRole.CREATOR] }
   }
 ];
 
diff --git a/src/app/components/creator/creator.module.ts b/src/app/components/creator/creator.module.ts
index f4527b93b..1ec004568 100644
--- a/src/app/components/creator/creator.module.ts
+++ b/src/app/components/creator/creator.module.ts
@@ -20,7 +20,7 @@ import { DeleteCommentsComponent } from './_dialogs/delete-comments/delete-comme
 import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.component';
 import { MarkdownModule } from 'ngx-markdown';
 import { DeleteAnswerComponent } from './_dialogs/delete-answer/delete-answer.component';
-import { QuestionWallComponent } from './questionwall/question-wall/question-wall.component';
+import { QuestionWallComponent } from '../shared/questionwall/question-wall/question-wall.component';
 import { ArsModule } from '../../../../projects/ars/src/lib/ars.module';
 
 @NgModule({
diff --git a/src/app/components/creator/room-creator-page/room-creator-page.component.html b/src/app/components/creator/room-creator-page/room-creator-page.component.html
index 90f8e7855..c26aa3104 100644
--- a/src/app/components/creator/room-creator-page/room-creator-page.component.html
+++ b/src/app/components/creator/room-creator-page/room-creator-page.component.html
@@ -40,10 +40,6 @@
             <mat-icon svgIcon="comment_tag"></mat-icon>
             {{ 'room-page.tags' | translate}}
           </button>
-          <button mat-menu-item routerLink="/creator/room/{{room.shortId}}/questionwall">
-            <mat-icon svgIcon="comment_tag"></mat-icon>
-            Questionwall
-          </button>
         </mat-menu>
         <button  id="settings-menu"
                  mat-icon-button class="corner-icons" [matMenuTriggerFor]="settingsMenu" aria-labelledby="settings">
diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html
index 2be678e8d..1a3e6f2aa 100644
--- a/src/app/components/shared/header/header.component.html
+++ b/src/app/components/shared/header/header.component.html
@@ -13,6 +13,10 @@
         fxLayoutAlign="center center">
       {{cTime}}
     </h2>
+    <span class="fill-remaining-space"></span>
+    <button *ngIf="router.url.includes('comments')" mat-button routerLink="participant/room/{{shortId}}/questionwall">
+      <span>Presentation</span>
+    </button>
     <span class="fill-remaining-space"
           *ngIf="router.url.includes('comments') && user.role === 3 && deviceType === 'desktop'"></span>
     <span
diff --git a/src/app/components/creator/questionwall/QuestionWallComment.ts b/src/app/components/shared/questionwall/QuestionWallComment.ts
similarity index 100%
rename from src/app/components/creator/questionwall/QuestionWallComment.ts
rename to src/app/components/shared/questionwall/QuestionWallComment.ts
diff --git a/src/app/components/creator/questionwall/question-wall/question-wall.component.html b/src/app/components/shared/questionwall/question-wall/question-wall.component.html
similarity index 94%
rename from src/app/components/creator/questionwall/question-wall/question-wall.component.html
rename to src/app/components/shared/questionwall/question-wall/question-wall.component.html
index 4d1551a5a..db3ad1176 100644
--- a/src/app/components/creator/questionwall/question-wall/question-wall.component.html
+++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.html
@@ -1,6 +1,6 @@
 <ars-screen ars-flex-box class="questionwall-screen">
   <ars-row [height]="50" class="questionwall-header">
-    <button *ngIf="room" routerLink="/creator/room/{{room.shortId}}">BACK</button>
+    <button *ngIf="room" routerLink="/participant/room/{{room.shortId}}/comments">BACK</button>
   </ars-row>
   <ars-fill ars-flex-box>
     <ars-fill style="overflow:hidden;">
diff --git a/src/app/components/creator/questionwall/question-wall/question-wall.component.scss b/src/app/components/shared/questionwall/question-wall/question-wall.component.scss
similarity index 100%
rename from src/app/components/creator/questionwall/question-wall/question-wall.component.scss
rename to src/app/components/shared/questionwall/question-wall/question-wall.component.scss
diff --git a/src/app/components/creator/questionwall/question-wall/question-wall.component.spec.ts b/src/app/components/shared/questionwall/question-wall/question-wall.component.spec.ts
similarity index 100%
rename from src/app/components/creator/questionwall/question-wall/question-wall.component.spec.ts
rename to src/app/components/shared/questionwall/question-wall/question-wall.component.spec.ts
diff --git a/src/app/components/creator/questionwall/question-wall/question-wall.component.ts b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
similarity index 98%
rename from src/app/components/creator/questionwall/question-wall/question-wall.component.ts
rename to src/app/components/shared/questionwall/question-wall/question-wall.component.ts
index 017799aa6..03833d312 100644
--- a/src/app/components/creator/questionwall/question-wall/question-wall.component.ts
+++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
@@ -7,6 +7,7 @@ import { Room } from '../../../../models/room';
 import { WsCommentServiceService } from '../../../../services/websockets/ws-comment-service.service';
 import { QuestionWallComment } from '../QuestionWallComment';
 import { ColComponent } from '../../../../../../projects/ars/src/lib/components/layout/frame/col/col.component';
+import { Router } from '@angular/router';
 
 @Component({
   selector: 'app-question-wall',
@@ -29,6 +30,7 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy {
   }
 
   constructor(
+    private router: Router,
     private commentService: CommentService,
     private roomService: RoomService,
     private wsCommentService: WsCommentServiceService
diff --git a/src/app/components/shared/shared-routing.module.ts b/src/app/components/shared/shared-routing.module.ts
index 306cccc7c..67a4b6a98 100644
--- a/src/app/components/shared/shared-routing.module.ts
+++ b/src/app/components/shared/shared-routing.module.ts
@@ -1,7 +1,19 @@
 import { RouterModule, Routes } from '@angular/router';
 import { NgModule } from '@angular/core';
+import { QuestionWallComponent } from './questionwall/question-wall/question-wall.component';
+import { AuthenticationGuard } from '../../guards/authentication.guard';
+import { UserRole } from '../../models/user-roles.enum';
 
 const routes: Routes = [
+  {
+    path: 'room/:shortId/questionwall',
+    component: QuestionWallComponent,
+    canActivate: [AuthenticationGuard],
+    data: { roles: [UserRole.CREATOR,
+        UserRole.EDITING_MODERATOR,
+        UserRole.EXECUTIVE_MODERATOR,
+        UserRole.PARTICIPANT] }
+  }
 ];
 
 @NgModule({
-- 
GitLab