Skip to content

Commit

Permalink
Replace intl.formatNumber with component for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Oct 16, 2023
1 parent dc3b22f commit a6037d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/components/BulkEditLogs/BulkEditLogs.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -88,7 +87,7 @@ const BulkEditLogs = () => {
totalCount={logsCount}
columnMapping={columnMapping}
visibleColumns={visibleColumns}
formatter={getLogsResultsFormatter(intl)}
formatter={getLogsResultsFormatter()}
isEmptyMessage={resultsStatusMessage}
sortOrder={sortingField}
sortDirection={sortingDirection}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/formatters.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -9,16 +9,16 @@ 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 => <FormattedMessage id={`ui-bulk-edit.logs.entityType.${item.entityType}`} />,
status: item => <FormattedMessage id={`ui-bulk-edit.logs.status.${item.status}`} />,
userId: item => item.runBy,
startTime: item => <FolioFormattedTime dateString={item.startTime} />,
endTime: item => <FolioFormattedTime dateString={item.endTime} />,
totalNumOfRecords: item => intl.formatNumber(item.totalNumOfRecords),
processedNumOfRecords: item => intl.formatNumber(item.processedNumOfRecords),
totalNumOfRecords: item => <FormattedNumber value={item.totalNumOfRecords} />,
processedNumOfRecords: item => <FormattedNumber value={item.processedNumOfRecords} />,
editing: item => (
item.approach
? <FormattedMessage id={`ui-bulk-edit.logs.approach.${item.approach}`} />
Expand Down

0 comments on commit a6037d8

Please sign in to comment.