Fix key navigation logic in blocks-list and recent-pegs-list

This commit is contained in:
natsoni 2024-07-04 19:03:17 +09:00
parent 2b96c99fb3
commit 6ed6f2e2cf
No known key found for this signature in database
GPG Key ID: C65917583181743B
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;