Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add empty state
dominik-zeglenbd7f5f8b49af
diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsxindex fbeec0be13..97e923e065 100644--- a/saleor/static/dashboard-next/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx@@ -5,6 +5,7 @@ import {withStyles,WithStyles} from "@material-ui/core/styles";+import Typography from "@material-ui/core/Typography";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -29,6 +30,17 @@ export interface CustomerAddressListPageProps {const styles = (theme: Theme) =>createStyles({+ addButton: {+ marginTop: theme.spacing.unit * 2+ },+ description: {+ marginTop: theme.spacing.unit+ },+ empty: {+ margin: `${theme.spacing.unit * 5}px auto 0`,+ textAlign: "center",+ width: 600+ },root: {columnGap: theme.spacing.unit * 3 + "px",display: "grid",@@ -49,55 +61,84 @@ const CustomerAddressListPage = withStyles(styles, {onEdit,onRemove,onSetAsDefault- }: CustomerAddressListPageProps & WithStyles<typeof styles>) => (- <Container>- <AppHeader onBack={onBack}>- {i18n.t("Customer Info", {- context: "navigation"- })}- </AppHeader>- <PageHeader- title={maybe(() =>- i18n.t("{{ firstName }} {{ lastName }} Address Book", {- context: "customer address book",- firstName: customer.firstName,- lastName: customer.lastName- })- )}- >- <Button color="secondary" variant="contained" onClick={onAdd}>- {i18n.t("Add address", {- context: "add customer address"+ }: CustomerAddressListPageProps & WithStyles<typeof styles>) => {+ const isEmpty = maybe(() => customer.addresses.length) === 0;+ return (+ <Container>+ <AppHeader onBack={onBack}>+ {i18n.t("Customer Info", {+ context: "navigation"})}- <AddIcon />- </Button>- </PageHeader>- <div className={classes.root}>- {renderCollection(- maybe(() => customer.addresses),- (address, addressNumber) => (- <CustomerAddress- address={address}- addressNumber={addressNumber + 1}- disabled={disabled}- isDefaultBillingAddress={- maybe(() => customer.defaultBillingAddress.id) ===- maybe(() => address.id)- }- isDefaultShippingAddress={- maybe(() => customer.defaultShippingAddress.id) ===- maybe(() => address.id)- }- onEdit={() => onEdit(address.id)}- onRemove={() => onRemove(address.id)}- onSetAsDefault={type => onSetAsDefault(address.id, type)}- key={maybe(() => address.id, "skeleton")}- />- )+ </AppHeader>+ <PageHeader+ title={maybe(() =>+ i18n.t("{{ firstName }} {{ lastName }} Address Book", {+ context: "customer address book",+ firstName: customer.firstName,+ lastName: customer.lastName+ })+ )}+ >+ {!isEmpty && (+ <Button color="secondary" variant="contained" onClick={onAdd}>+ {i18n.t("Add address", {+ context: "add customer address"+ })}+ <AddIcon />+ </Button>+ )}+ </PageHeader>+ {isEmpty ? (+ <div className={classes.empty}>+ <Typography variant="headline">+ {i18n.t("There is no address to show for this customer")}+ </Typography>+ <Typography className={classes.description}>+ {i18n.t(+ "This customer doesn’t have any adresses added to his address book. You can add address using the button below."+ )}+ </Typography>+ <Button+ className={classes.addButton}+ color="secondary"+ variant="contained"+ onClick={onAdd}+ >+ {i18n.t("Add address", {+ context: "add customer address"+ })}+ <AddIcon />+ </Button>+ </div>+ ) : (+ <div className={classes.root}>+ {renderCollection(+ maybe(() => customer.addresses),+ (address, addressNumber) => (+ <CustomerAddress+ address={address}+ addressNumber={addressNumber + 1}+ disabled={disabled}+ isDefaultBillingAddress={+ maybe(() => customer.defaultBillingAddress.id) ===+ maybe(() => address.id)+ }+ isDefaultShippingAddress={+ maybe(() => customer.defaultShippingAddress.id) ===+ maybe(() => address.id)+ }+ onEdit={() => onEdit(address.id)}+ onRemove={() => onRemove(address.id)}+ onSetAsDefault={type => onSetAsDefault(address.id, type)}+ key={maybe(() => address.id, "skeleton")}+ />+ )+ )}+ </div>)}- </div>- </Container>- )+ </Container>+ );+ });CustomerAddressListPage.displayName = "CustomerAddressListPage";export default CustomerAddressListPage;