Refactor key navigation on recent pegs table

This commit is contained in:
natsoni
2024-03-22 13:48:01 +09:00
parent c18779b4e3
commit adda511869
2 changed files with 19 additions and 59 deletions

View File

@@ -26,7 +26,6 @@ export class BlocksList implements OnInit {
auditAvailable = false;
isLoading = true;
fromBlockHeight = undefined;
lastKeyNavTime = 0;
lastBlockHeightFetched = -1;
paginationMaxSize: number;
page = 1;
@@ -77,6 +76,7 @@ export class BlocksList implements OnInit {
this.keyNavigationSubscription = this.stateService.keyNavigation$
.pipe(
tap((event) => {
this.isLoading = true;
const prevKey = this.dir === 'ltr' ? 'ArrowLeft' : 'ArrowRight';
const nextKey = this.dir === 'ltr' ? 'ArrowRight' : 'ArrowLeft';
if (event.key === prevKey && this.page > 1) {
@@ -184,10 +184,6 @@ export class BlocksList implements OnInit {
this.router.navigate([], { queryParams: { page: page } });
}
keyNavPageChange(page: number): void {
this.pageChange(page);
}
trackByBlock(index: number, block: BlockExtended): number {
return block.height;
}