From 25deba16df2669d42e3516a214f4ca66e1dcabaf Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 28 Jan 2024 09:47:28 +0100 Subject: [PATCH] Feature/add reset filters button to assistant (#2936) * Add reset filters button * Update changelog --- CHANGELOG.md | 4 ++ .../src/lib/assistant/assistant.component.ts | 21 +++++++++ libs/ui/src/lib/assistant/assistant.html | 46 ++++++++++--------- libs/ui/src/lib/assistant/assistant.scss | 2 +- 4 files changed, 51 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb709950..b5a28501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added a button to reset the active filters in the assistant (experimental) + ### Changed - Migrated the portfolio allocations to work with the filters of the assistant (experimental) diff --git a/libs/ui/src/lib/assistant/assistant.component.ts b/libs/ui/src/lib/assistant/assistant.component.ts index 79ecce4b..19cbaefc 100644 --- a/libs/ui/src/lib/assistant/assistant.component.ts +++ b/libs/ui/src/lib/assistant/assistant.component.ts @@ -216,6 +216,12 @@ export class AssistantComponent implements OnChanges, OnDestroy, OnInit { ); } + public hasFilter(aFormValue: { [key: string]: string }) { + return Object.values(aFormValue).some((value) => { + return !!value; + }); + } + public async initialize() { this.isLoading = true; this.keyManager = new FocusKeyManager(this.assistantListItems).withWrap(); @@ -249,6 +255,21 @@ export class AssistantComponent implements OnChanges, OnDestroy, OnInit { this.closed.emit(); } + public onResetFilters() { + this.filtersChanged.emit([ + { + id: null, + type: 'ACCOUNT' + }, + { + id: null, + type: 'TAG' + } + ]); + + this.onCloseAssistant(); + } + public setIsOpen(aIsOpen: boolean) { this.isOpen = aIsOpen; } diff --git a/libs/ui/src/lib/assistant/assistant.html b/libs/ui/src/lib/assistant/assistant.html index cf1c99ef..682d2227 100644 --- a/libs/ui/src/lib/assistant/assistant.html +++ b/libs/ui/src/lib/assistant/assistant.html @@ -91,33 +91,25 @@ *ngIf="!(isLoading || searchFormControl.value) && user?.settings?.isExperimentalFeatures" class="filter-container" > +
+ + Date Range + + @for (range of dateRangeOptions; track range) { + {{ range.label }} + } + + +
- - Date Range -
- - - @for (range of dateRangeOptions; track range) { - {{ range.label }} - } - - -
-
+
+ +
diff --git a/libs/ui/src/lib/assistant/assistant.scss b/libs/ui/src/lib/assistant/assistant.scss index a2b6f1fa..5003d1c3 100644 --- a/libs/ui/src/lib/assistant/assistant.scss +++ b/libs/ui/src/lib/assistant/assistant.scss @@ -3,7 +3,7 @@ .filter-container { .mat-mdc-tab-group { - max-height: 40vh; + max-height: 20vh; } ::ng-deep {