From ea2e29c6328c3a1204d8dcd06ec64cb6c05f7057 Mon Sep 17 00:00:00 2001
From: Ruben Bimberg <ruben.bimberg@mni.thm.de>
Date: Thu, 23 Sep 2021 12:14:02 +0200
Subject: [PATCH] Fix some issues related to the topic cloud

---
 .../topic-cloud-filter.component.ts           | 23 ++++++++++++++++---
 .../shared/header/header.component.html       |  8 +++----
 .../shared/header/header.component.scss       |  2 ++
 .../shared/tag-cloud/tag-cloud.component.ts   | 10 +++++++-
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts
index 159de9263..d1422670f 100644
--- a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts
+++ b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts
@@ -86,7 +86,7 @@ export class TopicCloudFilterComponent implements OnInit, OnDestroy {
       this._room = data.room;
       this.roomDataService.getRoomData(data.room.id).subscribe(roomData => {
         this.comments = roomData;
-        this.commentsLoadedCallback();
+        this.commentsLoadedCallback(true);
       });
       this._subscriptionCommentUpdates = this.roomDataService.receiveUpdates([{ finished: true }])
         .subscribe(_ => this.commentsLoadedCallback());
@@ -100,16 +100,30 @@ export class TopicCloudFilterComponent implements OnInit, OnDestroy {
     }
   }
 
-  commentsLoadedCallback() {
+  commentsLoadedCallback(isNew = false) {
     this.allComments = this.getCommentCounts(this.comments);
     this.filteredComments = this.getCommentCounts(this.comments.filter(comment => this.tmpFilter.checkComment(comment)));
-    this.hasNoKeywords = this.isUpdatable();
+    if (isNew) {
+      this.hasNoKeywords = this.isUpdatable();
+    }
     this.disableCurrentFiltersOptions = ((this.allComments.comments === this.filteredComments.comments) &&
       (this.allComments.users === this.filteredComments.users) &&
       (this.allComments.keywords === this.filteredComments.keywords));
     if (this.disableCurrentFiltersOptions) {
       this.continueFilter = 'continueWithAll';
     }
+    if (this.filteredComments.comments === 0 && this.allComments.comments === 0) {
+      if (this.user && this.user.role > UserRole.PARTICIPANT) {
+        setTimeout(() => {
+          this.continueFilter = 'continueWithAllFromNow';
+        });
+      } else {
+        setTimeout(() => {
+          this.continueFilter = 'continueWithAllFromNow';
+          this.confirmButtonActionCallback()();
+        });
+      }
+    }
   }
 
   isMobile(): boolean {
@@ -188,6 +202,9 @@ export class TopicCloudFilterComponent implements OnInit, OnDestroy {
         count++;
       }
     });
+    if (newCount + count < 1) {
+      return false;
+    }
     if (this.user && this.user.role === UserRole.PARTICIPANT) {
       return newCount < 1;
     }
diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html
index c40673786..795e83d53 100644
--- a/src/app/components/shared/header/header.component.html
+++ b/src/app/components/shared/header/header.component.html
@@ -60,31 +60,31 @@
         [xp]="16"
         [extra]="true">
         <button mat-icon-button
+                disableRipple="true"
                 *ngIf="isAdminConfigEnabled"
                 class="pseudo-button"
-                matRipple
                 matTooltip="{{'header.overview-admin-config-enabled' | translate}}">
           <mat-icon class="oldtypo-h2 comment_tag-icon"
                     style="color: red !important;">warning
           </mat-icon>
         </button>
         <button mat-icon-button
+                disableRipple="true"
                 class="pseudo-button"
-                matRipple
                 matTooltip="{{'header.overview-question-tooltip' | translate}}">
           <mat-icon class="oldtypo-h2 comment_tag-icon">comment</mat-icon>
           <span style="margin-left: 0.25em;">{{commentsCountQuestions}}</span>
         </button>
         <button mat-icon-button
+                disableRipple="true"
                 class="pseudo-button"
-                matRipple
                 matTooltip="{{'header.overview-questioners-tooltip' | translate}}">
           <mat-icon class="oldtypo-h2 comment_tag-icon">person</mat-icon>
           <span style="margin-left: 0.25em;">{{commentsCountUsers}}</span>
         </button>
         <button mat-icon-button
+                disableRipple="true"
                 class="pseudo-button"
-                matRipple
                 matTooltip="{{'header.overview-keywords-tooltip' | translate}}">
           <mat-icon svgIcon="hashtag"
                     class="oldtypo-h2 comment_tag-icon"></mat-icon>
diff --git a/src/app/components/shared/header/header.component.scss b/src/app/components/shared/header/header.component.scss
index e005bab75..bbd748300 100644
--- a/src/app/components/shared/header/header.component.scss
+++ b/src/app/components/shared/header/header.component.scss
@@ -45,9 +45,11 @@ mat-toolbar-row {
 .topic-cloud-btns {
   > ars-col button {
     margin-right: 0.75em;
+    cursor: default;
 
     &:hover, &:focus {
       border: none;
+      cursor: default;
     }
   }
 
diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts
index 40e8a1c18..b73eb18d0 100644
--- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts
+++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts
@@ -31,6 +31,7 @@ import { CloudParameters, CloudTextStyle } from '../../../utils/cloud-parameters
 import { SmartDebounce } from '../../../utils/smart-debounce';
 import { Theme } from '../../../../theme/Theme';
 import { MatDrawer } from '@angular/material/sidenav';
+import { DeviceInfoService } from '../../../services/util/device-info.service';
 
 class CustomPosition implements Position {
   left: number;
@@ -127,7 +128,8 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit {
               private topicCloudAdmin: TopicCloudAdminService,
               private router: Router,
               public dataManager: TagCloudDataService,
-              private wsRoomService: WsRoomService) {
+              private wsRoomService: WsRoomService,
+              private deviceInfo: DeviceInfoService) {
     this.roomId = localStorage.getItem('roomId');
     this.langService.langEmitter.subscribe(lang => {
       this.translateService.use(lang);
@@ -384,6 +386,12 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit {
       admin.endDate = data.admin.endDate;
       data.admin = undefined;
       this.topicCloudAdmin.setAdminData(admin, false, this.userRole);
+      if (this.deviceInfo.isCurrentlyMobile) {
+        const defaultParams = new CloudParameters();
+        defaultParams.resetToDefault(this.themeService.getThemeByKey(this.themeService.themeName).isDark);
+        data.fontSizeMin = defaultParams.fontSizeMin;
+        data.fontSizeMax = defaultParams.fontSizeMax;
+      }
       this.setCloudParameters(data as CloudParameters);
     } else {
       this.resetColorsToTheme();
-- 
GitLab