Skip to content

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

Add collection view titles

dominik-zeglene34066631504
diff --git a/saleor/static/dashboard-next/collections/index.tsx b/saleor/static/dashboard-next/collections/index.tsx
index 9ba4a6eb90..a276f9f4fc 100644
--- a/saleor/static/dashboard-next/collections/index.tsx
+++ b/saleor/static/dashboard-next/collections/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 { collectionAddUrl, collectionListUrl, collectionUrl } from "./urls";
import CollectionCreate from "./views/CollectionCreate";
import CollectionDetailsView, {
@@ -42,10 +44,13 @@ const CollectionDetails: React.StatelessComponent<
};
const Component = () => (
- <Switch>
- <Route exact path={collectionListUrl} component={CollectionList} />
- <Route exact path={collectionAddUrl} component={CollectionCreate} />
- <Route path={collectionUrl(":id")} component={CollectionDetails} />
- </Switch>
+ <>
+ <WindowTitle title={i18n.t("Collections")} />
+ <Switch>
+ <Route exact path={collectionListUrl} component={CollectionList} />
+ <Route exact path={collectionAddUrl} component={CollectionCreate} />
+ <Route path={collectionUrl(":id")} component={CollectionDetails} />
+ </Switch>
+ </>
);
export default Component;
diff --git a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
index 52986fdb91..22e4bb5a46 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionCreate.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 CollectionCreatePage from "../components/CollectionCreatePage/CollectionCreatePage";
@@ -36,28 +37,31 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => (
onCompleted={handleCollectionCreateSuccess}
>
{(createCollection, { data, loading }) => (
- <CollectionCreatePage
- errors={maybe(() => data.collectionCreate.errors, [])}
- onBack={() => navigate(collectionListUrl)}
- disabled={loading}
- onSubmit={formData =>
- createCollection({
- variables: {
- input: {
- backgroundImage: formData.backgroundImage.value,
- isPublished: formData.isPublished,
- name: formData.name,
- seo: {
- description: formData.seoDescription,
- title: formData.seoTitle
- },
- // FIXME: remove after closing #3142
- slug: formData.name.toLowerCase()
+ <>
+ <WindowTitle title={i18n.t("Create collection")} />
+ <CollectionCreatePage
+ errors={maybe(() => data.collectionCreate.errors, [])}
+ onBack={() => navigate(collectionListUrl)}
+ disabled={loading}
+ onSubmit={formData =>
+ createCollection({
+ variables: {
+ input: {
+ backgroundImage: formData.backgroundImage.value,
+ isPublished: formData.isPublished,
+ name: formData.name,
+ seo: {
+ description: formData.seoDescription,
+ title: formData.seoTitle
+ },
+ // FIXME: remove after closing #3142
+ slug: formData.name.toLowerCase()
+ }
}
- }
- })
- }
- />
+ })
+ }
+ />
+ </>
)}
</TypedCollectionCreateMutation>
);
diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
index dadc29585f..3e27f6e96a 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
@@ -6,6 +6,7 @@ import ActionDialog from "../../components/ActionDialog";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
import { createPaginationState, Paginator } from "../../components/Paginator";
+import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { maybe } from "../../misc";
import { productUrl } from "../../products";
@@ -155,6 +156,9 @@ export const CollectionDetails: React.StatelessComponent<
};
return (
<>
+ <WindowTitle
+ title={maybe(() => data.collection.name)}
+ />
<Paginator
pageInfo={maybe(
() => data.collection.products.pageInfo