Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use upper-level navigation

dominik-zeglenaee85b0eb5a0
diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
index ae888e4cb2..630bd11086 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -51,7 +52,8 @@ export const CategoryCreatePage: React.StatelessComponent<
>
{({ data, change, errors, submit, hasChanged }) => (
<Container width="md">
- <PageHeader title={i18n.t("Add Category")} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Categories")}</AppHeader>
+ <PageHeader title={i18n.t("Add Category")} />
<div>
<CategoryDetailsForm
disabled={disabled}
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index 2137adc615..aa09a49c7d 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -113,10 +114,8 @@ export const CategoryUpdatePage: React.StatelessComponent<
>
{({ data, change, errors, submit, hasChanged }) => (
<Container width="md">
- <PageHeader
- title={category ? category.name : undefined}
- onBack={onBack}
- />
+ <AppHeader onBack={onBack}>{i18n.t("Categories")}</AppHeader>
+ <PageHeader title={category ? category.name : undefined} />
<CategoryDetailsForm
category={category}
data={data}
diff --git a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
index 7b913edc6b..ffae64d022 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
@@ -3,6 +3,7 @@ import CardContent from "@material-ui/core/CardContent";
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import CardTitle from "../../../components/CardTitle";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
@@ -64,11 +65,11 @@ const CollectionCreatePage: React.StatelessComponent<
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
+ <AppHeader onBack={onBack}>{i18n.t("Collections")}</AppHeader>
<PageHeader
title={i18n.t("Add collection", {
context: "page title"
})}
- onBack={onBack}
/>
<Grid>
<div>
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index 4282609119..3cc74cd2c6 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
@@ -69,7 +70,8 @@ const CollectionDetailsPage: React.StatelessComponent<
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={maybe(() => collection.name)} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Collections")}</AppHeader>
+ <PageHeader title={maybe(() => collection.name)} />
<Grid>
<div>
<CollectionDetails
diff --git a/saleor/static/dashboard-next/components/AppHeader/AppHeader.tsx b/saleor/static/dashboard-next/components/AppHeader/AppHeader.tsx
index cdb77db4eb..fe441c4a66 100644
--- a/saleor/static/dashboard-next/components/AppHeader/AppHeader.tsx
+++ b/saleor/static/dashboard-next/components/AppHeader/AppHeader.tsx
@@ -10,6 +10,7 @@ import Typography from "@material-ui/core/Typography";
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
import * as React from "react";
import AppHeaderContext from "../AppLayout/AppHeaderContext";
+import Skeleton from "../Skeleton";
export interface AppHeaderProps {
children: React.ReactNode;
@@ -30,6 +31,10 @@ const styles = (theme: Theme) =>
display: "flex",
marginTop: theme.spacing.unit
},
+ skeleton: {
+ marginBottom: theme.spacing.unit * 2,
+ width: "10rem"
+ },
title: {
color: theme.palette.grey[500],
flex: 1,
@@ -57,7 +62,11 @@ const AppHeader = withStyles(styles, { name: "AppHeader" })(
<ArrowBackIcon />
</IconButton>
)}
- <Typography className={classes.title}>{children}</Typography>
+ {children ? (
+ <Typography className={classes.title}>{children}</Typography>
+ ) : (
+ <Skeleton className={classes.skeleton} />
+ )}
</div>
</Portal>
) : null
diff --git a/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx b/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx
index cbb8ec09c8..52affe67fe 100644
--- a/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx
+++ b/saleor/static/dashboard-next/components/ExtendedPageHeader/ExtendedPageHeader.tsx
@@ -1,11 +1,9 @@
-import IconButton from "@material-ui/core/IconButton";
import {
createStyles,
Theme,
withStyles,
WithStyles
} from "@material-ui/core/styles";
-import ArrowBackIcon from "@material-ui/icons/ArrowBack";
import * as classNames from "classnames";
import * as React from "react";
@@ -43,27 +41,11 @@ interface ExtendedPageHeaderProps extends WithStyles<typeof styles> {
children?: React.ReactNode;
className?: string;
title?: React.ReactNode;
- onBack?();
}
const ExtendedPageHeader = withStyles(styles, { name: "ExtendedPageHeader" })(
- ({
- children,
- classes,
- className,
- onBack,
- title
- }: ExtendedPageHeaderProps) => (
+ ({ children, classes, className, title }: ExtendedPageHeaderProps) => (
<div className={classNames(classes.root, className)}>
- {onBack && (
- <IconButton
- color="inherit"
- className={classes.menuButton}
- onClick={onBack}
- >
- <ArrowBackIcon />
- </IconButton>
- )}
{title}
<div className={classes.action}>{children}</div>
</div>
diff --git a/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx b/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx
index 86f38160e0..f437be1436 100644
--- a/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx
+++ b/saleor/static/dashboard-next/components/PageHeader/PageHeader.tsx
@@ -22,14 +22,12 @@ interface PageHeaderProps extends WithStyles<typeof styles> {
children?: React.ReactNode;
className?: string;
title?: string;
- onBack?();
}
const PageHeader = withStyles(styles)(
- ({ children, classes, className, onBack, title }: PageHeaderProps) => (
+ ({ children, classes, className, title }: PageHeaderProps) => (
<ExtendedPageHeader
className={className}
- onBack={onBack}
title={
<Typography className={classes.title} variant="title">
{title !== undefined ? title : <Skeleton style={{ width: "10em" }} />}
diff --git a/saleor/static/dashboard-next/components/Skeleton.tsx b/saleor/static/dashboard-next/components/Skeleton.tsx
index 245194b2dd..959930449e 100644
--- a/saleor/static/dashboard-next/components/Skeleton.tsx
+++ b/saleor/static/dashboard-next/components/Skeleton.tsx
@@ -1,4 +1,5 @@
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
+import classNames from "classnames";
import * as React from "react";
const styles = createStyles({
@@ -21,12 +22,13 @@ const styles = createStyles({
});
interface SkeletonProps extends WithStyles<typeof styles> {
+ className?: string;
style?: React.CSSProperties;
}
const Skeleton = withStyles(styles, { name: "Skeleton" })(
- ({ classes, style }: SkeletonProps) => (
- <span className={classes.skeleton} style={style}>
+ ({ className, classes, style }: SkeletonProps) => (
+ <span className={classNames(classes.skeleton, className)} style={style}>
&zwnj;
</span>
)
diff --git a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
index 8ee9849c3f..049f58a087 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -59,7 +60,8 @@ const CustomerCreatePage: React.StatelessComponent<CustomerCreatePageProps> = ({
<Form initial={initialForm} onSubmit={onSubmit} errors={errors} confirmLeave>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={i18n.t("Add customer")} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Customers")}</AppHeader>
+ <PageHeader title={i18n.t("Add customer")} />
<Grid>
<div>
<CustomerCreateDetails
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index 0cc180507a..530d7b980b 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardSpacer } from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -7,6 +8,7 @@ import Form from "../../../components/Form";
import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
+import i18n from "../../../i18n";
import { getUserName, maybe } from "../../../misc";
import { UserError } from "../../../types";
import { CustomerDetails_user } from "../../types/CustomerDetails";
@@ -64,7 +66,8 @@ const CustomerDetailsPage: React.StatelessComponent<
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader onBack={onBack} title={getUserName(customer, true)} />
+ <AppHeader onBack={onBack}>{i18n.t("Customers")}</AppHeader>
+ <PageHeader title={getUserName(customer, true)} />
<Grid>
<div>
<CustomerDetails
diff --git a/saleor/static/dashboard-next/discounts/components/SaleCreatePage/SaleCreatePage.tsx b/saleor/static/dashboard-next/discounts/components/SaleCreatePage/SaleCreatePage.tsx
index 29e72cc631..6dca2c3fcd 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleCreatePage/SaleCreatePage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleCreatePage/SaleCreatePage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton";
import Container from "../../../components/Container";
@@ -49,7 +50,8 @@ const SaleCreatePage: React.StatelessComponent<SaleCreatePageProps> = ({
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={i18n.t("Create Sale")} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Sales")}</AppHeader>
+ <PageHeader title={i18n.t("Create Sale")} />
<Grid>
<div>
<SaleInfo
diff --git a/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx b/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
index 031714ebeb..85898847e3 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleDetailsPage/SaleDetailsPage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton";
import Container from "../../../components/Container";
@@ -103,7 +104,8 @@ const SaleDetailsPage: React.StatelessComponent<SaleDetailsPageProps> = ({
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={maybe(() => sale.name)} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Sales")}</AppHeader>
+ <PageHeader title={maybe(() => sale.name)} />
<Grid>
<div>
<SaleInfo
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherCreatePage/VoucherCreatePage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherCreatePage/VoucherCreatePage.tsx
index a1233a1a3d..0136872b2d 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherCreatePage/VoucherCreatePage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherCreatePage/VoucherCreatePage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton";
import Container from "../../../components/Container";
@@ -63,7 +64,8 @@ const VoucherCreatePage: React.StatelessComponent<VoucherCreatePageProps> = ({
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={i18n.t("Create Voucher")} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Vouchers")}</AppHeader>
+ <PageHeader title={i18n.t("Create Voucher")} />
<Grid>
<div>
<VoucherInfo
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
index aa3e91a883..1c9cd86426 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
@@ -1,6 +1,7 @@
import Typography from "@material-ui/core/Typography";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton";
import Container from "../../../components/Container";
@@ -126,7 +127,8 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={maybe(() => voucher.name)} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Vouchers")}</AppHeader>
+ <PageHeader title={maybe(() => voucher.name)} />
<Grid>
<div>
<VoucherInfo
diff --git a/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx b/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx
index 7aea7b0ed0..be06494fd4 100644
--- a/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx
+++ b/saleor/static/dashboard-next/home/components/HomeHeader/HomeHeader.tsx
@@ -13,8 +13,7 @@ import i18n from "../../../i18n";
const styles = (theme: Theme) =>
createStyles({
headerContainer: {
- marginBottom: theme.spacing.unit * 3,
- marginTop: theme.spacing.unit * 3
+ marginBottom: theme.spacing.unit * 3
},
pageHeader: {
fontWeight: 600 as 600
@@ -29,7 +28,7 @@ const HomeOrdersCard = withStyles(styles, { name: "HomeOrdersCard" })(
({ classes, userName }: HomeOrdersCardProps) => {
return (
<div className={classes.headerContainer}>
- <Typography className={classes.pageHeader} variant="headline">
+ <Typography className={classes.pageHeader} variant="display1">
{userName ? (
i18n.t("Hello there, {{userName}}", { userName })
) : (
diff --git a/saleor/static/dashboard-next/misc.ts b/saleor/static/dashboard-next/misc.ts
index dc29110708..ed9c08117f 100644
--- a/saleor/static/dashboard-next/misc.ts
+++ b/saleor/static/dashboard-next/misc.ts
@@ -208,7 +208,7 @@ export function getUserName(user?: User, returnEmail?: boolean) {
: returnEmail
? user.email
: user.email.split("@")[0]
- : null;
+ : undefined;
}
export function getUserInitials(user?: User) {
@@ -217,5 +217,5 @@ export function getUserInitials(user?: User) {
? user.firstName[0] + user.lastName[0]
: user.email.slice(0, 2)
).toUpperCase()
- : null;
+ : undefined;
}
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index ca6a36f7e7..52b364d99d 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -7,6 +7,7 @@ import {
import Typography from "@material-ui/core/Typography";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardMenu } from "../../../components/CardMenu/CardMenu";
import { CardSpacer } from "../../../components/CardSpacer";
import { Container } from "../../../components/Container";
@@ -90,10 +91,10 @@ const OrderDetailsPage = withStyles(styles, { name: "OrderDetailsPage" })(
return (
<Container width="md">
+ <AppHeader onBack={onBack}>{i18n.t("Orders")}</AppHeader>
<PageHeader
className={classes.header}
title={maybe(() => order.number) ? "#" + order.number : undefined}
- onBack={onBack}
>
{canCancel && (
<CardMenu
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
index 4190c8f5fc..7a1597f674 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
@@ -7,6 +7,7 @@ import {
import Typography from "@material-ui/core/Typography";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { CardMenu } from "../../../components/CardMenu/CardMenu";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
@@ -89,10 +90,10 @@ const OrderDraftPage = withStyles(styles, { name: "OrderDraftPage" })(
usersLoading
}: OrderDraftPageProps) => (
<Container width="md">
+ <AppHeader onBack={onBack}>{i18n.t("Orders")}</AppHeader>
<PageHeader
className={classes.header}
title={maybe(() => order.number) ? "#" + order.number : undefined}
- onBack={onBack}
>
<CardMenu
className={classes.menu}
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
index 6e47a9727e..d639b45223 100644
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton";
import Container from "../../../components/Container";
@@ -58,7 +59,8 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
return (
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
- <Container width="md">
+ <Container>
+ <AppHeader onBack={onBack}>{i18n.t("Pages")}</AppHeader>
<PageHeader
title={
page === null
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
index b3a3c09961..455dd11f5f 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -7,6 +8,7 @@ import Form from "../../../components/Form";
import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
+import i18n from "../../../i18n";
import { TaxRateType, WeightUnitsEnum } from "../../../types/globalTypes";
import ProductTypeDetails from "../ProductTypeDetails/ProductTypeDetails";
import ProductTypeShipping from "../ProductTypeShipping/ProductTypeShipping";
@@ -60,7 +62,8 @@ const ProductTypeCreatePage: React.StatelessComponent<
>
{({ change, data, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={pageTitle} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Product Types")}</AppHeader>
+ <PageHeader title={pageTitle} />
<Grid>
<div>
<ProductTypeDetails
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
index 300b07771c..9a906adc02 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -109,7 +110,8 @@ const ProductTypeDetailsPage: React.StatelessComponent<
>
{({ change, data, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={pageTitle} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Product Types")}</AppHeader>
+ <PageHeader title={pageTitle} />
<Grid>
<div>
<ProductTypeDetails
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
index e2857a7952..b15f6d0684 100644
--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -128,7 +129,8 @@ export const ProductCreatePage: React.StatelessComponent<
>
{({ change, data, errors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={header} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Products")}</AppHeader>
+ <PageHeader title={header} />
<Grid>
<div>
<ProductDetailsForm
diff --git a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
index c105b0c9b8..aeedc47f6f 100644
--- a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
@@ -9,6 +9,7 @@ import {
import TextField from "@material-ui/core/TextField";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardTitle from "../../../components/CardTitle";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -48,6 +49,7 @@ interface ProductImagePageProps extends WithStyles<typeof styles> {
url: string;
}>;
disabled: boolean;
+ product: string;
saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onDelete: () => void;
@@ -61,6 +63,7 @@ const ProductImagePage = withStyles(styles, { name: "ProductImagePage" })(
disabled,
image,
images,
+ product,
saveButtonBarState,
onBack,
onDelete,
@@ -75,7 +78,8 @@ const ProductImagePage = withStyles(styles, { name: "ProductImagePage" })(
{({ change, data, hasChanged, submit }) => {
return (
<Container width="md">
- <PageHeader title={i18n.t("Edit Photo")} onBack={onBack} />
+ <AppHeader onBack={onBack}>{product}</AppHeader>
+ <PageHeader title={i18n.t("Edit Photo")} />
<Grid variant="inverted">
<div>
<ProductImageNavigation
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 75688c4245..85f95b6a01 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -1,6 +1,7 @@
import { RawDraftContentState } from "draft-js";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -202,7 +203,8 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
{({ change, data, errors, hasChanged, submit }) => (
<>
<Container width="md">
- <PageHeader title={header} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Products")}</AppHeader>
+ <PageHeader title={header} />
<Grid>
<div>
<ProductDetailsForm
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index bf2e2988b0..dddfad470b 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
@@ -74,7 +75,8 @@ const ProductVariantCreatePage: React.StatelessComponent<
>
{({ change, data, errors, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={header} onBack={onBack} />
+ <AppHeader onBack={onBack}>{maybe(() => product.name)}</AppHeader>
+ <PageHeader title={header} />
<Grid variant="inverted">
<div>
<ProductVariantNavigation
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
index e9e059e469..c747636492 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -61,7 +62,10 @@ const ProductVariantPage: React.StatelessComponent<ProductVariantPageProps> = ({
{(isImageSelectModalActive, { toggle: toggleImageSelectModal }) => (
<>
<Container width="md">
- <PageHeader title={header} onBack={onBack} />
+ <AppHeader onBack={onBack}>
+ {maybe(() => variant.product.name)}
+ </AppHeader>
+ <PageHeader title={header} />
<Form
initial={{
attributes:
diff --git a/saleor/static/dashboard-next/products/queries.ts b/saleor/static/dashboard-next/products/queries.ts
index 2623a4bf58..c8d31f1bbc 100644
--- a/saleor/static/dashboard-next/products/queries.ts
+++ b/saleor/static/dashboard-next/products/queries.ts
@@ -304,6 +304,7 @@ const productVariantCreateQuery = gql`
sortOrder
url
}
+ name
productType {
id
variantAttributes {
@@ -339,6 +340,7 @@ const productImageQuery = gql`
query ProductImageById($productId: ID!, $imageId: ID!) {
product(id: $productId) {
id
+ name
mainImage: imageById(id: $imageId) {
id
alt
diff --git a/saleor/static/dashboard-next/products/types/ProductImageById.ts b/saleor/static/dashboard-next/products/types/ProductImageById.ts
index 1e2bd3d4cc..197db9af5c 100644
--- a/saleor/static/dashboard-next/products/types/ProductImageById.ts
+++ b/saleor/static/dashboard-next/products/types/ProductImageById.ts
@@ -21,6 +21,7 @@ export interface ProductImageById_product_images {
export interface ProductImageById_product {
__typename: "Product";
id: string;
+ name: string;
mainImage: ProductImageById_product_mainImage | null;
images: (ProductImageById_product_images | null)[] | null;
}
diff --git a/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts b/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts
index b8bffde040..c9aacddaa5 100644
--- a/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts
+++ b/saleor/static/dashboard-next/products/types/ProductVariantCreateData.ts
@@ -52,6 +52,7 @@ export interface ProductVariantCreateData_product {
__typename: "Product";
id: string;
images: (ProductVariantCreateData_product_images | null)[] | null;
+ name: string;
productType: ProductVariantCreateData_product_productType;
variants: (ProductVariantCreateData_product_variants | null)[] | null;
}
diff --git a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
index e6d62ffb14..1825a763be 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage/index.tsx
@@ -86,6 +86,7 @@ export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
<>
<ProductImagePage
disabled={loading}
+ product={maybe(() => data.product.name)}
image={image || null}
images={maybe(() => data.product.images)}
onBack={handleBack}
diff --git a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
index 5ad1298758..077a0fbb70 100644
--- a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import CardSpacer from "../../../components/CardSpacer";
import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
@@ -7,6 +8,7 @@ import Form from "../../../components/Form";
import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
+import i18n from "../../../i18n";
import { getUserName, maybe } from "../../../misc";
import { PermissionEnum } from "../../../types/globalTypes";
import {
@@ -66,7 +68,8 @@ const StaffDetailsPage: React.StatelessComponent<StaffDetailsPageProps> = ({
<Form initial={initialForm} onSubmit={onSubmit} confirmLeave>
{({ data, change, hasChanged, submit }) => (
<Container width="md">
- <PageHeader title={getUserName(staffMember)} onBack={onBack} />
+ <AppHeader onBack={onBack}>{i18n.t("Staff Members")}</AppHeader>
+ <PageHeader title={getUserName(staffMember)} />
<Grid>
<div>
<StaffProperties
diff --git a/saleor/static/dashboard-next/storybook/stories/components/PageHeader.tsx b/saleor/static/dashboard-next/storybook/stories/components/PageHeader.tsx
index b39a63b1d7..6fc0effecd 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/PageHeader.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/PageHeader.tsx
@@ -8,20 +8,10 @@ import PageHeader from "../../../components/PageHeader";
storiesOf("Generics / PageHeader", module)
.add("without title", () => <PageHeader />)
.add("with title", () => <PageHeader title="Lorem ipsum" />)
- .add("with title and back button", () => (
- <PageHeader title="Lorem ipsum" onBack={() => undefined} />
- ))
.add("with title icon bar", () => (
<PageHeader title="Lorem ipsum">
<IconButton>
<DeleteIcon />
</IconButton>
</PageHeader>
- ))
- .add("with title, back button and icon bar", () => (
- <PageHeader title="Lorem ipsum" onBack={() => undefined}>
- <IconButton>
- <DeleteIcon />
- </IconButton>
- </PageHeader>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
index 9d34079b81..8e9fa87d28 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
@@ -14,6 +14,7 @@ storiesOf("Views / Products / Product image details", module)
.addDecorator(Decorator)
.add("when loaded data", () => (
<ProductImagePage
+ product="Example product"
disabled={false}
image={image}
images={images}
@@ -26,6 +27,7 @@ storiesOf("Views / Products / Product image details", module)
))
.add("when loading data", () => (
<ProductImagePage
+ product="Example product"
disabled={true}
onBack={() => undefined}
onDelete={undefined}
diff --git a/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx b/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
index 6c138710fe..d6f3ce4f2a 100644
--- a/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
+++ b/saleor/static/dashboard-next/taxes/components/CountryTaxesPage/CountryTaxesPage.tsx
@@ -7,6 +7,7 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
+import AppHeader from "../../../components/AppHeader";
import { Container } from "../../../components/Container";
import Grid from "../../../components/Grid";
import PageHeader from "../../../components/PageHeader";
@@ -37,6 +38,7 @@ const CountryTaxesPage = withStyles(styles, { name: "CountryTaxesPage" })(
const taxRates = translatedTaxRates();
return (
<Container width="md">
+ <AppHeader onBack={onBack}>{i18n.t("Taxes")}</AppHeader>
<PageHeader
title={
countryName
@@ -46,7 +48,6 @@ const CountryTaxesPage = withStyles(styles, { name: "CountryTaxesPage" })(
})
: undefined
}
- onBack={onBack}
/>
<Grid>
<div>