diff --git a/lib/api/resources.ts b/lib/api/resources.ts index 48d465e164..826046f9ac 100644 --- a/lib/api/resources.ts +++ b/lib/api/resources.ts @@ -61,7 +61,7 @@ import type { BlockEpochElectionRewardDetailsResponse, } from 'types/api/block'; import type { ChartMarketResponse, ChartSecondaryCoinPriceResponse, ChartTransactionResponse } from 'types/api/charts'; -import type { BackendVersionConfig } from 'types/api/configs'; +import type { BackendVersionConfig, CsvExportConfig } from 'types/api/configs'; import type { SmartContract, SmartContractVerificationConfigRaw, @@ -917,6 +917,9 @@ export const RESOURCES = { config_backend_version: { path: '/api/v2/config/backend-version', }, + config_csv_export: { + path: '/api/v2/config/csv-export', + }, // CSV EXPORT csv_export_token_holders: { @@ -1114,6 +1117,7 @@ never; /* eslint-disable @typescript-eslint/indent */ export type ResourcePayloadB = Q extends 'config_backend_version' ? BackendVersionConfig : +Q extends 'config_csv_export' ? CsvExportConfig : Q extends 'address_metadata_info' ? AddressMetadataInfo : Q extends 'address_metadata_tag_types' ? PublicTagTypesResponse : Q extends 'blob' ? Blob : diff --git a/types/api/configs.ts b/types/api/configs.ts index c04e29c359..b190c0f2b9 100644 --- a/types/api/configs.ts +++ b/types/api/configs.ts @@ -1,3 +1,7 @@ export interface BackendVersionConfig { backend_version: string; } + +export interface CsvExportConfig { + limit: number; +} diff --git a/ui/pages/CsvExport.pw.tsx b/ui/pages/CsvExport.pw.tsx index 87e24c6a96..a21b063ae8 100644 --- a/ui/pages/CsvExport.pw.tsx +++ b/ui/pages/CsvExport.pw.tsx @@ -15,6 +15,7 @@ test('base view +@mobile +@dark-mode', async({ render, page, mockApiResponse }) }, }; await mockApiResponse('address', addressMock.validator, { pathParams: { hash: addressMock.hash } }); + await mockApiResponse('config_csv_export', { limit: 42123 }); const component = await render(, { hooksConfig }); diff --git a/ui/pages/CsvExport.tsx b/ui/pages/CsvExport.tsx index 7431c3b609..6e69b7066f 100644 --- a/ui/pages/CsvExport.tsx +++ b/ui/pages/CsvExport.tsx @@ -88,7 +88,13 @@ const CsvExport = () => { }, }); - const isLoading = addressQuery.isPending || (exportTypeParam === 'holders' && tokenQuery.isPending); + const configQuery = useApiQuery('config_csv_export', { + queryOptions: { + enabled: Boolean(addressHash), + }, + }); + + const isLoading = addressQuery.isPending || configQuery.isPending || (exportTypeParam === 'holders' && tokenQuery.isPending); const backLink = React.useMemo(() => { const hasGoBackLink = appProps.referrer && appProps.referrer.includes('/address'); @@ -147,6 +153,8 @@ const CsvExport = () => { return null; } + const limit = (configQuery.data?.limit || 10_000).toLocaleString(undefined, { maximumFractionDigits: 3, notation: 'compact' }); + if (exportTypeParam === 'holders') { return ( @@ -160,7 +168,7 @@ const CsvExport = () => { noSymbol /> to CSV file. - Exports are limited to the top 10K holders by amount held. + Exports are limited to the top { limit } holders by amount held. ); } @@ -176,7 +184,7 @@ const CsvExport = () => { { nbsp } { filterType && filterValue && with applied filter by { filterType } ({ filterValue }) } to CSV file. - Exports are limited to the last 10K { exportType.text }. + Exports are limited to the last { limit } { exportType.text }. ); })(); diff --git a/ui/pages/__screenshots__/CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png b/ui/pages/__screenshots__/CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png index e5daa6120d..c2d480301c 100644 Binary files a/ui/pages/__screenshots__/CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png and b/ui/pages/__screenshots__/CsvExport.pw.tsx_dark-color-mode_base-view-mobile-dark-mode-1.png differ diff --git a/ui/pages/__screenshots__/CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png b/ui/pages/__screenshots__/CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png index 3fbbd9f208..2568887488 100644 Binary files a/ui/pages/__screenshots__/CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png and b/ui/pages/__screenshots__/CsvExport.pw.tsx_default_base-view-mobile-dark-mode-1.png differ diff --git a/ui/pages/__screenshots__/CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png b/ui/pages/__screenshots__/CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png index 6a089cd481..d6eeb2d7af 100644 Binary files a/ui/pages/__screenshots__/CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png and b/ui/pages/__screenshots__/CsvExport.pw.tsx_mobile_base-view-mobile-dark-mode-1.png differ