From 08a6fd38761c61f4320a0761814a9672a4f2379f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Thu, 16 May 2019 17:49:08 +0200
Subject: [PATCH] Remove useless components and fixes

---
 .../comment-export.component.ts               |  5 ++--
 .../comment-creator-page.component.html       |  1 -
 .../comment-creator-page.component.scss       |  0
 .../comment-creator-page.component.spec.ts    | 26 ----------------
 .../comment-creator-page.component.ts         | 14 ---------
 .../creator/creator-routing.module.ts         |  4 +--
 src/app/components/creator/creator.module.ts  |  2 --
 .../comment-participant-page.component.html   |  1 -
 .../comment-participant-page.component.scss   |  0
 ...comment-participant-page.component.spec.ts | 27 -----------------
 .../comment-participant-page.component.ts     | 15 ----------
 .../participant/participant-routing.module.ts |  4 +--
 .../participant/participant.module.ts         |  4 +--
 .../comment-list/comment-list.component.html  | 30 +++++++++----------
 .../comment-list/comment-list.component.scss  |  2 +-
 .../comment-list/comment-list.component.ts    |  3 +-
 16 files changed, 24 insertions(+), 114 deletions(-)
 delete mode 100644 src/app/components/creator/comment-creator-page/comment-creator-page.component.html
 delete mode 100644 src/app/components/creator/comment-creator-page/comment-creator-page.component.scss
 delete mode 100644 src/app/components/creator/comment-creator-page/comment-creator-page.component.spec.ts
 delete mode 100644 src/app/components/creator/comment-creator-page/comment-creator-page.component.ts
 delete mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.html
 delete mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.scss
 delete mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts
 delete mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.ts

diff --git a/src/app/components/creator/_dialogs/comment-export/comment-export.component.ts b/src/app/components/creator/_dialogs/comment-export/comment-export.component.ts
index 11e5b4ac5..04960808e 100644
--- a/src/app/components/creator/_dialogs/comment-export/comment-export.component.ts
+++ b/src/app/components/creator/_dialogs/comment-export/comment-export.component.ts
@@ -1,7 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { MatDialogRef } from '@angular/material';
-import { CommentCreatorPageComponent } from '../../comment-creator-page/comment-creator-page.component';
-import { Comment } from '../../../../models/comment';
+import { CommentPageComponent } from '../../../shared/comment-page/comment-page.component';
 
 @Component({
   selector: 'app-comment-export',
@@ -12,7 +11,7 @@ export class CommentExportComponent implements OnInit {
 
   exportType = 'comma';
 
-  constructor(public dialogRef: MatDialogRef<CommentCreatorPageComponent>) { }
+  constructor(public dialogRef: MatDialogRef<CommentPageComponent>) { }
 
   ngOnInit() {
   }
diff --git a/src/app/components/creator/comment-creator-page/comment-creator-page.component.html b/src/app/components/creator/comment-creator-page/comment-creator-page.component.html
deleted file mode 100644
index 2445a6fca..000000000
--- a/src/app/components/creator/comment-creator-page/comment-creator-page.component.html
+++ /dev/null
@@ -1 +0,0 @@
-<app-comment-page></app-comment-page>
diff --git a/src/app/components/creator/comment-creator-page/comment-creator-page.component.scss b/src/app/components/creator/comment-creator-page/comment-creator-page.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/components/creator/comment-creator-page/comment-creator-page.component.spec.ts b/src/app/components/creator/comment-creator-page/comment-creator-page.component.spec.ts
deleted file mode 100644
index de0a3aef6..000000000
--- a/src/app/components/creator/comment-creator-page/comment-creator-page.component.spec.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/* import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CommentCreatorPageComponent } from './comment-creator-page.component';
-
-describe('CommentCreatorPageComponent', () => {
-  let component: CommentCreatorPageComponent;
-  let fixture: ComponentFixture<CommentCreatorPageComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [ CommentCreatorPageComponent ]
-    })
-    .compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CommentCreatorPageComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
-*/
diff --git a/src/app/components/creator/comment-creator-page/comment-creator-page.component.ts b/src/app/components/creator/comment-creator-page/comment-creator-page.component.ts
deleted file mode 100644
index c971df4b4..000000000
--- a/src/app/components/creator/comment-creator-page/comment-creator-page.component.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'app-comment-creator-page',
-  templateUrl: './comment-creator-page.component.html',
-  styleUrls: ['./comment-creator-page.component.scss']
-})
-export class CommentCreatorPageComponent implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {
-  }
-}
diff --git a/src/app/components/creator/creator-routing.module.ts b/src/app/components/creator/creator-routing.module.ts
index 37cc87063..e7528ff67 100644
--- a/src/app/components/creator/creator-routing.module.ts
+++ b/src/app/components/creator/creator-routing.module.ts
@@ -10,7 +10,7 @@ import { FeedbackBarometerPageComponent } from '../shared/feedback-barometer-pag
 import { ContentListComponent } from './content-list/content-list.component';
 import { StatisticComponent } from '../shared/statistic/statistic.component';
 import { ContentPresentationComponent } from './content-presentation/content-presentation.component';
-import { CommentCreatorPageComponent } from './comment-creator-page/comment-creator-page.component';
+import { CommentPageComponent } from '../shared/comment-page/comment-page.component';
 
 const routes: Routes = [
   {
@@ -45,7 +45,7 @@ const routes: Routes = [
   },
   {
     path: 'room/:roomId/comments',
-    component: CommentCreatorPageComponent,
+    component: CommentPageComponent,
     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 5707a9ddd..349e8dbcf 100644
--- a/src/app/components/creator/creator.module.ts
+++ b/src/app/components/creator/creator.module.ts
@@ -21,7 +21,6 @@ import { ContentCreatorComponent } from './content-creator/content-creator.compo
 import { ContentListComponent } from './content-list/content-list.component';
 import { ContentEditComponent } from './_dialogs/content-edit/content-edit.component';
 import { ContentPresentationComponent } from './content-presentation/content-presentation.component';
-import { CommentCreatorPageComponent } from './comment-creator-page/comment-creator-page.component';
 import { CommentExportComponent } from './_dialogs/comment-export/comment-export.component';
 
 @NgModule({
@@ -53,7 +52,6 @@ import { CommentExportComponent } from './_dialogs/comment-export/comment-export
     ContentListComponent,
     ContentEditComponent,
     ContentPresentationComponent,
-    CommentCreatorPageComponent,
     CommentExportComponent
   ],
   entryComponents: [
diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.html b/src/app/components/participant/comment-participant-page/comment-participant-page.component.html
deleted file mode 100644
index 2445a6fca..000000000
--- a/src/app/components/participant/comment-participant-page/comment-participant-page.component.html
+++ /dev/null
@@ -1 +0,0 @@
-<app-comment-page></app-comment-page>
diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.scss b/src/app/components/participant/comment-participant-page/comment-participant-page.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts b/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts
deleted file mode 100644
index 6287f88a1..000000000
--- a/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CommentParticipantPageComponent } from './comment-participant-page.component';
-
-describe('CommentParticipantPageComponent', () => {
-  let component: CommentParticipantPageComponent;
-  let fixture: ComponentFixture<CommentParticipantPageComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [ CommentParticipantPageComponent ]
-    })
-    .compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CommentParticipantPageComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
-*/
diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts b/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts
deleted file mode 100644
index e652a59ef..000000000
--- a/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'app-comment-participant-page',
-  templateUrl: './comment-participant-page.component.html',
-  styleUrls: ['./comment-participant-page.component.scss']
-})
-export class CommentParticipantPageComponent implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {
-  }
-
-}
diff --git a/src/app/components/participant/participant-routing.module.ts b/src/app/components/participant/participant-routing.module.ts
index 1b6054cae..5b266e444 100644
--- a/src/app/components/participant/participant-routing.module.ts
+++ b/src/app/components/participant/participant-routing.module.ts
@@ -8,7 +8,7 @@ import { FeedbackBarometerPageComponent } from '../shared/feedback-barometer-pag
 import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component';
 import { StatisticsPageComponent } from '../shared/statistics-page/statistics-page.component';
 import { StatisticComponent } from '../shared/statistic/statistic.component';
-import { CommentParticipantPageComponent } from './comment-participant-page/comment-participant-page.component';
+import { CommentPageComponent } from '../shared/comment-page/comment-page.component';
 
 const routes: Routes = [
   {
@@ -37,7 +37,7 @@ const routes: Routes = [
   },
   {
     path: 'room/:roomId/comments',
-    component: CommentParticipantPageComponent,
+    component: CommentPageComponent,
     canActivate: [AuthenticationGuard],
     data: { roles: [UserRole.PARTICIPANT] }
   },
diff --git a/src/app/components/participant/participant.module.ts b/src/app/components/participant/participant.module.ts
index 640952e86..77d5bb077 100644
--- a/src/app/components/participant/participant.module.ts
+++ b/src/app/components/participant/participant.module.ts
@@ -11,7 +11,6 @@ import { ParticipantContentCarouselPageComponent } from './participant-content-c
 import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
 import { HttpClient } from '@angular/common/http';
 import { TranslateHttpLoader } from '@ngx-translate/http-loader';
-import { CommentParticipantPageComponent } from './comment-participant-page/comment-participant-page.component';
 
 @NgModule({
   imports: [
@@ -33,8 +32,7 @@ import { CommentParticipantPageComponent } from './comment-participant-page/comm
     ContentTextParticipantComponent,
     HomeParticipantPageComponent,
     RoomParticipantPageComponent,
-    ParticipantContentCarouselPageComponent,
-    CommentParticipantPageComponent
+    ParticipantContentCarouselPageComponent
   ]
 })
 export class ParticipantModule {
diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html
index 886f34baf..9187f1a08 100644
--- a/src/app/components/shared/comment-list/comment-list.component.html
+++ b/src/app/components/shared/comment-list/comment-list.component.html
@@ -4,53 +4,53 @@
   </mat-label>
   <input #searchBox placeholder="{{ 'comment-list-page.search' | translate }}"
     (input)="searchComments(searchBox.value)">
-  <button mat-icon-button class="searchBarButton close" *ngIf="searchBox.value || isIconHide"
-          (click)="hideCommentsList=false; searchBox.value=''; isIconHide=false">
+  <button mat-icon-button class="searchBarButton close" *ngIf="searchBox.value"
+          (click)="hideCommentsList=false; searchBox.value=''">
     <mat-icon>close</mat-icon>
   </button>
   <span class="fill-remaining-space"></span>
-  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value && userRole === 1 && comments.length > 0 && !isIconHide"
+  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value && userRole === 1 && comments.length > 0"
     [matTooltip]="'Export comments'" (click)="openExportDialog()">
     <mat-icon class="searchBarIcon" color="accent">cloud_download</mat-icon>
   </button>
 
-  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value && !isIconHide"
+  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value"
           color="accent" (click)="openSubmitDialog()">
     <mat-icon class="searchBarIcon">add_circle</mat-icon>
   </button>
 
-  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value && !isIconHide"
+  <button mat-icon-button class="searchBarButton" *ngIf="!searchBox.value && comments.length > 0"
           color="accent" [matMenuTriggerFor]="filterMenu">
     <mat-icon class="searchBarIcon">sort</mat-icon>
   </button>
 
   <mat-menu #filterMenu="matMenu" xPosition="before">
     <div id="filterIcon">
-      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterMarkAsCorrect(); isIconHide=true">
-        <mat-icon color="primary">check_circle</mat-icon>
+      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterMarkAsCorrect()">
+        <mat-icon>check_circle</mat-icon>
       </button>
 
-      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterFavorite(); isIconHide=true">
-        <mat-icon color="primary">star</mat-icon>
+      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterFavorite()">
+        <mat-icon>star</mat-icon>
       </button>
 
-      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterMarkAsRead(); isIconHide=true">
-        <mat-icon color="primary">visibility</mat-icon>
+      <button mat-icon-button (focus)="hideCommentsList=true" (click)="filterMarkAsRead()">
+        <mat-icon>visibility</mat-icon>
       </button>
 
       <button mat-icon-button (focus)="hideCommentsList=false" (click)="sortVoteDesc()">
-        <mat-icon color="primary">keyboard_arrow_up</mat-icon>
+        <mat-icon>keyboard_arrow_up</mat-icon>
       </button>
 
       <button mat-icon-button (focus)="hideCommentsList=false" (click)="sortVote()">
-        <mat-icon color="primary">keyboard_arrow_down</mat-icon>
+        <mat-icon>keyboard_arrow_down</mat-icon>
       </button>
 
       <button mat-icon-button (focus)="hideCommentsList=false" (click)="sortTimeStamp()">
-        <mat-icon color="primary">remove</mat-icon>
+        <mat-icon>remove</mat-icon>
       </button>
       <button mat-icon-button *ngIf="userRole === 1" (focus)="hideCommentsList=false" (click)="deleteComments()">
-        <mat-icon color="primary">delete</mat-icon>
+        <mat-icon color="warn">delete</mat-icon>
       </button>
     </div>
   </mat-menu>
diff --git a/src/app/components/shared/comment-list/comment-list.component.scss b/src/app/components/shared/comment-list/comment-list.component.scss
index 838f23a98..b18c30908 100644
--- a/src/app/components/shared/comment-list/comment-list.component.scss
+++ b/src/app/components/shared/comment-list/comment-list.component.scss
@@ -16,7 +16,7 @@ app-comment {
 input {
   box-sizing: border-box;
   padding: 0 10px 0 5px;
-  width: 50%;
+  width: 100%;
   background-color: var(--light);
   border: none;
   outline: none;
diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts
index 7c55c8a40..b203f63ae 100644
--- a/src/app/components/shared/comment-list/comment-list.component.ts
+++ b/src/app/components/shared/comment-list/comment-list.component.ts
@@ -26,7 +26,6 @@ export class CommentListComponent implements OnInit {
   comments: Comment[];
   isLoading = true;
   hideCommentsList = false;
-  isIconHide: boolean;
   filteredComments: Comment[];
   userRole: UserRole;
 
@@ -171,7 +170,7 @@ export class CommentListComponent implements OnInit {
   }
 
   exportCsv(delimiter: string, date: string): void {
-    let exportComments = JSON.parse(JSON.stringify(this.comments));
+    const exportComments = JSON.parse(JSON.stringify(this.comments));
     let csv: string;
     let keyFields = '';
     let valueFields = '';
-- 
GitLab