Merge pull request #1341 from mirumee/SALEOR-3561/3.0/broken-page-title-in-address-book (#1347)

add fallback page title for nameless customers
This commit is contained in:
SektorDV 2021-08-31 14:34:25 +02:00 committed by GitHub
parent 9329277268
commit afd2b1dddb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -2599,6 +2599,10 @@
"src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_noAddressToShow": {
"string": "There is no address to show for this customer"
},
"src_dot_customers_dot_components_dot_CustomerAddressListPage_dot_noNameToShow": {
"context": "customer's address book when no customer name is available, header",
"string": "Address Book"
},
"src_dot_customers_dot_components_dot_CustomerAddress_dot_defaultAddress": {
"string": "Default Address"
},

View file

@ -34,6 +34,11 @@ const messages = defineMessages({
defaultMessage: "{fullName}'s Address Book",
description: "customer's address book, header"
},
noNameToShow: {
defaultMessage: "Address Book",
description:
"customer's address book when no customer name is available, header"
},
fullNameDetail: {
defaultMessage: "{fullName} Details",
description: "customer details, header"
@ -93,11 +98,17 @@ const CustomerAddressListPage: React.FC<CustomerAddressListPageProps> = props =>
return (
<Container>
<Backlink onClick={onBack}>
{intl.formatMessage(messages.fullNameDetail, { fullName })}
{fullName.trim().length > 0
? intl.formatMessage(messages.fullNameDetail, { fullName })
: intl.formatMessage(messages.noNameToShow)}
</Backlink>
{!isEmpty && (
<PageHeader
title={intl.formatMessage(messages.fullNameAddress, { fullName })}
title={
fullName.trim().length > 0
? intl.formatMessage(messages.fullNameAddress, { fullName })
: intl.formatMessage(messages.noNameToShow)
}
>
<Button color="primary" variant="contained" onClick={onAdd}>
{intl.formatMessage(messages.addAddress)}