From 6ed6f2e2cfcffbf49340adbce8def09238b4e618 Mon Sep 17 00:00:00 2001 From: natsoni Date: Thu, 4 Jul 2024 19:03:17 +0900 Subject: [PATCH] Fix key navigation logic in blocks-list and recent-pegs-list --- .../src/app/components/blocks-list/blocks-list.component.ts | 6 ++++-- .../recent-pegs-list/recent-pegs-list.component.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.ts b/frontend/src/app/components/blocks-list/blocks-list.component.ts index 9bf4e9814..5270ee7be 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.ts +++ b/frontend/src/app/components/blocks-list/blocks-list.component.ts @@ -81,11 +81,13 @@ export class BlocksList implements OnInit { }) ).subscribe(); + const prevKey = this.dir === 'ltr' ? 'ArrowLeft' : 'ArrowRight'; + const nextKey = this.dir === 'ltr' ? 'ArrowRight' : 'ArrowLeft'; + this.keyNavigationSubscription = this.stateService.keyNavigation$ .pipe( + filter((event) => event.key === prevKey || event.key === nextKey), tap((event) => { - const prevKey = this.dir === 'ltr' ? 'ArrowLeft' : 'ArrowRight'; - const nextKey = this.dir === 'ltr' ? 'ArrowRight' : 'ArrowLeft'; if (event.key === prevKey && this.page > 1) { this.page--; this.isLoading = true; diff --git a/frontend/src/app/components/liquid-reserves-audit/recent-pegs-list/recent-pegs-list.component.ts b/frontend/src/app/components/liquid-reserves-audit/recent-pegs-list/recent-pegs-list.component.ts index 31a52fd9d..d809f2fa0 100644 --- a/frontend/src/app/components/liquid-reserves-audit/recent-pegs-list/recent-pegs-list.component.ts +++ b/frontend/src/app/components/liquid-reserves-audit/recent-pegs-list/recent-pegs-list.component.ts @@ -73,11 +73,13 @@ export class RecentPegsListComponent implements OnInit { }), ).subscribe(); + const prevKey = this.dir === 'ltr' ? 'ArrowLeft' : 'ArrowRight'; + const nextKey = this.dir === 'ltr' ? 'ArrowRight' : 'ArrowLeft'; + this.keyNavigationSubscription = this.stateService.keyNavigation$ .pipe( + filter((event) => event.key === prevKey || event.key === nextKey), tap((event) => { - const prevKey = this.dir === 'ltr' ? 'ArrowLeft' : 'ArrowRight'; - const nextKey = this.dir === 'ltr' ? 'ArrowRight' : 'ArrowLeft'; if (event.key === prevKey && this.page > 1) { this.page--; this.isLoading = true;