Skip to content

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

Add product type views titles

dominik-zeglene821584847f3
diff --git a/saleor/static/dashboard-next/productTypes/index.tsx b/saleor/static/dashboard-next/productTypes/index.tsx
index e6e34e77d8..b261549927 100644
--- a/saleor/static/dashboard-next/productTypes/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/index.tsx
@@ -2,6 +2,8 @@ import { parse as parseQs } from "qs";
import * as React from "react";
import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
import ProductTypeCreate from "./views/ProductTypeCreate";
import ProductTypeListComponent, {
ProductTypeListQueryParams
@@ -35,11 +37,14 @@ const ProductTypeUpdate: React.StatelessComponent<
export const ProductTypeRouter: React.StatelessComponent<
RouteComponentProps<any>
> = ({ match }) => (
- <Switch>
- <Route exact path={match.url} component={ProductTypeList} />
- <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
- <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
- </Switch>
+ <>
+ <WindowTitle title={i18n.t("Product types")} />
+ <Switch>
+ <Route exact path={match.url} component={ProductTypeList} />
+ <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
+ <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
+ </Switch>
+ </>
);
ProductTypeRouter.displayName = "ProductTypeRouter";
export default ProductTypeRouter;
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
index 7114dd2862..12162ba8b4 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
@@ -3,6 +3,7 @@ import Navigator from "../../components/Navigator";
import { productTypeDetailsUrl, productTypeListUrl } from "..";
import Messages from "../../components/messages";
+import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { maybe } from "../../misc";
import ProductTypeCreatePage, {
@@ -52,25 +53,28 @@ export const ProductTypeCreate: React.StatelessComponent = () => (
return (
<TypedProductTypeCreateDataQuery>
{({ data, loading }) => (
- <ProductTypeCreatePage
- defaultWeightUnit={maybe(
- () => data.shop.defaultWeightUnit
- )}
- disabled={loadingCreate || loading}
- errors={
- createProductTypeData
- ? createProductTypeData.productTypeCreate.errors
- : undefined
- }
- pageTitle={i18n.t("Create Product Type", {
- context: "page title"
- })}
- saveButtonBarState={
- loadingCreate ? "loading" : "default"
- }
- onBack={() => navigate(productTypeListUrl)}
- onSubmit={handleCreate}
- />
+ <>
+ <WindowTitle title={i18n.t("Create product type")} />
+ <ProductTypeCreatePage
+ defaultWeightUnit={maybe(
+ () => data.shop.defaultWeightUnit
+ )}
+ disabled={loadingCreate || loading}
+ errors={
+ createProductTypeData
+ ? createProductTypeData.productTypeCreate.errors
+ : undefined
+ }
+ pageTitle={i18n.t("Create Product Type", {
+ context: "page title"
+ })}
+ saveButtonBarState={
+ loadingCreate ? "loading" : "default"
+ }
+ onBack={() => navigate(productTypeListUrl)}
+ onSubmit={handleCreate}
+ />
+ </>
)}
</TypedProductTypeCreateDataQuery>
);
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
index 50ad666147..d7d6c6cd4a 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
@@ -4,6 +4,7 @@ import { Route } from "react-router-dom";
import { productTypeDetailsUrl, productTypeListUrl } from "../../";
import Messages from "../../../components/messages";
import Navigator from "../../../components/Navigator";
+import { WindowTitle } from "../../../components/WindowTitle";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
import { AttributeTypeEnum } from "../../../types/globalTypes";
@@ -226,6 +227,9 @@ export const ProductTypeUpdate: React.StatelessComponent<
const loading = mutationLoading || dataLoading;
return (
<>
+ <WindowTitle
+ title={maybe(() => data.productType.name)}
+ />
<ProductTypeDetailsPage
defaultWeightUnit={maybe(
() => data.shop.defaultWeightUnit