diff options
Diffstat (limited to 'packages/demobank-ui/src/components/Transactions')
3 files changed, 11 insertions, 13 deletions
diff --git a/packages/demobank-ui/src/components/Transactions/index.ts b/packages/demobank-ui/src/components/Transactions/index.ts index 42b12ac65..c8bb1e108 100644 --- a/packages/demobank-ui/src/components/Transactions/index.ts +++ b/packages/demobank-ui/src/components/Transactions/index.ts @@ -55,8 +55,8 @@ export namespace State { amount?: string, }> | undefined; transactions: Transaction[]; - onPrev?: () => void; - onNext?: () => void; + onGoStart?: () => void; + onGoNext?: () => void; } } diff --git a/packages/demobank-ui/src/components/Transactions/state.ts b/packages/demobank-ui/src/components/Transactions/state.ts index 2d217989c..40e1b0ced 100644 --- a/packages/demobank-ui/src/components/Transactions/state.ts +++ b/packages/demobank-ui/src/components/Transactions/state.ts @@ -39,9 +39,7 @@ export function useComponentState({ account, routeCreateWireTransfer }: Props): } const transactions = - txResult.data.type === "fail" - ? [] - : txResult.data.body.transactions + txResult.result .map((tx) => { const negative = tx.direction === "debit"; const cp = parsePaytoUri( @@ -76,7 +74,7 @@ export function useComponentState({ account, routeCreateWireTransfer }: Props): error: undefined, routeCreateWireTransfer, transactions, - onNext: txResult.isLastPage ? undefined : txResult.loadMore, - onPrev: txResult.isFirstPage ? undefined : txResult.loadMorePrev, + onGoNext: txResult.isLastPage ? undefined : txResult.loadNext, + onGoStart: txResult.isFirstPage ? undefined : txResult.loadFirst, }; } diff --git a/packages/demobank-ui/src/components/Transactions/views.tsx b/packages/demobank-ui/src/components/Transactions/views.tsx index 321a6ff3a..ba400b37a 100644 --- a/packages/demobank-ui/src/components/Transactions/views.tsx +++ b/packages/demobank-ui/src/components/Transactions/views.tsx @@ -25,8 +25,8 @@ import { useAccountDetails } from "../../hooks/access.js"; export function ReadyView({ transactions, routeCreateWireTransfer, - onNext, - onPrev, + onGoNext, + onGoStart, }: State.Ready): VNode { const { i18n, dateLocale } = useTranslationContext(); const { config } = useBankCoreApiContext() @@ -219,16 +219,16 @@ export function ReadyView({ <button name="first page" class="relative disabled:bg-gray-100 disabled:text-gray-500 inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus-visible:outline-offset-0" - disabled={!onPrev} - onClick={onPrev} + disabled={!onGoStart} + onClick={onGoStart} > <i18n.Translate>First page</i18n.Translate> </button> <button name="next page" class="relative disabled:bg-gray-100 disabled:text-gray-500 ml-3 inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus-visible:outline-offset-0" - disabled={!onNext} - onClick={onNext} + disabled={!onGoNext} + onClick={onGoNext} > <i18n.Translate>Next</i18n.Translate> </button> |