From 65b54dda2584afd0b40c7eb011e80c61eaed1474 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 7 Jun 2025 08:52:32 +0200 Subject: [PATCH] Refactoring --- .../lib/benchmark/benchmark.component.html | 8 +++--- .../lib/benchmark/benchmark.component.scss | 10 ++++++++ .../src/lib/benchmark/benchmark.component.ts | 25 ++++--------------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/libs/ui/src/lib/benchmark/benchmark.component.html b/libs/ui/src/lib/benchmark/benchmark.component.html index 29aebc75c..b11a76507 100644 --- a/libs/ui/src/lib/benchmark/benchmark.component.html +++ b/libs/ui/src/lib/benchmark/benchmark.component.html @@ -3,9 +3,9 @@ class="gf-table w-100" mat-table matSort + matSortActive="name" + matSortDirection="asc" [dataSource]="dataSource" - [matSortActive]="sortColumn" - [matSortDirection]="sortDirection" > @@ -102,9 +102,9 @@ Change from All Time High(); @@ -106,22 +101,12 @@ export class GfBenchmarkComponent }); } - ngAfterViewInit() { - this.dataSource.sort = this.sort; - - this.dataSource.sortingDataAccessor = (item, property) => { - switch (property) { - case 'change': - return item.performances?.allTimeHigh?.performancePercent; - default: - return get(item, property); - } - }; - } - public ngOnChanges() { if (this.benchmarks) { this.dataSource.data = this.benchmarks; + this.dataSource.sort = this.sort; + this.dataSource.sortingDataAccessor = get; + this.isLoading = false; }