From 27a9d5f24772d7bcc9607935dff1c83cc94479a8 Mon Sep 17 00:00:00 2001 From: Edd Date: Wed, 24 Jan 2024 16:31:56 +0000 Subject: [PATCH] fix(explorer): update tx navigation for 0.74.0 (#5662) --- .../txs/tx-list-navigation.spec.tsx | 49 ------------------- .../app/components/txs/tx-list-navigation.tsx | 9 ++-- .../src/app/hooks/get-txs-data-url.ts | 2 +- .../src/app/hooks/get-txs-data-urls.spec.ts | 4 +- apps/explorer/src/app/hooks/use-txs-data.ts | 12 ++--- .../src/app/routes/txs/home/index.tsx | 14 +++++- 6 files changed, 25 insertions(+), 65 deletions(-) diff --git a/apps/explorer/src/app/components/txs/tx-list-navigation.spec.tsx b/apps/explorer/src/app/components/txs/tx-list-navigation.spec.tsx index d08d3da526..c0a70bf1c9 100644 --- a/apps/explorer/src/app/components/txs/tx-list-navigation.spec.tsx +++ b/apps/explorer/src/app/components/txs/tx-list-navigation.spec.tsx @@ -61,53 +61,4 @@ describe('TxsListNavigation', () => { expect(nextPageMock).toHaveBeenCalledTimes(1); }); - - it('disables "Older" button if hasMoreTxs is false', () => { - render( - - - - ); - - expect(screen.getByText('Older')).toBeDisabled(); - }); - - it('disables "Newer" button if hasPreviousPage is false', () => { - render( - - - - ); - - expect(screen.getByText('Newer')).toBeDisabled(); - }); - - it('disables both buttons when more and previous are false', () => { - render( - - - - ); - - expect(screen.getByText('Newer')).toBeDisabled(); - expect(screen.getByText('Older')).toBeDisabled(); - }); }); diff --git a/apps/explorer/src/app/components/txs/tx-list-navigation.tsx b/apps/explorer/src/app/components/txs/tx-list-navigation.tsx index 50ae37035d..ff89aea521 100644 --- a/apps/explorer/src/app/components/txs/tx-list-navigation.tsx +++ b/apps/explorer/src/app/components/txs/tx-list-navigation.tsx @@ -10,7 +10,8 @@ export interface TxListNavigationProps { loading?: boolean; hasPreviousPage: boolean; hasMoreTxs: boolean; - children: React.ReactNode; + children?: React.ReactNode; + isEmpty?: boolean; } /** * Displays a list of transactions with filters and controls to navigate through the list. @@ -21,9 +22,8 @@ export const TxsListNavigation = ({ refreshTxs, nextPage, previousPage, - hasMoreTxs, - hasPreviousPage, children, + isEmpty, loading = false, }: TxListNavigationProps) => { return ( @@ -35,7 +35,6 @@ export const TxsListNavigation = ({