From a6037d8364d4fef97144e1d81b80aedc942dc772 Mon Sep 17 00:00:00 2001 From: vashjs Date: Mon, 16 Oct 2023 09:15:18 +0100 Subject: [PATCH] Replace intl.formatNumber with component for consistency --- src/components/BulkEditLogs/BulkEditLogs.js | 5 ++--- src/utils/formatters.js | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/BulkEditLogs/BulkEditLogs.js b/src/components/BulkEditLogs/BulkEditLogs.js index b80fec15..9e13178b 100644 --- a/src/components/BulkEditLogs/BulkEditLogs.js +++ b/src/components/BulkEditLogs/BulkEditLogs.js @@ -1,6 +1,6 @@ import React from 'react'; import { useLocation, useHistory } from 'react-router-dom'; -import { FormattedMessage, useIntl } from 'react-intl'; +import { FormattedMessage } from 'react-intl'; import noop from 'lodash/noop'; import { AppIcon } from '@folio/stripes/core'; @@ -34,7 +34,6 @@ const sortableFields = LOGS_COLUMNS .map(({ value }) => value); const BulkEditLogs = () => { - const intl = useIntl(); const location = useLocation(); const history = useHistory(); const DEFAULT_SORTING = { [SORTING_PARAMETER]: 'endTime', [SORTING_DIRECTION_PARAMETER]: DESC_DIRECTION }; @@ -88,7 +87,7 @@ const BulkEditLogs = () => { totalCount={logsCount} columnMapping={columnMapping} visibleColumns={visibleColumns} - formatter={getLogsResultsFormatter(intl)} + formatter={getLogsResultsFormatter()} isEmptyMessage={resultsStatusMessage} sortOrder={sortingField} sortDirection={sortingDirection} diff --git a/src/utils/formatters.js b/src/utils/formatters.js index 627d562b..e9912826 100644 --- a/src/utils/formatters.js +++ b/src/utils/formatters.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage, FormattedNumber } from 'react-intl'; import { NoValue } from '@folio/stripes/components'; import { FolioFormattedTime } from '@folio/stripes-acq-components'; @@ -9,7 +9,7 @@ import { linkNamesMap } from '../constants'; const isActionsRendered = (item) => Object.keys(item).some(key => Object.keys(linkNamesMap).includes(key)); -export const getLogsResultsFormatter = (intl) => ({ +export const getLogsResultsFormatter = () => ({ id: item => item.id, operationType: item => item.operationType, entityType: item => , @@ -17,8 +17,8 @@ export const getLogsResultsFormatter = (intl) => ({ userId: item => item.runBy, startTime: item => , endTime: item => , - totalNumOfRecords: item => intl.formatNumber(item.totalNumOfRecords), - processedNumOfRecords: item => intl.formatNumber(item.processedNumOfRecords), + totalNumOfRecords: item => , + processedNumOfRecords: item => , editing: item => ( item.approach ?