From aea497154a363dfd7898f7338b9aca5afd0c36a1 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Tue, 1 Jun 2021 21:34:53 +0200 Subject: [PATCH] Feature/prettify symbols in transaction filtering component (#131) * Prettify generic scraper symbols * Update changelog --- CHANGELOG.md | 1 + .../transactions-table.component.html | 9 +++---- .../transactions-table.component.ts | 26 +++++++++---------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeda6875..3488602d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Respected the data source attribute of the transactions model in the data management for historical data +- Prettified the generic scraper symbols in the transaction filtering component ### Fixed diff --git a/apps/client/src/app/components/transactions-table/transactions-table.component.html b/apps/client/src/app/components/transactions-table/transactions-table.component.html index 2ee164dc..d96fc28b 100644 --- a/apps/client/src/app/components/transactions-table/transactions-table.component.html +++ b/apps/client/src/app/components/transactions-table/transactions-table.component.html @@ -8,7 +8,7 @@ [removable]="true" (removed)="removeKeyword(searchKeyword)" > - {{ searchKeyword }} + {{ searchKeyword | gfSymbol }} - - {{ transaction }} + + {{ filter | gfSymbol }} diff --git a/apps/client/src/app/components/transactions-table/transactions-table.component.ts b/apps/client/src/app/components/transactions-table/transactions-table.component.ts index 072b844e..1a6d2146 100644 --- a/apps/client/src/app/components/transactions-table/transactions-table.component.ts +++ b/apps/client/src/app/components/transactions-table/transactions-table.component.ts @@ -57,10 +57,8 @@ export class TransactionsTableComponent public dataSource: MatTableDataSource = new MatTableDataSource(); public defaultDateFormat = DEFAULT_DATE_FORMAT; public displayedColumns = []; - public filteredTransactions$: Subject = new BehaviorSubject([]); - public filteredTransactions: Observable< - string[] - > = this.filteredTransactions$.asObservable(); + public filters$: Subject = new BehaviorSubject([]); + public filters: Observable = this.filters$.asObservable(); public isLoading = true; public placeholder = ''; public routeQueryParams: Subscription; @@ -68,7 +66,7 @@ export class TransactionsTableComponent public searchKeywords: string[] = []; public separatorKeysCodes: number[] = [ENTER, COMMA]; - private allFilteredTransactions: string[]; + private allFilters: string[]; private unsubscribeSubject = new Subject(); public constructor( @@ -90,13 +88,13 @@ export class TransactionsTableComponent this.searchControl.valueChanges.subscribe((keyword) => { if (keyword) { const filterValue = keyword.toLowerCase(); - this.filteredTransactions$.next( - this.allFilteredTransactions.filter( + this.filters$.next( + this.allFilters.filter( (filter) => filter.toLowerCase().indexOf(filterValue) === 0 ) ); } else { - this.filteredTransactions$.next(this.allFilteredTransactions); + this.filters$.next(this.allFilters); } }); } @@ -239,13 +237,13 @@ export class TransactionsTableComponent this.placeholder = lowercaseSearchKeywords.length <= 0 ? SEARCH_PLACEHOLDER : ''; - this.allFilteredTransactions = this.getSearchableFieldValues( - this.transactions - ).filter((item) => { - return !lowercaseSearchKeywords.includes(item.trim().toLowerCase()); - }); + this.allFilters = this.getSearchableFieldValues(this.transactions).filter( + (item) => { + return !lowercaseSearchKeywords.includes(item.trim().toLowerCase()); + } + ); - this.filteredTransactions$.next(this.allFilteredTransactions); + this.filters$.next(this.allFilters); } private getSearchableFieldValues(transactions: OrderWithAccount[]): string[] {