From d1f49b8403d1d28bd378d1833a8fadefd16a7ecc Mon Sep 17 00:00:00 2001 From: Dima Portenko Date: Wed, 25 Aug 2021 11:40:09 +0200 Subject: [PATCH 1/2] fix: on Account Address screen --- src/components/account/AddAccountAddress.js | 8 ++++++-- src/components/common/ModalSelect.js | 6 +----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/account/AddAccountAddress.js b/src/components/account/AddAccountAddress.js index a1aaf14..4e1eeb9 100644 --- a/src/components/account/AddAccountAddress.js +++ b/src/components/account/AddAccountAddress.js @@ -122,7 +122,7 @@ class AddAccountAddress extends Component { renderRegions = () => { const theme = this.context; - const { countryId, countries } = this.props; + const { countryId, countries, region } = this.props; if (countryId && countryId.length && countries && countries.length) { const country = countries.find(item => item.id === countryId); if (country && country.available_regions) { @@ -131,11 +131,15 @@ class AddAccountAddress extends Component { key: value.id, })); + const label = region?.region + ? region?.region + : translate('common.region'); + return ( { const [value, setValue] = useState(''); const _onChange = option => { - setValue( - attribute === 'CurrencyCode' - ? option.label - : `${label} : ${option.label}`, - ); + setValue(option.label); if (onChange) { onChange(attribute, option.key); From 5e34313e028e426c567b32aa69540867f05c19fb Mon Sep 17 00:00:00 2001 From: Dima Portenko Date: Wed, 25 Aug 2021 11:56:10 +0200 Subject: [PATCH 2/2] fix: checkout country/region picker label --- src/components/account/AddAccountAddress.js | 2 ++ .../checkout/CheckoutCustomerAccount.js | 17 ++++++++++++++--- src/components/common/ModalSelect.js | 12 ++++++++++-- src/components/home/CurrencyPicker.js | 1 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/account/AddAccountAddress.js b/src/components/account/AddAccountAddress.js index 4e1eeb9..09f9d4b 100644 --- a/src/components/account/AddAccountAddress.js +++ b/src/components/account/AddAccountAddress.js @@ -137,6 +137,7 @@ class AddAccountAddress extends Component { return ( item.id === countryId); if (country && country.available_regions) { @@ -193,11 +193,16 @@ class CheckoutCustomerAccount extends Component { key: value.id, })); + const label = region?.region + ? region?.region + : translate('common.region'); + return ( item.id === countryId); + const label = country + ? country.full_name_locale + : translate('common.country'); + return ( { +const ModalSelect = ({ + data, + disabled, + label, + onChange, + attribute, + style, + withLabel = true, +}) => { const [value, setValue] = useState(''); const _onChange = option => { - setValue(option.label); + setValue(!withLabel ? option.label : `${label} : ${option.label}`); if (onChange) { onChange(attribute, option.key); diff --git a/src/components/home/CurrencyPicker.js b/src/components/home/CurrencyPicker.js index e93b4a4..e15f1bd 100644 --- a/src/components/home/CurrencyPicker.js +++ b/src/components/home/CurrencyPicker.js @@ -34,6 +34,7 @@ const CurrencyPicker = ({ disabled={data.length === 0} label={selectedCurrencyCode} attribute="CurrencyCode" + withLabel={false} data={data} onChange={onChange} style={styles.currencyContainer}