From 432391b650f703e6c9cd8ea4f2e64d39e83beee6 Mon Sep 17 00:00:00 2001 From: Armin Stanitzok <21990230+GODrums@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:07:36 +0200 Subject: [PATCH] Fix: Initial Leaderboard filter params (#108) --- webapp/package-lock.json | 2 +- webapp/package.json | 2 +- webapp/src/app/home/home.component.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 3a1e52f2..be3182d6 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -24,7 +24,7 @@ "autoprefixer": "10.4.20", "class-variance-authority": "0.7.0", "clsx": "2.1.1", - "dayjs": "^1.11.13", + "dayjs": "1.11.13", "lucide-angular": "0.429.0", "postcss": "8.4.41", "rxjs": "7.8.1", diff --git a/webapp/package.json b/webapp/package.json index db4e66e3..880a4977 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -36,7 +36,7 @@ "autoprefixer": "10.4.20", "class-variance-authority": "0.7.0", "clsx": "2.1.1", - "dayjs": "^1.11.13", + "dayjs": "1.11.13", "lucide-angular": "0.429.0", "postcss": "8.4.41", "rxjs": "7.8.1", diff --git a/webapp/src/app/home/home.component.ts b/webapp/src/app/home/home.component.ts index 99eb59a0..016da6a4 100644 --- a/webapp/src/app/home/home.component.ts +++ b/webapp/src/app/home/home.component.ts @@ -7,6 +7,7 @@ import { combineLatest, timer, lastValueFrom, map } from 'rxjs'; import { toSignal } from '@angular/core/rxjs-interop'; import { LeaderboardFilterComponent } from './leaderboard/filter/filter.component'; import { SkeletonComponent } from 'app/ui/skeleton/skeleton.component'; +import dayjs from 'dayjs'; @Component({ selector: 'app-home', @@ -21,8 +22,8 @@ export class HomeComponent { // example: 2024-09-19 private readonly route = inject(ActivatedRoute); private queryParams = toSignal(this.route.queryParamMap, { requireSync: true }); - protected after = computed(() => this.queryParams().get('after') ?? undefined); - protected before = computed(() => this.queryParams().get('before') ?? undefined); + protected after = computed(() => this.queryParams().get('after') ?? dayjs().day(1).format('YYYY-MM-DD')); + protected before = computed(() => this.queryParams().get('before') ?? dayjs().format('YYYY-MM-DD')); query = injectQuery(() => ({ queryKey: ['leaderboard', { after: this.after(), before: this.before() }],