diff --git a/libs/funding-payments/src/lib/funding-payments-data-provider.ts b/libs/funding-payments/src/lib/funding-payments-data-provider.ts index 88a9c9f6e..409cb21b0 100644 --- a/libs/funding-payments/src/lib/funding-payments-data-provider.ts +++ b/libs/funding-payments/src/lib/funding-payments-data-provider.ts @@ -43,7 +43,7 @@ export const fundingPaymentsProvider = makeDataProvider< pagination: { getPageInfo, append, - first: 100, + first: 1000, }, }); diff --git a/libs/funding-payments/src/lib/funding-payments-manager.tsx b/libs/funding-payments/src/lib/funding-payments-manager.tsx index 3dcfd396f..a4bf7d2fd 100644 --- a/libs/funding-payments/src/lib/funding-payments-manager.tsx +++ b/libs/funding-payments/src/lib/funding-payments-manager.tsx @@ -1,10 +1,11 @@ import type { AgGridReact } from 'ag-grid-react'; -import { useRef } from 'react'; +import { useCallback, useRef, useState } from 'react'; import { t } from '@vegaprotocol/i18n'; import { FundingPaymentsTable } from './funding-payments-table'; import type { useDataGridEvents } from '@vegaprotocol/datagrid'; import { useDataProvider } from '@vegaprotocol/data-provider'; import { fundingPaymentsWithMarketProvider } from './funding-payments-data-provider'; +import { TradingButton as Button } from '@vegaprotocol/ui-toolkit'; interface FundingPaymentsManagerProps { partyId: string; @@ -20,7 +21,17 @@ export const FundingPaymentsManager = ({ gridProps, }: FundingPaymentsManagerProps) => { const gridRef = useRef(null); - const { data, error } = useDataProvider({ + const [hasDisplayedRow, setHasDisplayedRow] = useState( + undefined + ); + const { onFilterChanged, ...props } = gridProps || {}; + const onRowDataUpdated = useCallback( + ({ api }: { api: AgGridReact['api'] }) => { + setHasDisplayedRow(!!api.getDisplayedRowCount()); + }, + [] + ); + const { data, error, load, pageInfo } = useDataProvider({ dataProvider: fundingPaymentsWithMarketProvider, update: ({ data }) => { if (data?.length && gridRef.current?.api) { @@ -33,12 +44,43 @@ export const FundingPaymentsManager = ({ }); return ( - +
+ { + onRowDataUpdated(event); + onFilterChanged(event); + }} + onRowDataUpdated={onRowDataUpdated} + overlayNoRowsTemplate={error ? error.message : t('No funding payments')} + {...props} + /> +
+
+ {t( + 'Depending on data node retention you may not be able see the "full" history' + )} +
+
+ {data?.length && !pageInfo?.hasNextPage + ? t('all %s items loaded', [data.length.toString()]) + : t('%s items loaded', [ + data?.length ? data.length.toString() : ' ', + ])} + {pageInfo?.hasNextPage ? ( + + ) : null} +
+ {data?.length && hasDisplayedRow === false ? ( +
+ {t('No funding payments matching selected filters')} +
+ ) : null} +
+
); };