Skip to content

Commit

Permalink
UIU-2976 - Show country name in user address instead of country id. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka authored Jan 19, 2024
1 parent fb340ee commit 6ed24d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Add `reminderFee` to loan action map. Fixes UIU-3014.
* Create new permission 'Users: Can view profile pictures'. Refs UIU-3018.
* Format currency values as currencies, not numbers. Refs UIU-2026.
* Show country name in user address instead of country id. Refs UIU-2976.

## [10.0.4](https://github.com/folio-org/ui-users/tree/v10.0.4) (2023-11-10)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v10.0.3...v10.0.4)
Expand Down
7 changes: 6 additions & 1 deletion src/components/UserAddresses/UserAddresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ class UserAddresses extends React.Component {
},
};

const updatedAddresses = addresses.map(addr => {
addr.country = intl.formatDisplayName(addr.country, { type: 'region' });
return addr;
});

return (<AddressList
label={<FormattedMessage id="ui-users.contact.addresses" />}
onUpdate={this.onUpdate}
onCreate={this.onUpdate}
onDelete={this.onDelete}
fieldComponents={addressFields}
addresses={addresses}
addresses={updatedAddresses}
expanded={expanded}
canEdit={editable}
canDelete={editable}
Expand Down
1 change: 1 addition & 0 deletions src/components/UserAddresses/UserAddresses.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const props = {
onUpdate: updateMock,
intl: {
formatMessage: jest.fn(),
formatDisplayName: jest.fn(),
},
expanded: false,
editable: true,
Expand Down
1 change: 1 addition & 0 deletions test/jest/__mock__/intl.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jest.mock('react-intl', () => {
const intl = {
formatMessage: ({ id }) => id,
formatNumber: (value) => value,
formatDisplayName: (value) => value,
};

return {
Expand Down

0 comments on commit 6ed24d8

Please sign in to comment.