Skip to content

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

Add customer views title

dominik-zeglen1c9039793fc6
diff --git a/saleor/static/dashboard-next/customers/index.tsx b/saleor/static/dashboard-next/customers/index.tsx
index ca4c16e516..530ee95ee4 100644
--- a/saleor/static/dashboard-next/customers/index.tsx
+++ b/saleor/static/dashboard-next/customers/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 { customerAddUrl, customerListUrl, customerUrl } from "./urls";
import CustomerCreateView from "./views/CustomerCreate";
import CustomerDetailsViewComponent from "./views/CustomerDetails";
@@ -30,9 +32,12 @@ const CustomerDetailsView: React.StatelessComponent<
);
export const CustomerSection: React.StatelessComponent<{}> = () => (
- <Switch>
- <Route exact path={customerListUrl} component={CustomerListView} />
- <Route exact path={customerAddUrl} component={CustomerCreateView} />
- <Route path={customerUrl(":id")} component={CustomerDetailsView} />
- </Switch>
+ <>
+ <WindowTitle title={i18n.t("Customers")} />
+ <Switch>
+ <Route exact path={customerListUrl} component={CustomerListView} />
+ <Route exact path={customerAddUrl} component={CustomerCreateView} />
+ <Route path={customerUrl(":id")} component={CustomerDetailsView} />
+ </Switch>
+ </>
);
diff --git a/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx b/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx
index a0d0572d5d..b82f232d1e 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerCreate.tsx
@@ -2,6 +2,7 @@ import * as React from "react";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
+import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { maybe } from "../../misc";
import CustomerCreatePage from "../components/CustomerCreatePage";
@@ -35,44 +36,47 @@ export const CustomerCreate: React.StatelessComponent<{}> = () => (
onCompleted={handleCreateCustomerSuccess}
>
{(createCustomer, createCustomerOpts) => (
- <CustomerCreatePage
- countries={maybe(() => data.shop.countries, [])}
- disabled={loading || createCustomerOpts.loading}
- errors={maybe(
- () => createCustomerOpts.data.customerCreate.errors,
- []
- )}
- saveButtonBar={
- createCustomerOpts.loading ? "loading" : "default"
- }
- onBack={() => navigate(customerListUrl)}
- onSubmit={formData => {
- const address = {
- city: formData.city,
- cityArea: formData.cityArea,
- companyName: formData.companyName,
- country: formData.country,
- countryArea: formData.countryArea,
- firstName: formData.firstName,
- lastName: formData.lastName,
- phone: formData.phone,
- postalCode: formData.postalCode,
- streetAddress1: formData.streetAddress1,
- streetAddress2: formData.streetAddress2
- };
- createCustomer({
- variables: {
- input: {
- defaultBillingAddress: address,
- defaultShippingAddress: address,
- email: formData.email,
- note: formData.note,
- sendPasswordEmail: true
+ <>
+ <WindowTitle title={i18n.t("Create customer")} />
+ <CustomerCreatePage
+ countries={maybe(() => data.shop.countries, [])}
+ disabled={loading || createCustomerOpts.loading}
+ errors={maybe(
+ () => createCustomerOpts.data.customerCreate.errors,
+ []
+ )}
+ saveButtonBar={
+ createCustomerOpts.loading ? "loading" : "default"
+ }
+ onBack={() => navigate(customerListUrl)}
+ onSubmit={formData => {
+ const address = {
+ city: formData.city,
+ cityArea: formData.cityArea,
+ companyName: formData.companyName,
+ country: formData.country,
+ countryArea: formData.countryArea,
+ firstName: formData.firstName,
+ lastName: formData.lastName,
+ phone: formData.phone,
+ postalCode: formData.postalCode,
+ streetAddress1: formData.streetAddress1,
+ streetAddress2: formData.streetAddress2
+ };
+ createCustomer({
+ variables: {
+ input: {
+ defaultBillingAddress: address,
+ defaultShippingAddress: address,
+ email: formData.email,
+ note: formData.note,
+ sendPasswordEmail: true
+ }
}
- }
- });
- }}
- />
+ });
+ }}
+ />
+ </>
)}
</TypedCreateCustomerMutation>
)}
diff --git a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
index e019fbc940..d391f11ead 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx
@@ -5,6 +5,7 @@ import { Route } from "react-router-dom";
import ActionDialog from "../../components/ActionDialog";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
+import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { maybe } from "../../misc";
import { orderUrl } from "../../orders";
@@ -67,6 +68,9 @@ export const CustomerDetailsView: React.StatelessComponent<
<TypedCustomerDetailsQuery variables={{ id }}>
{customerDetails => (
<>
+ <WindowTitle
+ title={maybe(() => customerDetails.data.user.email)}
+ />
<CustomerDetailsPage
customer={customerDetails.data.user}
disabled={