Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change app theme
dominik-zeglen7f842d06920f
diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsxindex 767144245b..0608a3d916 100644--- a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx+++ b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx@@ -71,11 +71,7 @@ const AttributeDetailsPage = decorate<AttributeDetailsPageProps>(<PageHeadertitle={attribute ? attribute.name : undefined}onBack={onBack}- >- <IconButton disabled={disabled} onClick={toggleDeleteDialog}>- <DeleteIcon />- </IconButton>- </PageHeader>+ /><div className={classes.root}><div><AttributeDetails@@ -92,6 +88,8 @@ const AttributeDetailsPage = decorate<AttributeDetailsPageProps>(</div></div><SaveButtonBar+ onCancel={onBack}+ onDelete={toggleDeleteDialog}state={saveButtonBarState}disabled={disabled || !hasChanged}onSave={submit}diff --git a/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsx b/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsxindex df854da02e..43c5734f53 100644--- a/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsx+++ b/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -31,9 +31,14 @@ const AttributeListPage: React.StatelessComponent<AttributeListPageProps> = ({}) => (<Container width="md"><PageHeader title={i18n.t("Attributes")}>- <IconButton disabled={disabled} onClick={onAdd}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ disabled={disabled}+ onClick={onAdd}+ >+ {i18n.t("Add attribute")} <AddIcon />+ </Button></PageHeader><AttributeListattributes={attributes}diff --git a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx b/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsxindex c8c3589a63..58221f5fb5 100644--- a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx+++ b/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx@@ -1,3 +1,4 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";@@ -6,13 +7,12 @@ import TableBody from "@material-ui/core/TableBody";import TableCell from "@material-ui/core/TableCell";import TableHead from "@material-ui/core/TableHead";import TableRow from "@material-ui/core/TableRow";-import AddIcon from "@material-ui/icons/Add";import CloseIcon from "@material-ui/icons/Close";import * as React from "react";import Skeleton from "../../../components/Skeleton";+import CardTitle from "../../../components/CardTitle";import { EditableTableCell } from "../../../components/EditableTableCell/EditableTableCell";-import PageHeader from "../../../components/PageHeader";import i18n from "../../../i18n";interface AttributeValueListProps {@@ -73,11 +73,19 @@ const AttributeValueList = decorate<AttributeValueListProps>(} as any);return (<Card className={classes.root}>- <PageHeader title={i18n.t("Attribute values")}>- <IconButton disabled={disabled} onClick={handleAdd}>- <AddIcon />- </IconButton>- </PageHeader>+ <CardTitle+ title={i18n.t("Attribute values")}+ toolbar={+ <Button+ color="secondary"+ variant="flat"+ disabled={disabled}+ onClick={handleAdd}+ >+ {i18n.t("Add value")}+ </Button>+ }+ /><Table><TableHead><TableRow>diff --git a/saleor/static/dashboard-next/attributes/index.ts b/saleor/static/dashboard-next/attributes/index.tsnew file mode 100644index 0000000000..6a77bba468--- /dev/null+++ b/saleor/static/dashboard-next/attributes/index.ts@@ -0,0 +1 @@+export const attributesListUrl = "/attributes/";diff --git a/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx b/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsxindex 7e19d9baed..0469920788 100644--- a/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryDetailsPage/CategoryDetailsPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import { withStyles } from "@material-ui/core/styles";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -83,21 +83,24 @@ const CategoryDetailsPage = decorate<CategoryDetailsPageProps>(<><Container width="md"><PageHeader- onBack={!isRoot ? onBack : undefined}+ onBack={isRoot ? undefined : onBack}title={- !isRoot- ? category+ isRoot+ ? i18n.t("Categories")+ : category? category.name: undefined- : i18n.t("Categories")}>- {!!onAddProduct &&- isRoot && (- <IconButton onClick={onAddProduct}>- <AddIcon />- </IconButton>- )}+ {isRoot && (+ <Button+ color="secondary"+ variant="contained"+ onClick={onAddCategory}+ >+ {i18n.t("Add category")} <AddIcon />+ </Button>+ )}</PageHeader><div className={classes.root}>{!isRoot && (diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsxindex c289c49f52..81987abd83 100644--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx@@ -1,15 +1,14 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";-import IconButton from "@material-ui/core/IconButton";import List from "@material-ui/core/List";import ListItem from "@material-ui/core/ListItem";import ListItemIcon from "@material-ui/core/ListItemIcon";import ListItemText from "@material-ui/core/ListItemText";import ListSubheader from "@material-ui/core/ListSubheader";-import AddIcon from "@material-ui/icons/Add";import Folder from "@material-ui/icons/Folder";import * as React from "react";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";@@ -31,13 +30,14 @@ const CategoryList: React.StatelessComponent<CategoryListProps> = ({}) => (<Card>{displayTitle && (- <PageHeader title={i18n.t("Categories")}>- {!!onAdd && (- <IconButton onClick={onAdd}>- <AddIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Categories")}+ toolbar={+ <Button color="secondary" variant="flat" onClick={onAdd}>+ {i18n.t("Add category")}+ </Button>+ }+ />)}<List>{categories === undefined || categories === null ? (diff --git a/saleor/static/dashboard-next/categories/components/CategoryProducts/CategoryProducts.tsx b/saleor/static/dashboard-next/categories/components/CategoryProducts/CategoryProducts.tsxindex 4a3ac389be..eb2315ee7c 100644--- a/saleor/static/dashboard-next/categories/components/CategoryProducts/CategoryProducts.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryProducts/CategoryProducts.tsx@@ -1,7 +1,5 @@-import Avatar from "@material-ui/core/Avatar";+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";-import blue from "@material-ui/core/colors/blue";-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import Table from "@material-ui/core/Table";import TableBody from "@material-ui/core/TableBody";@@ -9,24 +7,21 @@ import TableCell from "@material-ui/core/TableCell";import TableFooter from "@material-ui/core/TableFooter";import TableHead from "@material-ui/core/TableHead";import TableRow from "@material-ui/core/TableRow";-import AddIcon from "@material-ui/icons/Add";-import Cached from "@material-ui/icons/Cached";import * as React from "react";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import Skeleton from "../../../components/Skeleton";+import TableCellAvatar from "../../../components/TableCellAvatar";import TablePagination from "../../../components/TablePagination";import i18n from "../../../i18n";const decorate = withStyles(theme => ({- avatarCell: {- paddingLeft: theme.spacing.unit * 2,- paddingRight: 0,- width: theme.spacing.unit * 5- },link: {- color: blue[500],+ color: theme.palette.secondary.main,cursor: "pointer"+ },+ textLeft: {+ textAlign: "left" as "left"}}));@@ -59,18 +54,21 @@ export const ProductList = decorate<ProductListProps>(onRowClick}) => (<Card>- <PageHeader title={i18n.t("Products")}>- {!!onAddProduct && (- <IconButton onClick={onAddProduct}>- <AddIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Products")}+ toolbar={+ <Button variant="flat" color="secondary" onClick={onAddProduct}>+ {i18n.t("Add product")}+ </Button>+ }+ /><Table><TableHead><TableRow>- <TableCell className={classes.avatarCell} />- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>+ <TableCell />+ <TableCell className={classes.textLeft}>+ {i18n.t("Name", { context: "object" })}+ </TableCell><TableCell>{i18n.t("Type", { context: "object" })}</TableCell></TableRow></TableHead>@@ -88,11 +86,7 @@ export const ProductList = decorate<ProductListProps>(<TableBody>{products === undefined || products === null ? (<TableRow>- <TableCell className={classes.avatarCell}>- <Avatar>- <Cached />- </Avatar>- </TableCell>+ <TableCellAvatar /><TableCell><Skeleton /></TableCell>@@ -103,10 +97,8 @@ export const ProductList = decorate<ProductListProps>() : products.length > 0 ? (products.map(product => (<TableRow key={product.id}>- <TableCell className={classes.avatarCell}>- <Avatar src={product.thumbnailUrl} />- </TableCell>- <TableCell>+ <TableCellAvatar thumbnail={product.thumbnailUrl} />+ <TableCell className={classes.textLeft}><spanonClick={onRowClick ? onRowClick(product.id) : undefined}className={onRowClick ? classes.link : ""}@@ -119,8 +111,7 @@ export const ProductList = decorate<ProductListProps>())) : (<TableRow>- <TableCell className={classes.avatarCell} />- <TableCell colSpan={2}>{i18n.t("No products found")}</TableCell>+ <TableCell colSpan={3}>{i18n.t("No products found")}</TableCell></TableRow>)}</TableBody>diff --git a/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx b/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsxindex 5e46a0aff9..946b0d9e6c 100644--- a/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx+++ b/saleor/static/dashboard-next/categories/components/CategoryProperties/CategoryProperties.tsx@@ -1,12 +1,10 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import CardContent from "@material-ui/core/CardContent";-import IconButton from "@material-ui/core/IconButton";import Typography from "@material-ui/core/Typography";-import DeleteIcon from "@material-ui/icons/Delete";-import EditIcon from "@material-ui/icons/Edit";import * as React from "react";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";@@ -22,18 +20,19 @@ const CategoryProperties: React.StatelessComponent<CategoryPropertiesProps> = ({onEdit}) => (<Card>- <PageHeader title={i18n.t("Details")}>- {!!onEdit && (- <IconButton onClick={onEdit}>- <EditIcon />- </IconButton>- )}- {!!onDelete && (- <IconButton onClick={onDelete}>- <DeleteIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Details")}+ toolbar={+ <>+ <Button variant="flat" color="secondary" onClick={onEdit}>+ {i18n.t("Edit category")}+ </Button>+ <Button variant="flat" color="secondary" onClick={onDelete}>+ {i18n.t("Remove category")}+ </Button>+ </>+ }+ /><CardContent>{description === undefined ? (<Skeleton />diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsxindex 51a8c79236..f3bd9d00bc 100644--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx@@ -1,8 +1,6 @@import DialogContentText from "@material-ui/core/DialogContentText";-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import { withStyles } from "@material-ui/core/styles";-import DeleteIcon from "@material-ui/icons/Delete";-import VisibilityIcon from "@material-ui/icons/Visibility";import * as React from "react";import ActionDialog from "../../../components/ActionDialog";@@ -113,15 +111,14 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(title={collection ? collection.name : undefined}onBack={onBack}>- <IconButton disabled={disabled} onClick={onShow}>- <VisibilityIcon />- </IconButton>- <IconButton+ <Button+ color="secondary"+ variant="flat"disabled={disabled}- onClick={toggleRemoveDialog}+ onClick={onShow}>- <DeleteIcon />- </IconButton>+ {i18n.t("Show on storefront")}+ </Button></PageHeader><div className={classes.root}><div>@@ -144,6 +141,9 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(/><div className={classes.cardSpacer} /><SeoForm+ helperText={i18n.t(+ "Add search engine title and description to make this collection easier to find"+ )}description={data.seoDescription}descriptionPlaceholder={collection && collection.seoDescription@@ -169,6 +169,7 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(</div></div><SaveButtonBar+ onDelete={toggleRemoveDialog}onSave={submit}disabled={disabled || !onSubmit || !hasChanged}state={saveButtonBarState}diff --git a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsxindex 8ff1b2b702..7baa1e255c 100644--- a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -31,9 +31,14 @@ const CollectionListPage: React.StatelessComponent<CollectionListPageProps> = ({}) => (<Container width="md"><PageHeader title={i18n.t("Collections")}>- <IconButton disabled={disabled} onClick={onAdd}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ disabled={disabled}+ onClick={onAdd}+ >+ {i18n.t("Add collection")} <AddIcon />+ </Button></PageHeader><CollectionListcollections={collections}diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsxindex 99d0122904..9d6650c02a 100644--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx@@ -1,5 +1,5 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import Table from "@material-ui/core/Table";import TableBody from "@material-ui/core/TableBody";@@ -7,10 +7,9 @@ import TableCell from "@material-ui/core/TableCell";import TableFooter from "@material-ui/core/TableFooter";import TableHead from "@material-ui/core/TableHead";import TableRow from "@material-ui/core/TableRow";-import AddIcon from "@material-ui/icons/Add";import * as React from "react";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import Skeleton from "../../../components/Skeleton";import StatusLabel from "../../../components/StatusLabel";import TablePagination from "../../../components/TablePagination";@@ -61,11 +60,19 @@ const CollectionProducts = decorate<CollectionProductsProps>(onProductClick}) => (<Card className={classes.root}>- <PageHeader title={i18n.t("Products")}>- <IconButton disabled={disabled} onClick={onProductAdd}>- <AddIcon />- </IconButton>- </PageHeader>+ <CardTitle+ title={i18n.t("Products")}+ toolbar={+ <Button+ color="secondary"+ variant="flat"+ disabled={disabled}+ onClick={onProductAdd}+ >+ {i18n.t("Add product")}+ </Button>+ }+ /><Table><TableHead><TableRow>diff --git a/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsx b/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsxindex c77acbed5c..1b673b2242 100644--- a/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsx+++ b/saleor/static/dashboard-next/collections/components/CollectionProperties/CollectionProperties.tsx@@ -4,9 +4,9 @@ import { withStyles } from "@material-ui/core/styles";import TextField from "@material-ui/core/TextField";import * as React from "react";+import CardTitle from "../../../components/CardTitle";import ControlledCheckbox from "../../../components/ControlledCheckbox";import FormSpacer from "../../../components/FormSpacer";-import PageHeader from "../../../components/PageHeader";import i18n from "../../../i18n";interface CollectionPropertiesProps {@@ -31,7 +31,7 @@ const decorate = withStyles(theme => ({const CollectionProperties = decorate<CollectionPropertiesProps>(({ classes, collection, data, disabled, onChange }) => (<Card className={classes.root}>- <PageHeader title={i18n.t("Properties")} />+ <CardTitle title={i18n.t("Properties")} /><CardContent><ControlledCheckboxchecked={data.isPublished}diff --git a/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx b/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsxnew file mode 100644index 0000000000..854ff51588--- /dev/null+++ b/saleor/static/dashboard-next/components/CardTitle/CardTitle.tsx@@ -0,0 +1,50 @@+import { withStyles } from "@material-ui/core/styles";+import Typography from "@material-ui/core/Typography";+import * as React from "react";++interface CardTitleProps extends React.StatelessComponent {+ title: string;+ toolbar?: React.ReactNode;+ onClick?: (event: React.MouseEvent<any>) => void;+}++const decorate = withStyles(theme => ({+ children: theme.mixins.gutters({}),+ hr: {+ backgroundColor: "#eaeaea",+ border: "none",+ height: 1,+ marginBottom: 0+ },+ root: theme.mixins.gutters({+ display: "flex",+ height: theme.spacing.unit * 6,+ paddingBottom: theme.spacing.unit * 2,+ paddingTop: theme.spacing.unit * 2+ }),+ title: {+ flex: 1,+ fontSize: "1rem",+ fontWeight: 600 as 600+ },+ toolbar: {+ marginRight: -theme.spacing.unit * 2,+ marginTop: -theme.spacing.unit * 0.75 + "px"+ }+}));+const CardTitle = decorate<CardTitleProps>(+ ({ classes, children, title, toolbar, onClick, ...props }) => (+ <>+ <div className={classes.root} {...props}>+ <Typography className={classes.title} variant="body2" onClick={onClick}>+ {title}+ </Typography>+ <div className={classes.toolbar}>{toolbar}</div>+ </div>+ <div className={classes.children}>{children}</div>+ <hr className={classes.hr} />+ </>+ )+);+CardTitle.displayName = "CardTitle";+export default CardTitle;diff --git a/saleor/static/dashboard-next/components/CardTitle/index.ts b/saleor/static/dashboard-next/components/CardTitle/index.tsnew file mode 100644index 0000000000..0adbc156d2--- /dev/null+++ b/saleor/static/dashboard-next/components/CardTitle/index.ts@@ -0,0 +1,2 @@+export { default } from "./CardTitle";+export * from "./CardTitle";diff --git a/saleor/static/dashboard-next/components/ControlledCheckbox.tsx b/saleor/static/dashboard-next/components/ControlledCheckbox.tsxindex 905eb9ffdf..0f45637401 100644--- a/saleor/static/dashboard-next/components/ControlledCheckbox.tsx+++ b/saleor/static/dashboard-next/components/ControlledCheckbox.tsx@@ -18,8 +18,9 @@ export const ControlledCheckbox: React.StatelessComponent<control={<Checkboxchecked={checked}- onChange={() => onChange({ target: { name, value: !checked } })}+ color="primary"name={name}+ onChange={() => onChange({ target: { name, value: !checked } })}/>}label={label}diff --git a/saleor/static/dashboard-next/components/ControlledSwitch.tsx b/saleor/static/dashboard-next/components/ControlledSwitch.tsxindex 23da3575a1..777059a830 100644--- a/saleor/static/dashboard-next/components/ControlledSwitch.tsx+++ b/saleor/static/dashboard-next/components/ControlledSwitch.tsx@@ -1,3 +1,4 @@+import { withStyles } from "@material-ui/core";import FormControlLabel from "@material-ui/core/FormControlLabel";import Switch from "@material-ui/core/Switch";import * as React from "react";@@ -5,18 +6,38 @@ import * as React from "react";interface ControlledSwitchProps {checked: boolean;disabled?: boolean;- uncheckedLabel?: string;label: string;+ name: string;+ uncheckedLabel?: string;onChange?(event: React.ChangeEvent<any>);}-export const ControlledSwitch: React.StatelessComponent<- ControlledSwitchProps-> = ({ checked, disabled, onChange, label, uncheckedLabel }) => (- <FormControlLabel- control={<Switch onChange={onChange} checked={checked} color="primary" />}- label={uncheckedLabel ? (checked ? label : uncheckedLabel) : label}- disabled={disabled}- />+const decorate = withStyles(theme => ({+ label: {+ marginLeft: theme.spacing.unit * 2+ }+}));+export const ControlledSwitch = decorate<ControlledSwitchProps>(+ ({ classes, checked, disabled, onChange, label, name, uncheckedLabel }) => (+ <FormControlLabel+ control={+ <Switch+ onChange={() =>+ onChange({ target: { name, value: !checked } } as any)+ }+ checked={checked}+ color="primary"+ name={name}+ />+ }+ label={+ <div className={classes.label}>+ {uncheckedLabel ? (checked ? label : uncheckedLabel) : label}+ </div>+ }+ disabled={disabled}+ />+ ));+ControlledSwitch.displayName = "ControlledSwitch";export default ControlledSwitch;diff --git a/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx b/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsxindex 5de74592d5..675a0dc35e 100644--- a/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx+++ b/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx@@ -1,16 +1,11 @@-import ArrowBackIcon from "@material-ui/icons/ArrowBack";-import CloseIcon from "@material-ui/icons/Close";import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";-import Typography from "@material-ui/core/Typography";+import ArrowBackIcon from "@material-ui/icons/ArrowBack";import * as React from "react";-import Skeleton from "../Skeleton";-const decorate = withStyles(theme => ({action: {- flex: "0 0 auto",- marginRight: theme.spacing.unit * -2+ flex: "0 0 auto"},grid: {padding: theme.spacing.unit * 2@@ -18,12 +13,15 @@ const decorate = withStyles(theme => ({menuButton: {flex: "0 0 auto",marginLeft: theme.spacing.unit * -2,- marginRight: theme.spacing.unit * 3+ marginRight: theme.spacing.unit * 3,+ marginTop: -theme.spacing.unit * 2},- root: theme.mixins.gutters({+ root: {alignItems: "center",- display: "flex"- }),+ display: "flex",+ marginBottom: theme.spacing.unit * 3,+ marginTop: theme.spacing.unit * 3+ },subtitle: {alignItems: "center" as "center",display: "flex",@@ -31,8 +29,7 @@ const decorate = withStyles(theme => ({},title: {flex: 1,- paddingBottom: theme.spacing.unit * 2,- paddingTop: theme.spacing.unit * 2+ paddingBottom: theme.spacing.unit * 2}}));diff --git a/saleor/static/dashboard-next/components/FormSpacer.tsx b/saleor/static/dashboard-next/components/FormSpacer.tsxindex 9e28df8d00..8f64ae69c2 100644--- a/saleor/static/dashboard-next/components/FormSpacer.tsx+++ b/saleor/static/dashboard-next/components/FormSpacer.tsx@@ -7,7 +7,7 @@ interface FormSpacerProps {const decorate = withStyles(theme => ({spacer: {- marginTop: theme.spacing.unit * 2+ marginTop: theme.spacing.unit * 3}}));export const FormSpacer = decorate<FormSpacerProps>(({ classes, children }) => (diff --git a/saleor/static/dashboard-next/components/Money/Money.tsx b/saleor/static/dashboard-next/components/Money/Money.tsxindex 066d1274a7..c39c0be57c 100644--- a/saleor/static/dashboard-next/components/Money/Money.tsx+++ b/saleor/static/dashboard-next/components/Money/Money.tsx@@ -1,4 +1,3 @@-import { withStyles } from "@material-ui/core/styles";import Typography, { TypographyProps } from "@material-ui/core/Typography";import * as React from "react";@@ -8,26 +7,21 @@ interface MoneyProps {typographyProps?: TypographyProps;}-const decorate = withStyles(theme => ({- currency: {- color: theme.palette.grey[500]+export const Money: React.StatelessComponent<MoneyProps> = ({+ amount,+ currency,+ typographyProps+}) => {+ const money =+ currency === "%"+ ? [amount, currency].join(" ")+ : amount.toLocaleString(navigator.language, {+ currency,+ style: "currency"+ });+ if (typographyProps) {+ return <Typography {...typographyProps}>{money}</Typography>;}-}));-const Money = decorate<MoneyProps>(- ({ classes, amount, currency, typographyProps }) => (- <Typography {...typographyProps}>- {amount.toFixed(2)}{" "}- <span- className={[- classes.currency,- typographyProps && typographyProps.className- ? typographyProps.className- : ""- ].join(" ")}- >- {currency}- </span>- </Typography>- )-);+ return <>{money}</>;+};export default Money;diff --git a/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx b/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsxindex 5108faa9ec..0c309ce658 100644--- a/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx+++ b/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx@@ -1,7 +1,5 @@-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import Typography from "@material-ui/core/Typography";-import ArrowBackIcon from "@material-ui/icons/ArrowBack";import * as React from "react";import ExtendedPageHeader from "../ExtendedPageHeader";@@ -11,8 +9,7 @@ const decorate = withStyles(theme => ({title: {flex: 1,- paddingBottom: theme.spacing.unit * 2,- paddingTop: theme.spacing.unit * 2+ paddingBottom: theme.spacing.unit * 2}}),{ name: "PageHeader" }diff --git a/saleor/static/dashboard-next/components/PriceField/PriceField.tsx b/saleor/static/dashboard-next/components/PriceField/PriceField.tsxindex f753fdddde..d92ae77653 100644--- a/saleor/static/dashboard-next/components/PriceField/PriceField.tsx+++ b/saleor/static/dashboard-next/components/PriceField/PriceField.tsx@@ -21,6 +21,9 @@ interface PriceRangeFieldProps {}const decorate = withStyles(theme => ({+ currencySymbol: {+ fontSize: "0.875rem"+ },inputContainer: {display: "grid",gridTemplateColumns: "1fr 2rem 1fr"@@ -128,7 +131,9 @@ export const PriceField = decorate<PriceFieldProps>(value={value || ""}endAdornment={currencySymbol ? (- <InputAdornment position="end">{currencySymbol}</InputAdornment>+ <InputAdornment position="end" className={classes.currencySymbol}>+ {currencySymbol}+ </InputAdornment>) : (<span />)diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsxindex a4fff5a154..23d4dfd3c8 100644--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx@@ -1,5 +1,3 @@-import Avatar from "@material-ui/core/Avatar";-import blue from "@material-ui/core/colors/blue";import { withStyles } from "@material-ui/core/styles";import Table from "@material-ui/core/Table";import TableBody from "@material-ui/core/TableBody";@@ -7,12 +5,15 @@ import TableCell from "@material-ui/core/TableCell";import TableFooter from "@material-ui/core/TableFooter";import TableHead from "@material-ui/core/TableHead";import TableRow from "@material-ui/core/TableRow";-import Cached from "@material-ui/icons/Cached";import * as React from "react";import { ListProps } from "../..";+import TableCellAvatar from "../../components/TableCellAvatar";import i18n from "../../i18n";+import { MoneyType } from "../../products";+import Money from "../Money";import Skeleton from "../Skeleton";+import StatusLabel from "../StatusLabel";import TablePagination from "../TablePagination";const decorate = withStyles(theme => ({@@ -22,8 +23,10 @@ const decorate = withStyles(theme => ({width: theme.spacing.unit * 5},link: {- color: blue[500],- cursor: "pointer"+ cursor: "pointer" as "pointer"+ },+ textLeft: {+ textAlign: "left" as "left"}}));@@ -35,6 +38,10 @@ interface ProductListProps extends ListProps {name: string;};thumbnailUrl: string;+ availability: {+ available: boolean;+ };+ price: MoneyType;}>;}@@ -51,15 +58,19 @@ export const ProductList = decorate<ProductListProps>(<Table><TableHead><TableRow>- <TableCell className={classes.avatarCell} />- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>+ <TableCell />+ <TableCell className={classes.textLeft}>+ {i18n.t("Name", { context: "object" })}+ </TableCell><TableCell>{i18n.t("Type", { context: "object" })}</TableCell>+ <TableCell>{i18n.t("Published", { context: "object" })}</TableCell>+ <TableCell>{i18n.t("Price", { context: "object" })}</TableCell></TableRow></TableHead><TableFooter><TableRow><TablePagination- colSpan={3}+ colSpan={5}hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}onNextPage={onNextPage}hasPreviousPage={@@ -70,12 +81,14 @@ export const ProductList = decorate<ProductListProps>(</TableRow></TableFooter><TableBody>- {products === undefined || products === null ? (+ {products === undefined ? (<TableRow>- <TableCell className={classes.avatarCell}>- <Avatar>- <Cached />- </Avatar>+ <TableCellAvatar />+ <TableCell>+ <Skeleton />+ </TableCell>+ <TableCell>+ <Skeleton /></TableCell><TableCell><Skeleton />@@ -84,13 +97,11 @@ export const ProductList = decorate<ProductListProps>(<Skeleton /></TableCell></TableRow>- ) : products.length > 0 ? (+ ) : products !== null && products.length > 0 ? (products.map(product => (<TableRow key={product.id}>- <TableCell className={classes.avatarCell}>- <Avatar src={product.thumbnailUrl} />- </TableCell>- <TableCell>+ <TableCellAvatar thumbnail={product.thumbnailUrl} />+ <TableCell className={classes.textLeft}><spanonClick={onRowClick ? onRowClick(product.id) : undefined}className={onRowClick ? classes.link : ""}@@ -99,12 +110,40 @@ export const ProductList = decorate<ProductListProps>(</span></TableCell><TableCell>{product.productType.name}</TableCell>+ <TableCell>+ {product.availability &&+ product.availability.available !== undefined ? (+ <StatusLabel+ label={+ product.availability.available+ ? i18n.t("Published")+ : i18n.t("Not published")+ }+ status={+ product.availability.available ? "success" : "error"+ }+ />+ ) : (+ <Skeleton />+ )}+ </TableCell>+ <TableCell>+ {product.price &&+ product.price.amount !== undefined &&+ product.price.currency ? (+ <Money+ amount={product.price.amount}+ currency={product.price.currency}+ />+ ) : (+ <Skeleton />+ )}+ </TableCell></TableRow>))) : (<TableRow>- <TableCell className={classes.avatarCell} />- <TableCell colSpan={2}>{i18n.t("No products found")}</TableCell>+ <TableCell colSpan={5}>{i18n.t("No products found")}</TableCell></TableRow>)}</TableBody>diff --git a/saleor/static/dashboard-next/components/RichTextEditor.tsx b/saleor/static/dashboard-next/components/RichTextEditor.tsxindex d53bc55af8..f81082ae6a 100644--- a/saleor/static/dashboard-next/components/RichTextEditor.tsx+++ b/saleor/static/dashboard-next/components/RichTextEditor.tsx@@ -5,7 +5,6 @@ import InputLabel from "@material-ui/core/InputLabel";import * as React from "react";interface RichTextEditorProps {- defaultValue?: string;disabled?: boolean;error?: boolean;fullWidth?: boolean;@@ -17,7 +16,6 @@ interface RichTextEditorProps {}export const RichTextEditor: React.StatelessComponent<RichTextEditorProps> = ({- defaultValue,disabled,error,fullWidth,@@ -28,16 +26,12 @@ export const RichTextEditor: React.StatelessComponent<RichTextEditorProps> = ({value}) => (<FormControl style={fullWidth ? { width: "100%" } : {}} error={error}>- {label && (- <InputLabel shrink={!!(value || defaultValue)}>{label}</InputLabel>- )}+ {label && <InputLabel shrink={!!value}>{label}</InputLabel>}<Inputdisabled={disabled}multiline- rows={10}name={name}- {...(value ? { value } : {})}- {...(defaultValue ? { defaultValue } : {})}+ value={value}onChange={onChange}fullWidth={fullWidth}/>diff --git a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsxindex 1a5dcba7c7..7e633b27e5 100644--- a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx+++ b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx@@ -3,7 +3,6 @@ import CircularProgress from "@material-ui/core/CircularProgress";import gray from "@material-ui/core/colors/grey";import { withStyles } from "@material-ui/core/styles";import CheckIcon from "@material-ui/icons/Check";-import CloseIcon from "@material-ui/icons/Close";import * as React from "react";import i18n from "../../i18n";@@ -16,10 +15,27 @@ export type SaveButtonBarState =interface SaveButtonBarProps {disabled?: boolean;state?: SaveButtonBarState;+ labels?: {+ cancel?: string;+ delete?: string;+ save?: string;+ };+ onCancel?: () => void;+ onDelete?: () => void;onSave(event: any);}const decorate = withStyles(theme => ({+ cancelButton: {+ marginRight: theme.spacing.unit * 2+ },+ deleteButton: {+ "&:hover": {+ backgroundColor: theme.palette.error.dark+ },+ backgroundColor: theme.palette.error.main,+ color: theme.palette.error.contrastText+ },root: {borderTop: `1px ${gray[300]} solid`,display: "flex",@@ -37,6 +53,9 @@ const decorate = withStyles(theme => ({marginRight: theme.spacing.unit},buttonProgress: {+ "& svg": {+ margin: 0+ },color: theme.palette.primary.main,marginBottom: -theme.spacing.unit * 1.5,marginLeft: -theme.spacing.unit * 0.5,@@ -66,7 +85,16 @@ const decorate = withStyles(theme => ({}}));export const SaveButtonBar = decorate<SaveButtonBarProps>(- ({ classes, disabled, state, onSave, ...props }) => {+ ({+ classes,+ disabled,+ labels,+ state,+ onCancel,+ onDelete,+ onSave,+ ...props+ }) => {let buttonClassName;let buttonLabel;switch (state) {@@ -84,12 +112,30 @@ export const SaveButtonBar = decorate<SaveButtonBarProps>(break;default:buttonClassName = "";- buttonLabel = i18n.t("Save");+ buttonLabel = labels && labels.save ? labels.save : i18n.t("Save");break;}return (<div className={classes.root}>+ {!!onDelete && (+ <Button+ variant="contained"+ onClick={onDelete}+ className={classes.deleteButton}+ >+ {labels && labels.delete ? labels.delete : i18n.t("Remove")}+ </Button>+ )}<div className={classes.spacer} />+ {!!onCancel && (+ <Button+ className={classes.cancelButton}+ variant="flat"+ onClick={onCancel}+ >+ {labels && labels.cancel ? labels.cancel : i18n.t("Cancel")}+ </Button>+ )}<Buttonvariant="contained"onClick={onSave}diff --git a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsxindex 365392a865..f8a1674e17 100644--- a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx+++ b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx@@ -1,24 +1,23 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import CardContent from "@material-ui/core/CardContent";-import ExpansionPanel from "@material-ui/core/ExpansionPanel";-import ExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";-import ExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";import { withStyles } from "@material-ui/core/styles";import TextField from "@material-ui/core/TextField";import Typography from "@material-ui/core/Typography";-import ExpandMoreIcon from "@material-ui/icons/ExpandMore";import * as React from "react";import i18n from "../../i18n";+import CardTitle from "../CardTitle";import FormSpacer from "../FormSpacer";-import PageHeader from "../PageHeader";import Skeleton from "../Skeleton";+import Toggle from "../Toggle";interface SeoFormProps {description?: string;descriptionPlaceholder: string;disabled?: boolean;loading?: boolean;+ helperText?: string;title: string;titlePlaceholder: string;storefrontUrl?: string;@@ -45,6 +44,15 @@ const decorate = withStyles(theme => ({lineHeight: "18px",overflowWrap: "break-word" as "break-word"},+ helperText: {+ marginBottom: theme.spacing.unit * 3+ },+ label: {+ flex: 1+ },+ labelContainer: {+ display: "flex" as "flex"+ },preview: {minHeight: theme.spacing.unit * 10},@@ -65,84 +73,88 @@ const SeoForm = decorate<SeoFormProps>(({classes,description,- descriptionPlaceholder,disabled,+ helperText,loading,- storefrontUrl,title,- titlePlaceholder,- onChange,- onClick+ onChange}) => (- <Card>- <ExpansionPanel>- <ExpansionPanelSummary- expandIcon={<ExpandMoreIcon />}- className={classes.title}- >- <PageHeader title={i18n.t("Search Engine Preview")} />- </ExpansionPanelSummary>- <ExpansionPanelDetails>- <div className={classes.container}>- <div className={classes.preview}>- {loading ? (- <Skeleton />- ) : (- <>- {!!storefrontUrl &&- (title || titlePlaceholder) && (- <>- <Typography- className={classes.titleBar}- onClick={onClick}- style={!!onClick ? { cursor: "pointer" } : {}}- >- {(title || titlePlaceholder).substr(0, 70)}- </Typography>- <Typography className={classes.addressBar}>- {storefrontUrl}- </Typography>- <Typography className={classes.descriptionBar}>- {(description || descriptionPlaceholder).substr(- 0,- 300- )}- </Typography>- </>- )}- </>- )}- </div>- <FormSpacer />- <TextField- name="seoTitle"- label={i18n.t("Search engine title")}- helperText={i18n.t(- "If empty, the preview shows what will be autogenerated."- )}- value={title.slice(0, 70)}- disabled={loading}- onChange={onChange}- fullWidth- />- <FormSpacer />- <TextField- name="seoDescription"- label={i18n.t("Search engine description")}- helperText={i18n.t(- "If empty, the preview shows what will be autogenerated."- )}- value={description ? description.slice(0, 300) : undefined}- onChange={onChange}- disabled={loading}- fullWidth- multiline- rows={10}- />- </div>- </ExpansionPanelDetails>- </ExpansionPanel>- </Card>+ <Toggle>+ {(toggled, { toggle }) => (+ <Card>+ <CardTitle+ title={i18n.t("Search Engine Preview")}+ toolbar={+ <Button color="secondary" variant="flat" onClick={toggle}>+ {i18n.t("Edit website SEO")}+ </Button>+ }+ />+ <CardContent>+ {helperText && (+ <Typography className={toggled ? classes.helperText : ""}>+ {helperText}+ </Typography>+ )}+ {toggled && (+ <div className={classes.container}>+ <TextField+ name="seoTitle"+ label={+ <div className={classes.labelContainer}>+ <div className={classes.label}>+ {i18n.t("Search engine title")}+ </div>+ <span>+ {i18n.t(+ "{{ letters }} of {{ maxLetters }} characters",+ { letters: title.length, maxLetters: 70 }+ )}+ </span>+ </div>+ }+ helperText={i18n.t(+ "If empty, the preview shows what will be autogenerated."+ )}+ value={title.slice(0, 69)}+ disabled={loading || disabled}+ InputLabelProps={{ shrink: true }}+ onChange={onChange}+ fullWidth+ />+ <FormSpacer />+ <TextField+ name="seoDescription"+ label={+ <div className={classes.labelContainer}>+ <div className={classes.label}>+ {i18n.t("Search engine description")}+ </div>+ <span>+ {i18n.t(+ "{{ letters }} of {{ maxLetters }} characters",+ { letters: description.length, maxLetters: 300 }+ )}+ </span>+ </div>+ }+ helperText={i18n.t(+ "If empty, the preview shows what will be autogenerated."+ )}+ value={description ? description.slice(0, 299) : undefined}+ onChange={onChange}+ disabled={loading || disabled}+ fullWidth+ multiline+ InputLabelProps={{ shrink: true }}+ rows={10}+ />+ </div>+ )}+ </CardContent>+ </Card>+ )}+ </Toggle>));export default SeoForm;diff --git a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsxindex 6826692d05..ba7e882683 100644--- a/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx+++ b/saleor/static/dashboard-next/components/SingleSelectField/SingleSelectField.tsx@@ -40,12 +40,13 @@ export const SingleSelectField = decorate<SingleSelectFieldProps>(hint,selectProps}) => {- const choicesByKey: { [key: string]: string } = disabled- ? {}- : choices.reduce((prev, curr) => {- prev[curr.value] = curr.label;- return prev;- }, {});+ const choicesByKey: { [key: string]: string } =+ choices === undefined+ ? {}+ : choices.reduce((prev, curr) => {+ prev[curr.value] = curr.label;+ return prev;+ }, {});return (<FormControldiff --git a/saleor/static/dashboard-next/components/StatusLabel/StatusLabel.tsx b/saleor/static/dashboard-next/components/StatusLabel/StatusLabel.tsxindex bd354deade..26f68e2e77 100644--- a/saleor/static/dashboard-next/components/StatusLabel/StatusLabel.tsx+++ b/saleor/static/dashboard-next/components/StatusLabel/StatusLabel.tsx@@ -1,12 +1,13 @@import yellow from "@material-ui/core/colors/yellow";import { withStyles } from "@material-ui/core/styles";-import Typography from "@material-ui/core/Typography";+import Typography, { TypographyProps } from "@material-ui/core/Typography";import * as React from "react";interface StatusLabelProps {className?: string;label: string;status: "success" | "neutral" | "error" | string;+ typographyProps?: TypographyProps;}const decorate = withStyles(theme => {@@ -40,7 +41,7 @@ const decorate = withStyles(theme => {};});const StatusLabel = decorate<StatusLabelProps>(- ({ classes, className, label, status }) => (+ ({ classes, className, label, status, typographyProps }) => (<div className={[classes.root, className].join(" ")}><spanclassName={@@ -51,9 +52,17 @@ const StatusLabel = decorate<StatusLabelProps>(: classes.errorDot}/>- <Typography component="span" className={classes.span}>- {label}- </Typography>+ {typographyProps ? (+ <Typography+ component="span"+ className={classes.span}+ {...typographyProps}+ >+ {label}+ </Typography>+ ) : (+ label+ )}</div>));diff --git a/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsxnew file mode 100644index 0000000000..d987041d03--- /dev/null+++ b/saleor/static/dashboard-next/components/TableCellAvatar/TableCellAvatar.tsx@@ -0,0 +1,43 @@+import Avatar from "@material-ui/core/Avatar";+import { withStyles } from "@material-ui/core/styles";+import TableCell from "@material-ui/core/TableCell";+import Cached from "@material-ui/icons/Cached";+import * as React from "react";++interface TableCellAvatarProps {+ thumbnail?: string;+}++const decorate = withStyles(theme => ({+ avatar: {+ background: "none",+ border: "1px solid #eaeaea",+ borderRadius: 2,+ color: "#bdbdbd",+ padding: theme.spacing.unit / 2+ },+ root: {+ paddingLeft: theme.spacing.unit * 3,+ paddingRight: theme.spacing.unit * 3,+ width: 5 * theme.spacing.unit+ }+}));+const TableCellAvatar = decorate<TableCellAvatarProps>(+ ({ classes, thumbnail }) => (+ <TableCell className={classes.root}>+ {thumbnail === undefined ? (+ <Avatar className={classes.avatar}>+ <Cached />+ </Avatar>+ ) : thumbnail === null ? (+ <Avatar className={classes.avatar}>+ <Cached />+ </Avatar>+ ) : (+ <Avatar className={classes.avatar} src={thumbnail} />+ )}+ </TableCell>+ )+);+TableCellAvatar.displayName = "TableCellAvatar";+export default TableCellAvatar;diff --git a/saleor/static/dashboard-next/components/TableCellAvatar/index.ts b/saleor/static/dashboard-next/components/TableCellAvatar/index.tsnew file mode 100644index 0000000000..606c7449a3--- /dev/null+++ b/saleor/static/dashboard-next/components/TableCellAvatar/index.ts@@ -0,0 +1,2 @@+export { default } from "./TableCellAvatar";+export * from "./TableCellAvatar";diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx b/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsxindex b91956bdb4..83050223e4 100644--- a/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx@@ -1,14 +1,13 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import CardContent from "@material-ui/core/CardContent";-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import Typography from "@material-ui/core/Typography";-import EditIcon from "@material-ui/icons/Edit";import * as React from "react";import { AddressType } from "../../";import AddressFormatter from "../../../components/AddressFormatter";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import i18n from "../../../i18n";interface CustomerAddressProps {@@ -36,24 +35,38 @@ const CustomerAddress = decorate<CustomerAddressProps>(onShippingAddressEdit}) => (<Card>- <PageHeader title={i18n.t("Default billing address")}>- {!!onBillingAddressEdit && (- <IconButton onClick={onBillingAddressEdit}>- <EditIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Default billing address")}+ toolbar={+ !!onBillingAddressEdit && (+ <Button+ color="secondary"+ variant="flat"+ onClick={onBillingAddressEdit}+ >+ {i18n.t("Edit address")}+ </Button>+ )+ }+ /><CardContent><AddressFormatter address={billingAddress} /></CardContent><hr className={classes.hr} />- <PageHeader title={i18n.t("Default shipping address")}>- {!!onShippingAddressEdit && (- <IconButton onClick={onShippingAddressEdit}>- <EditIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Default shipping address")}+ toolbar={+ !!onShippingAddressEdit && (+ <Button+ color="secondary"+ variant="flat"+ onClick={onShippingAddressEdit}+ >+ {i18n.t("Edit address")}+ </Button>+ )+ }+ /><CardContent>{billingAddress &&shippingAddress &&diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsxindex 959717046d..d3d452dad8 100644--- a/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx@@ -1,14 +1,12 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import CardContent from "@material-ui/core/CardContent";-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import Typography from "@material-ui/core/Typography";-import DeleteIcon from "@material-ui/icons/Delete";-import EditIcon from "@material-ui/icons/Edit";import * as React from "react";+import CardTitle from "../../../components/CardTitle";import DateFormatter from "../../../components/DateFormatter";-import ExtendedPageHeader from "../../../components/ExtendedPageHeader";import Skeleton from "../../../components/Skeleton";import StatusLabel from "../../../components/StatusLabel";import i18n from "../../../i18n";@@ -28,8 +26,7 @@ interface CustomerDetailsProps {const decorate = withStyles(theme => ({date: {- position: "relative" as "relative",- top: -theme.spacing.unit * 4+ marginBottom: theme.spacing.unit * 2},header: {flex: 1,@@ -54,39 +51,41 @@ const decorate = withStyles(theme => ({const CustomerDetails = decorate<CustomerDetailsProps>(({ classes, customer, onDelete, onEdit }) => (<Card className={classes.root}>- <ExtendedPageHeader- title={- <div className={classes.header}>- {customer ? (- <>- <Typography variant="title" className={classes.title}>- {i18n.t("User details")}- </Typography>- <StatusLabel- className={classes.status}- status={customer.isActive ? "success" : "error"}- label={- customer.isActive ? i18n.t("Active") : i18n.t("Inactive")- }- />- </>- ) : (- <Skeleton style={{ width: "10rem" }} />- )}- </div>+ <CardTitle+ title={i18n.t("User details")}+ toolbar={+ <>+ <Button+ color="secondary"+ variant="flat"+ disabled={!customer}+ onClick={onEdit}+ >+ {i18n.t("Edit customer")}+ </Button>+ <Button+ color="secondary"+ variant="flat"+ disabled={!customer}+ onClick={onDelete}+ >+ {i18n.t("Remove customer")}+ </Button>+ </>}>- {!!onEdit && (- <IconButton onClick={onEdit} disabled={!customer}>- <EditIcon />- </IconButton>- )}- {!!onDelete && (- <IconButton onClick={onDelete} disabled={!customer}>- <DeleteIcon />- </IconButton>+ {customer ? (+ <Typography component="span">+ <StatusLabel+ className={classes.status}+ status={customer.isActive ? "success" : "error"}+ label={customer.isActive ? i18n.t("Active") : i18n.t("Inactive")}+ />+ </Typography>+ ) : (+ <Skeleton style={{ width: "10rem" }} />)}- </ExtendedPageHeader>+ </CardTitle><CardContent>{customer ? (<>diff --git a/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsxindex 85e4b9ea06..0d32a06b63 100644--- a/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx+++ b/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx@@ -1,6 +1,5 @@import Card from "@material-ui/core/Card";-import blue from "@material-ui/core/colors/blue";-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import { withStyles } from "@material-ui/core/styles";import Table from "@material-ui/core/Table";import TableBody from "@material-ui/core/TableBody";@@ -33,7 +32,7 @@ interface CustomerListPageProps extends PageListProps {const decorate = withStyles(theme => ({link: {- color: blue[500],+ color: theme.palette.secondary.main,cursor: "pointer"}}));@@ -50,9 +49,14 @@ const CustomerListPage = decorate<CustomerListPageProps>(}) => (<Container width="md"><PageHeader title={i18n.t("Customers")}>- <IconButton disabled={disabled} onClick={onAdd}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ disabled={disabled}+ onClick={onAdd}+ >+ {i18n.t("Add customer")} <AddIcon />+ </Button></PageHeader><Card><Table>diff --git a/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx b/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsxindex a5238ab777..517d6d729d 100644--- a/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx@@ -1,3 +1,4 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import CardContent from "@material-ui/core/CardContent";import blue from "@material-ui/core/colors/blue";@@ -10,6 +11,7 @@ import * as React from "react";import PageHeader from "../../../components/PageHeader";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";+import CardTitle from "../../../components/CardTitle";interface AddressType {city: string;@@ -73,16 +75,21 @@ const OrderCustomer = decorate<OrderCustomerProps>(onShippingAddressEdit}) => (<Card>- <PageHeader title={i18n.t("Customer")}>- {editCustomer && (- <IconButton- disabled={!onCustomerEditClick}- onClick={onCustomerEditClick}- >- <EditIcon />- </IconButton>- )}- </PageHeader>+ <CardTitle+ title={i18n.t("Customer")}+ toolbar={+ !!editCustomer && (+ <Button+ color="secondary"+ variant="flat"+ disabled={!onCustomerEditClick}+ onClick={onCustomerEditClick}+ >+ {i18n.t("Edit")}+ </Button>+ )+ }+ /><CardContent>{client === undefined || client === null ? (<>@@ -107,14 +114,21 @@ const OrderCustomer = decorate<OrderCustomerProps>(</CardContent><hr className={classes.hr} />- <PageHeader title={i18n.t("Shipping Address")}>- <IconButton- onClick={onShippingAddressEdit}- disabled={!onShippingAddressEdit && client === undefined}- >- <EditIcon />- </IconButton>- </PageHeader>+ <CardTitle+ title={i18n.t("Shipping Address")}+ toolbar={+ !!editCustomer && (+ <Button+ color="secondary"+ variant="flat"+ onClick={onShippingAddressEdit}+ disabled={!onShippingAddressEdit && client === undefined}+ >+ {i18n.t("Edit")}+ </Button>+ )+ }+ /><CardContent>{client === undefined || client === null ? (<>@@ -147,14 +161,21 @@ const OrderCustomer = decorate<OrderCustomerProps>(</CardContent><hr className={classes.hr} />- <PageHeader title={i18n.t("Billing Address")}>- <IconButton- onClick={onShippingAddressEdit}- disabled={!onShippingAddressEdit && client === undefined}- >- <EditIcon />- </IconButton>- </PageHeader>+ <CardTitle+ title={i18n.t("Billing Address")}+ toolbar={+ !!editCustomer && (+ <Button+ color="secondary"+ variant="flat"+ onClick={onBillingAddressEdit}+ disabled={!onBillingAddressEdit && client === undefined}+ >+ {i18n.t("Edit")}+ </Button>+ )+ }+ /><CardContent>{client === undefined || client === null ? (<>diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsxindex df502b239f..45ca828c42 100644--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx@@ -160,7 +160,7 @@ const decorate = withStyles(theme => ({root: {display: "grid",gridColumnGap: theme.spacing.unit * 2 + "px",- gridTemplateColumns: "3fr 1fr"+ gridTemplateColumns: "2.25fr 1fr"}}));class OrderDetailsPageComponent extends React.Component<diff --git a/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx b/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsxindex 3d94963c93..119d69b98a 100644--- a/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx@@ -15,10 +15,11 @@ import PrintIcon from "@material-ui/icons/Print";import * as React from "react";import { transformFulfillmentStatus } from "../..";-import PageHeader from "../../../components/PageHeader";+import CardTitle from "../../../components/CardTitle";import Skeleton from "../../../components/Skeleton";import StatusLabel from "../../../components/StatusLabel/StatusLabel";import i18n from "../../../i18n";+import TableCellAvatar from "../../../components/TableCellAvatar";interface OrderFulfillmentProps {id?: string;@@ -53,8 +54,8 @@ const decorate = withStyles(statusBar: {paddingTop: 0},- textRight: {- textAlign: "right" as "right"+ textLeft: {+ textAlign: [["left"], "!important"] as any}}),{ name: "OrderFulfillment" }@@ -71,52 +72,51 @@ const OrderFulfillment = decorate<OrderFulfillmentProps>(onPackingSlipClick}) => (<Card className={classes.root}>- <PageHeader+ <CardTitletitle={id ? i18n.t("Fulfillment #{{ id }}", { id }) : undefined}+ toolbar={+ status !== "cancelled" && (+ <Button+ color="secondary"+ variant="flat"+ disabled={!onPackingSlipClick}+ onClick={onPackingSlipClick}+ >+ {i18n.t("Packing slip")}+ </Button>+ )+ }>- {status !== "cancelled" && (- <IconButton- disabled={!onPackingSlipClick}- onClick={onPackingSlipClick}- >- <PrintIcon />- </IconButton>- )}- </PageHeader>- {status && (- <CardContent className={classes.statusBar}>+ {status && (<StatusLabelstatus={transformFulfillmentStatus(status).status}label={transformFulfillmentStatus(status).localized}+ typographyProps={{ variant: "body1" }}/>- </CardContent>- )}+ )}+ </CardTitle><Table><TableHead><TableRow><TableCell />- <TableCell>{i18n.t("Product")}</TableCell>+ <TableCell className={classes.textLeft}>+ {i18n.t("Product")}+ </TableCell></TableRow></TableHead><TableBody>{products ? (products.map(productLine => (<TableRow key={productLine.product.id}>- <TableCell className={classes.avatarCell}>- <Avatar src={productLine.product.thumbnailUrl} />- </TableCell>- <TableCell>+ <TableCellAvatar thumbnail={productLine.product.thumbnailUrl} />+ <TableCell className={classes.textLeft}>{productLine.product.name} x {productLine.quantity}</TableCell></TableRow>))) : (<TableRow>- <TableCell className={classes.avatarCell}>- <Avatar>- <Cached />- </Avatar>- </TableCell>+ <TableCellAvatar /><TableCell><Skeleton /></TableCell>diff --git a/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx b/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsxindex 61a4c909d0..cd52451081 100644--- a/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -48,9 +48,14 @@ const OrderListPage: React.StatelessComponent<OrderListPageProps> = ({return (<Container width="md"><PageHeader title={i18n.t("Orders")}>- <IconButton disabled={disabled} onClick={onAdd}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ disabled={disabled}+ onClick={onAdd}+ >+ {i18n.t("Add order")} <AddIcon />+ </Button></PageHeader><OrderListdateNow={dateNow}diff --git a/saleor/static/dashboard-next/orders/components/OrderProducts/OrderProducts.tsx b/saleor/static/dashboard-next/orders/components/OrderProducts/OrderProducts.tsxindex 52935e36d2..99036ac1dc 100644--- a/saleor/static/dashboard-next/orders/components/OrderProducts/OrderProducts.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderProducts/OrderProducts.tsx@@ -17,6 +17,7 @@ import Money from "../../../components/Money";import PageHeader from "../../../components/PageHeader";import Skeleton from "../../../components/Skeleton";import i18n from "../../../i18n";+import TableCellAvatar from "../../../components/TableCellAvatar";interface TaxedMoneyType {gross: {@@ -163,9 +164,7 @@ const OrderProducts = decorate<OrderProductsProps>(</IconButton></TableCell>) : (- <TableCell className={classes.avatarCell}>- <Avatar src={product.thumbnailUrl} />- </TableCell>+ <TableCellAvatar thumbnail={product.thumbnailUrl} />)}<TableCell><span@@ -231,7 +230,11 @@ const OrderProducts = decorate<OrderProductsProps>(<TableCell className={classes.textRight}><div className={classes.flexBox}>{subtotal ? (- <Money amount={subtotal.amount} currency={subtotal.currency} />+ <Money+ amount={subtotal.amount}+ currency={subtotal.currency}+ typographyProps={{ component: "p" }}+ />) : (<Skeleton />)}@@ -239,12 +242,17 @@ const OrderProducts = decorate<OrderProductsProps>(<Moneyamount={shippingMethod.price.amount}currency={shippingMethod.price.currency}+ typographyProps={{ component: "p" }}/>) : (<Skeleton />)}{total ? (- <Money amount={total.amount} currency={total.currency} />+ <Money+ amount={total.amount}+ currency={total.currency}+ typographyProps={{ component: "p" }}+ />) : (<Skeleton />)}@@ -265,7 +273,11 @@ const OrderProducts = decorate<OrderProductsProps>(<TableCell className={classes.textRight}><div className={classes.flexBox}>{paid ? (- <Money amount={paid.amount} currency={paid.currency} />+ <Money+ amount={paid.amount}+ currency={paid.currency}+ typographyProps={{ component: "p" }}+ />) : (<Skeleton />)}@@ -273,12 +285,17 @@ const OrderProducts = decorate<OrderProductsProps>(<Moneyamount={-refunded.amount}currency={refunded.currency}+ typographyProps={{ component: "p" }}/>) : (<Skeleton />)}{net ? (- <Money amount={net.amount} currency={net.currency} />+ <Money+ amount={net.amount}+ currency={net.currency}+ typographyProps={{ component: "p" }}+ />) : (<Skeleton />)}diff --git a/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx b/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsxindex d7482dde16..2b55e55fb1 100644--- a/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx+++ b/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx@@ -19,6 +19,7 @@ import i18n from "../../../i18n";import OrderProducts, {OrderProductsProps} from "../OrderProducts/OrderProducts";+import CardTitle from "../../../components/CardTitle";interface MoneyType {amount: number;@@ -107,21 +108,29 @@ const OrderSummary = decorate<OrderSummaryProps>(const isDraft = status === OrderStatus.DRAFT;return (<Card>- <PageHeader title={i18n.t("Order Summary")}>- {isDraft && (- <IconButton disabled={!onProductAdd} onClick={onProductAdd}>- <AddIcon />- </IconButton>- )}- </PageHeader>- {status && (- <CardContent className={classes.statusBar}>+ <CardTitle+ title={i18n.t("Order Summary")}+ toolbar={+ isDraft && (+ <Button+ color="secondary"+ variant="flat"+ disabled={!onProductAdd}+ onClick={onProductAdd}+ >+ {i18n.t("Add product")}+ </Button>+ )+ }+ >+ {status && (<StatusLabelstatus={orderStatus.status}label={orderStatus.localized}+ typographyProps={{ variant: "body1" }}/>- </CardContent>- )}+ )}+ </CardTitle><OrderProductsisDraft={isDraft}net={net}diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsxindex 75b09c61eb..3848928eb2 100644--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx@@ -1,4 +1,3 @@-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";import DeleteIcon from "@material-ui/icons/Delete";import * as React from "react";@@ -74,13 +73,7 @@ const PageDetailsPage = decorate<PageDetailsPageProps>({(opened, { toggle: togglePageDeleteDialog }) => (<Container width="md"><>- <PageHeader onBack={onBack} title={title}>- {!!onDelete && (- <IconButton onClick={togglePageDeleteDialog}>- <DeleteIcon />- </IconButton>- )}- </PageHeader>+ <PageHeader onBack={onBack} title={title} /><div className={classes.root}><div><PageContent@@ -104,17 +97,18 @@ const PageDetailsPage = decorate<PageDetailsPageProps>(<SaveButtonBardisabled={disabled || !onSubmit || !hasChanged}state={saveButtonBarState}+ onCancel={onBack}+ onDelete={togglePageDeleteDialog}onSave={submit}/>- {!!onDelete &&- !disabled && (- <PageDeleteDialog- opened={opened}- onConfirm={onDelete}- onClose={togglePageDeleteDialog}- title={page.title}- />- )}+ {!disabled && (+ <PageDeleteDialog+ opened={opened}+ onConfirm={onDelete}+ onClose={togglePageDeleteDialog}+ title={page.title}+ />+ )}</></Container>)}diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsxindex 493a2660c4..5f1e8adca1 100644--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx@@ -116,14 +116,7 @@ const ProductTypeDetailsPage = decorate<ProductTypeDetailsPageProps>(<PageHeadertitle={productType ? productType.name : undefined}onBack={onBack}- >- <IconButton- disabled={disabled}- onClick={toggleDeleteDialog}- >- <DeleteIcon />- </IconButton>- </PageHeader>+ /><div className={classes.root}><div><ProductTypeDetails@@ -157,6 +150,8 @@ const ProductTypeDetailsPage = decorate<ProductTypeDetailsPageProps>(</div></div><SaveButtonBar+ onCancel={onBack}+ onDelete={toggleDeleteDialog}onSave={submit}disabled={disabled || !hasChanged}state={saveButtonBarState}diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsxindex a55fe50117..2a958fd1a7 100644--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -43,9 +43,14 @@ const ProductTypeListPage: React.StatelessComponent<}) => (<Container width="md"><PageHeader title={i18n.t("Product types")}>- <IconButton disabled={disabled} onClick={onAdd}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ disabled={disabled}+ onClick={onAdd}+ >+ {i18n.t("Add product type")} <AddIcon />+ </Button></PageHeader><ProductTypeListproductTypes={productTypes}diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsxindex c2701e89fe..33d5a69b1f 100644--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx@@ -3,9 +3,9 @@ import CardContent from "@material-ui/core/CardContent";import { withStyles } from "@material-ui/core/styles";import * as React from "react";+import CardTitle from "../../../components/CardTitle";import ControlledCheckbox from "../../../components/ControlledCheckbox";import FormSpacer from "../../../components/FormSpacer";-import PageHeader from "../../../components/PageHeader";import SingleSelectField from "../../../components/SingleSelectField";import i18n from "../../../i18n";@@ -24,7 +24,7 @@ const decorate = withStyles(theme => ({ root: {} }));const ProductTypeProperties = decorate<ProductTypePropertiesProps>(({ classes, data, disabled, taxRates, onChange }) => (<Card>- <PageHeader title={i18n.t("Properties")} />+ <CardTitle title={i18n.t("Properties")} /><CardContent><ControlledCheckboxchecked={data.hasVariants}@@ -33,7 +33,6 @@ const ProductTypeProperties = decorate<ProductTypePropertiesProps>(name="hasVariants"onChange={onChange}/>- <FormSpacer /><ControlledCheckboxchecked={data.isShippingRequired}disabled={disabled}diff --git a/saleor/static/dashboard-next/storybook/stories/components/Money.tsx b/saleor/static/dashboard-next/storybook/stories/components/Money.tsxindex c9dcafd9e4..ecf3a066aa 100644--- a/saleor/static/dashboard-next/storybook/stories/components/Money.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/Money.tsx@@ -6,4 +6,4 @@ import Decorator from "../../Decorator";storiesOf("Generics / Money", module).addDecorator(Decorator)- .add("default", () => <Money amount={14} currency="$" />);+ .add("default", () => <Money amount={14} currency="EUR" />);diff --git a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsxindex dedda9996a..41ac394a46 100644--- a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx+++ b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx@@ -5,6 +5,8 @@ import SaveButtonBar from "../../../components/SaveButtonBar";import Decorator from "../../Decorator";const callbacks = {+ onCancel: () => {},+ onDelete: () => {},onSave: () => {}};diff --git a/saleor/static/dashboard-next/storybook/stories/vouchers/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/vouchers/VoucherDetailsPage.tsxindex 6fcdbbb5bd..baa70825d3 100644--- a/saleor/static/dashboard-next/storybook/stories/vouchers/VoucherDetailsPage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/vouchers/VoucherDetailsPage.tsx@@ -12,6 +12,7 @@ storiesOf("Views / Vouchers / Voucher details", module).addDecorator(Decorator).add("default", () => (<VoucherDetailsPage+ onBack={() => {}}currency="USD"voucher={vouchers[0]}onVoucherDelete={() => {}}@@ -20,4 +21,4 @@ storiesOf("Views / Vouchers / Voucher details", module)productSearchResults={products("")}/>))- .add("when loading", () => <VoucherDetailsPage disabled />);+ .add("when loading", () => <VoucherDetailsPage disabled onBack={() => {}} />);diff --git a/saleor/static/dashboard-next/theme.ts b/saleor/static/dashboard-next/theme.tsindex 2c03b48b93..adc9c78d7f 100644--- a/saleor/static/dashboard-next/theme.ts+++ b/saleor/static/dashboard-next/theme.ts@@ -1,5 +1,4 @@import { createMuiTheme } from "@material-ui/core/styles";-import { darken } from "@material-ui/core/styles/colorManipulator";const createShadow = (pv, pb, ps, uv, ub, us, av, ab, as) =>[@@ -9,27 +8,111 @@ const createShadow = (pv, pb, ps, uv, ub, us, av, ab, as) =>].join(",");const primary = "#2bb673";+const primaryLighter = "#5AB378";const secondary = "#03a9f4";+const error = "#CD5E5E";export default createMuiTheme({overrides: {+ MuiButton: {+ label: {+ fontWeight: 600+ },+ root: {+ "& svg": {+ marginLeft: 8+ },+ borderRadius: 8+ }+ },+ MuiCard: {+ root: {+ borderRadius: 8+ }+ },+ MuiInput: {+ root: {+ color: "#616161",+ fontSize: "0.875rem"+ },+ underline: {+ "&:after": {+ borderBottomColor: primaryLighter+ }+ }+ },+ MuiInputLabel: {+ formControl: {+ width: "100%"+ },+ root: {+ color: [[primaryLighter], "!important"] as any+ },+ shrink: {+ // Negates x0.75 scale+ width: "133%"+ }+ },+ MuiSwitch: {+ bar: {+ "$colorPrimary$checked + &": {+ backgroundColor: primaryLighter+ },+ backgroundColor: error,+ borderRadius: 12,+ height: 24,+ marginTop: -12,+ opacity: [["1"], "!important"] as any,+ width: 48+ },+ checked: {+ transform: "translateX(24px)"+ },+ icon: {+ backgroundColor: "#ffffff",+ boxShadow: "none",+ marginLeft: 4+ },+ iconChecked: {+ boxShadow: "none"+ }+ },MuiTableCell: {+ body: {+ color: "#616161"+ },+ head: {+ color: "#616161",+ fontSize: ".875rem",+ fontWeight: 600+ },root: {- paddingLeft: 0,"&:first-child": {- paddingLeft: 24 + "px"- }+ paddingLeft: 24 + "px",+ textAlign: "left" as "left"+ },+ "&:last-child": {+ textAlign: "right" as "right"+ },+ paddingLeft: 0,+ textAlign: "center" as "center"}}},palette: {+ error: {+ main: error+ },primary: {contrastText: "#ffffff",- main: primary+ main: primaryLighter},secondary: {contrastText: "#ffffff",main: secondary+ },+ text: {+ primary: "#616161"}},shadows: [diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsxindex 7f514407a0..582146d230 100644--- a/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx+++ b/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx@@ -1,7 +1,5 @@import DialogContentText from "@material-ui/core/DialogContentText";-import IconButton from "@material-ui/core/IconButton";import { withStyles } from "@material-ui/core/styles";-import DeleteIcon from "@material-ui/icons/Delete";import * as CRC from "crc-32";import * as React from "react";@@ -151,16 +149,7 @@ const VoucherDetailsPage = decorate<VoucherDetailsPageProps>(: undefined}onBack={onBack}- >- <IconButton- disabled={disabled || !onVoucherDelete}- onClick={- !!onVoucherDelete ? toggleVoucherDeleteDialog : undefined- }- >- <DeleteIcon />- </IconButton>- </PageHeader>+ /><div className={classes.root}><div><VoucherDetails@@ -196,6 +185,8 @@ const VoucherDetailsPage = decorate<VoucherDetailsPageProps>(</div></div><SaveButtonBar+ onCancel={onBack}+ onDelete={toggleVoucherDeleteDialog}onSave={submit}state={saveButtonBarState}disabled={disabled || !hasChanged}@@ -203,21 +194,24 @@ const VoucherDetailsPage = decorate<VoucherDetailsPageProps>(</Container>)}</Form>- <ActionDialog- open={openedVoucherDeleteDialog}- onClose={toggleVoucherDeleteDialog}- onConfirm={onVoucherDelete}- title={i18n.t("Remove voucher")}- variant="delete"- >- <DialogContentText- dangerouslySetInnerHTML={{- __html: i18n.t(- "Are you sure you want to remove <strong>{{ name }}</strong>?"- )- }}- />- </ActionDialog>+ {voucher !== undefined && (+ <ActionDialog+ open={openedVoucherDeleteDialog}+ onClose={toggleVoucherDeleteDialog}+ onConfirm={onVoucherDelete}+ title={i18n.t("Remove voucher")}+ variant="delete"+ >+ <DialogContentText+ dangerouslySetInnerHTML={{+ __html: i18n.t(+ "Are you sure you want to remove <strong>{{ name }}</strong>?",+ { name: voucher.name }+ )+ }}+ />+ </ActionDialog>+ )}</>)}</Toggle>diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsxindex 9d9cdd3b46..9b5d10ae35 100644--- a/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx+++ b/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx@@ -1,4 +1,4 @@-import IconButton from "@material-ui/core/IconButton";+import Button from "@material-ui/core/Button";import AddIcon from "@material-ui/icons/Add";import * as React from "react";@@ -49,9 +49,14 @@ const VoucherListPage: React.StatelessComponent<VoucherListPageProps> = ({}) => (<Container width="md"><PageHeader title={i18n.t("Vouchers")}>- <IconButton onClick={onAdd} disabled={disabled}>- <AddIcon />- </IconButton>+ <Button+ color="secondary"+ variant="contained"+ onClick={onAdd}+ disabled={disabled}+ >+ {i18n.t("Add voucher")} <AddIcon />+ </Button></PageHeader><VoucherListcurrency={currency}diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsxindex 62cc9c83ef..f3272304c4 100644--- a/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx+++ b/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx@@ -8,9 +8,9 @@ import { withStyles } from "@material-ui/core/styles";import * as React from "react";import { VoucherType } from "../..";+import CardTitle from "../../../components/CardTitle";import ControlledCheckbox from "../../../components/ControlledCheckbox";import FormSpacer from "../../../components/FormSpacer";-import PageHeader from "../../../components/PageHeader";import PriceField from "../../../components/PriceField";import SingleAutocompleteSelectField from "../../../components/SingleAutocompleteSelectField";import i18n from "../../../i18n";@@ -89,7 +89,7 @@ const VoucherProperties = decorate<VoucherPropertiesProps>(onChange}) => (<Card classes={{ root: classes.card }}>- <PageHeader title={i18n.t("Voucher type")} />+ <CardTitle title={i18n.t("Voucher type")} /><FormControlcomponent="fieldset"required