Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix layout if user has partial address data
dominik-zeglen1548aba53224
diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx b/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsxindex 441ddc14ac..150634ccbf 100644--- a/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx@@ -52,31 +52,33 @@ const CustomerAddresses = withStyles(styles, { name: "CustomerAddresses" })(</Button>}/>- {customer &&- customer.defaultBillingAddress &&- customer.defaultBillingAddress.id &&- customer.defaultShippingAddress &&- customer.defaultShippingAddress.id &&- customer.defaultBillingAddress.id !==- customer.defaultShippingAddress.id ? (+ {maybe(() => customer.defaultBillingAddress.id) !==+ maybe(() => customer.defaultShippingAddress.id) ? (<>- <CardContent>- <Typography className={classes.label}>- {i18n.t("Billing address")}- </Typography>- <AddressFormatter- address={maybe(() => customer.defaultBillingAddress)}- />- </CardContent>- <Hr />- <CardContent>- <Typography className={classes.label}>- {i18n.t("Shipping address")}- </Typography>- <AddressFormatter- address={maybe(() => customer.defaultShippingAddress)}- />- </CardContent>+ {maybe(() => customer.defaultBillingAddress) !== null && (+ <CardContent>+ <Typography className={classes.label}>+ {i18n.t("Billing address")}+ </Typography>+ <AddressFormatter+ address={maybe(() => customer.defaultBillingAddress)}+ />+ </CardContent>+ )}+ {maybe(+ () =>+ customer.defaultBillingAddress && customer.defaultShippingAddress+ ) && <Hr />}+ {maybe(() => customer.defaultShippingAddress) && (+ <CardContent>+ <Typography className={classes.label}>+ {i18n.t("Shipping address")}+ </Typography>+ <AddressFormatter+ address={maybe(() => customer.defaultShippingAddress)}+ />+ </CardContent>+ )}</>) : (<CardContent>diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsxindex 9dac66871c..2bac088126 100644--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx@@ -75,4 +75,22 @@ storiesOf("Views / Customers / Customer details", module)}}}/>+ ))+ .add("no default billing address", () => (+ <CustomerDetailsPage+ {...props}+ customer={{+ ...customer,+ defaultBillingAddress: null+ }}+ />+ ))+ .add("no default shipping address", () => (+ <CustomerDetailsPage+ {...props}+ customer={{+ ...customer,+ defaultShippingAddress: null+ }}+ />));