From c0b93f4b8b8ab697453fcc254955ca1d735af508 Mon Sep 17 00:00:00 2001 From: JsteReubsSoftware Date: Tue, 24 Oct 2023 18:34:39 +0200 Subject: [PATCH] Added responsiveness toe the stats and chart --- .../compare-page/compare-page.component.html | 59 ++++++++++--------- .../compare-page/compare-page.component.ts | 16 +++++ .../heatmap-container.component.ts | 7 ++- 3 files changed, 53 insertions(+), 29 deletions(-) diff --git a/libs/app/components/src/lib/compare-page/compare-page.component.html b/libs/app/components/src/lib/compare-page/compare-page.component.html index 13a8fbaa..a804bc16 100644 --- a/libs/app/components/src/lib/compare-page/compare-page.component.html +++ b/libs/app/components/src/lib/compare-page/compare-page.component.html @@ -68,91 +68,94 @@ -
-
+ +
+
-
{{getFirstEventStats().name}}
-
Event Statistics
-
{{getSecondEventStats().name}}
+
{{getFirstEventStats().name}}
+
Event Statistics
+
{{getSecondEventStats().name}}
-
+
-
{{getFirstEventStats().total_attendance}}
-
-
Total Attendace
+
+
Total Attendace
-
{{getSecondEventStats().total_attendance}}
-
-
{{getFirstEventStats().average_attendance}}
+
{{getFirstEventStats().average_attendance}}
-
-
Average Attendace
+
+
Average Attendace
-
{{getSecondEventStats().average_attendance}}
-
{{getFirstEventStats().peak_attendance}}
-
-
Peak Attendace
+
+
Peak Attendace
-
{{getSecondEventStats().peak_attendance}}
-
{{getFirstEventStats().average_attendance_time}}
-
-
Average Attendace Time
+
+
Average Attendace Time
-
{{getSecondEventStats().average_attendance_time}}
-
{{getFirstEventStats().max_attendance_time}}
-
-
Peak Attendace Time
+
+
Peak Attendace Time
-
@@ -162,7 +165,7 @@
Attendance Over Time
-
+
diff --git a/libs/app/components/src/lib/compare-page/compare-page.component.ts b/libs/app/components/src/lib/compare-page/compare-page.component.ts index ed70dfd7..7980fb85 100644 --- a/libs/app/components/src/lib/compare-page/compare-page.component.ts +++ b/libs/app/components/src/lib/compare-page/compare-page.component.ts @@ -98,6 +98,7 @@ export class ComparePageComponent implements OnInit { showDropDown = false; selectedEvents: IEvent[] = []; eventStats: Stats[] = []; + showStatsSideBySide = false; parentContainer: HTMLDivElement | null = null; @@ -162,6 +163,12 @@ export class ComparePageComponent implements OnInit { this.largeScreen = false; } + if (window.innerWidth >= 768) { + this.showStatsSideBySide = true; + } else { + this.showStatsSideBySide = false; + } + this.loading = false; setTimeout(() => { @@ -363,6 +370,15 @@ export class ComparePageComponent implements OnInit { } else { this.largeScreen = false; } + + if (event.target.innerWidth >= 768) { + this.showStatsSideBySide = true; + } else { + this.showStatsSideBySide = false; + } + + //redraw any selected events + this.renderCharts(); } openSidePanel() { diff --git a/libs/app/components/src/lib/heatmap-container/heatmap-container.component.ts b/libs/app/components/src/lib/heatmap-container/heatmap-container.component.ts index 0de1b489..bb29a7d8 100644 --- a/libs/app/components/src/lib/heatmap-container/heatmap-container.component.ts +++ b/libs/app/components/src/lib/heatmap-container/heatmap-container.component.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { IEvent, IImage, IPosition } from '@event-participation-trends/api/event/util'; import { AppApiService } from '@event-participation-trends/app/api'; @@ -781,4 +781,9 @@ export class HeatmapContainerComponent implements OnInit{ this.paused = true; this.changingTimeRange = true; } + + @HostListener('window:resize') + onResize() { + this.getImageFromJSONData(this.containerEvent._id); + } }