Skip to content

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

Add app header

dominik-zeglen7164ca59917e
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx
index dfa483eca2..924c7c96ba 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.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";
@@ -15,6 +16,7 @@ export interface TranslationsCategoriesPageProps {
languageCode: string;
category: CategoryTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -34,10 +36,12 @@ const TranslationsCategoriesPage: React.StatelessComponent<
languageCode,
category,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t(
'Translation Category "{{ categoryName }}" - {{ languageCode }}',
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx
index c2940b4292..28457c8778 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.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";
@@ -15,6 +16,7 @@ export interface TranslationsCollectionsPageProps {
languageCode: string;
collection: CollectionTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -34,10 +36,12 @@ const TranslationsCollectionsPage: React.StatelessComponent<
languageCode,
collection,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t(
'Translation Collection "{{ collectionName }}" - {{ languageCode }}',
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx
index c254e125b7..59e43169c2 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsPagesPage/TranslationsPagesPage.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";
@@ -15,6 +16,7 @@ export interface TranslationsPagesPageProps {
languageCode: string;
page: PageTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -34,10 +36,12 @@ const TranslationsPagesPage: React.StatelessComponent<
languageCode,
page,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t('Translation Page "{{ pageName }}" - {{ languageCode }}', {
context: "page translation page title",
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsProductTypesPage/TranslationsProductTypesPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsProductTypesPage/TranslationsProductTypesPage.tsx
index 970163379d..79a7cfda60 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsProductTypesPage/TranslationsProductTypesPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsProductTypesPage/TranslationsProductTypesPage.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";
@@ -15,6 +16,7 @@ export interface TranslationsProductTypesPageProps {
languageCode: string;
productType: ProductTypeTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -32,10 +34,12 @@ const TranslationsProductTypesPage: React.StatelessComponent<
languageCode,
productType,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t(
'Translation Product Type "{{ productTypeName }}" - {{ languageCode }}',
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx
index 9c6c0db6df..96bebd052a 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsProductsPage/TranslationsProductsPage.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";
@@ -15,6 +16,7 @@ export interface TranslationsProductsPageProps {
languageCode: string;
product: ProductTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -34,10 +36,12 @@ const TranslationsProductsPage: React.StatelessComponent<
languageCode,
product,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t(
'Translation Product "{{ productName }}" - {{ languageCode }}',
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsSalesPage/TranslationsSalesPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsSalesPage/TranslationsSalesPage.tsx
index ae361cf5ff..047c2dc3c5 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsSalesPage/TranslationsSalesPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsSalesPage/TranslationsSalesPage.tsx
@@ -7,6 +7,7 @@ import i18n from "../../../i18n";
import { maybe } from "../../../misc";
import { SaleTranslationFragment } from "../../types/SaleTranslationFragment";
import TranslationFields from "../TranslationFields";
+import AppHeader from "../../../components/AppHeader";
export interface TranslationsSalesPageProps {
activeField: string;
@@ -14,6 +15,7 @@ export interface TranslationsSalesPageProps {
languageCode: string;
sale: SaleTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -30,10 +32,12 @@ const TranslationsSalesPage: React.StatelessComponent<
languageCode,
sale,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t('Translation Sale "{{ saleName }}" - {{ languageCode }}', {
context: "sale translation page title",
diff --git a/saleor/static/dashboard-next/translations/components/TranslationsVouchersPage/TranslationsVouchersPage.tsx b/saleor/static/dashboard-next/translations/components/TranslationsVouchersPage/TranslationsVouchersPage.tsx
index d13b615404..ee7f28b010 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationsVouchersPage/TranslationsVouchersPage.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationsVouchersPage/TranslationsVouchersPage.tsx
@@ -7,6 +7,7 @@ import i18n from "../../../i18n";
import { maybe } from "../../../misc";
import { VoucherTranslationFragment } from "../../types/VoucherTranslationFragment";
import TranslationFields from "../TranslationFields";
+import AppHeader from "../../../components/AppHeader";
export interface TranslationsVouchersPageProps {
activeField: string;
@@ -14,6 +15,7 @@ export interface TranslationsVouchersPageProps {
languageCode: string;
voucher: VoucherTranslationFragment;
saveButtonState: ConfirmButtonTransitionState;
+ onBack: () => void;
onEdit: (field: string) => void;
onSubmit: (field: string, data: string) => void;
}
@@ -30,10 +32,12 @@ const TranslationsVouchersPage: React.StatelessComponent<
languageCode,
voucher,
saveButtonState,
+ onBack,
onEdit,
onSubmit
}) => (
<Container>
+ <AppHeader onBack={onBack}>{i18n.t("Translations")}</AppHeader>
<PageHeader
title={i18n.t(
'Translation Voucher "{{ voucherName }}" - {{ languageCode }}',
diff --git a/saleor/static/dashboard-next/translations/urls.ts b/saleor/static/dashboard-next/translations/urls.ts
index 374698dab3..02538053ad 100644
--- a/saleor/static/dashboard-next/translations/urls.ts
+++ b/saleor/static/dashboard-next/translations/urls.ts
@@ -1,14 +1,6 @@
+import { stringify as stringifyQs } from "qs";
import * as urlJoin from "url-join";
-const translationsSection = "/translations/";
-
-export const languageListPath = translationsSection;
-export const languageListUrl = translationsSection;
-
-export const languageEntitiesPath = (code: string) =>
- urlJoin(translationsSection, code);
-export const languageEntitiesUrl = languageEntitiesPath;
-
export enum TranslatableEntities {
categories = "categories",
products = "products",
@@ -19,6 +11,20 @@ export enum TranslatableEntities {
productTypes = "productTypes"
}
+const translationsSection = "/translations/";
+
+export const languageListPath = translationsSection;
+export const languageListUrl = translationsSection;
+
+export const languageEntitiesPath = (code: string) =>
+ urlJoin(translationsSection, code);
+export const languageEntitiesUrl = (code: string, tab?: TranslatableEntities) =>
+ languageEntitiesPath(code) +
+ "?" +
+ stringifyQs({
+ tab
+ });
+
export const languageEntityPath = (
code: string,
entity: TranslatableEntities,
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsCategories.tsx b/saleor/static/dashboard-next/translations/views/TranslationsCategories.tsx
index 20eb6a2365..7142245914 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsCategories.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsCategories.tsx
@@ -12,6 +12,7 @@ import TranslationsCategoriesPage, {
import { TypedUpdateCategoryTranslations } from "../mutations";
import { TypedCategoryTranslationDetails } from "../queries";
import { UpdateCategoryTranslations } from "../types/UpdateCategoryTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsCategoriesQueryParams {
activeField: string;
@@ -89,6 +90,14 @@ const TranslationsCategories: React.FC<TranslationsCategoriesProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.categories
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
category={maybe(() => categoryTranslations.data.category)}
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsCollections.tsx b/saleor/static/dashboard-next/translations/views/TranslationsCollections.tsx
index 4b3643dee4..987eeb196c 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsCollections.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsCollections.tsx
@@ -12,6 +12,7 @@ import TranslationsCollectionsPage, {
import { TypedUpdateCollectionTranslations } from "../mutations";
import { TypedCollectionTranslationDetails } from "../queries";
import { UpdateCollectionTranslations } from "../types/UpdateCollectionTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsCollectionsQueryParams {
activeField: string;
@@ -93,6 +94,14 @@ const TranslationsCollections: React.FC<TranslationsCollectionsProps> = ({
languageCode={languageCode}
saveButtonState={saveButtonState}
onEdit={onEdit}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.collections
+ )
+ )
+ }
onSubmit={handleSubmit}
collection={maybe(() => collectionTranslations.data.collection)}
/>
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsPages.tsx b/saleor/static/dashboard-next/translations/views/TranslationsPages.tsx
index 6ec6fe33f1..3b88d952ae 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsPages.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsPages.tsx
@@ -15,6 +15,7 @@ import TranslationsPagesPage, {
import { TypedUpdatePageTranslations } from "../mutations";
import { TypedPageTranslationDetails } from "../queries";
import { UpdatePageTranslations } from "../types/UpdatePageTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsPagesQueryParams {
activeField: string;
@@ -89,6 +90,14 @@ const TranslationsPages: React.FC<TranslationsPagesProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.pages
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
page={maybe(() => pageTranslations.data.page)}
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsProductTypes.tsx b/saleor/static/dashboard-next/translations/views/TranslationsProductTypes.tsx
index cc77790254..abee6432c9 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsProductTypes.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsProductTypes.tsx
@@ -19,6 +19,7 @@ import {
import { TypedProductTypeTranslationDetails } from "../queries";
import { UpdateAttributeTranslations } from "../types/UpdateAttributeTranslations";
import { UpdateAttributeValueTranslations } from "../types/UpdateAttributeValueTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsProductTypesQueryParams {
activeField: string;
@@ -129,6 +130,14 @@ const TranslationsProductTypes: React.FC<TranslationsProductTypesProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.productTypes
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
productType={maybe(
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsProducts.tsx b/saleor/static/dashboard-next/translations/views/TranslationsProducts.tsx
index 774d5819b8..eb9ffeb634 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsProducts.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsProducts.tsx
@@ -12,6 +12,7 @@ import TranslationsProductsPage, {
import { TypedUpdateProductTranslations } from "../mutations";
import { TypedProductTranslationDetails } from "../queries";
import { UpdateProductTranslations } from "../types/UpdateProductTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsProductsQueryParams {
activeField: string;
@@ -89,6 +90,14 @@ const TranslationsProducts: React.FC<TranslationsProductsProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.products
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
product={maybe(() => productTranslations.data.product)}
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsSales.tsx b/saleor/static/dashboard-next/translations/views/TranslationsSales.tsx
index af593e573b..17a777c90f 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsSales.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsSales.tsx
@@ -15,6 +15,7 @@ import TranslationsSalesPage, {
import { TypedUpdateSaleTranslations } from "../mutations";
import { TypedSaleTranslationDetails } from "../queries";
import { UpdateSaleTranslations } from "../types/UpdateSaleTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsSalesQueryParams {
activeField: string;
@@ -83,6 +84,14 @@ const TranslationsSales: React.FC<TranslationsSalesProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.sales
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
sale={maybe(() => saleTranslations.data.sale)}
diff --git a/saleor/static/dashboard-next/translations/views/TranslationsVouchers.tsx b/saleor/static/dashboard-next/translations/views/TranslationsVouchers.tsx
index b8f483433b..2487a9b536 100644
--- a/saleor/static/dashboard-next/translations/views/TranslationsVouchers.tsx
+++ b/saleor/static/dashboard-next/translations/views/TranslationsVouchers.tsx
@@ -15,6 +15,7 @@ import TranslationsVouchersPage, {
import { TypedUpdateVoucherTranslations } from "../mutations";
import { TypedVoucherTranslationDetails } from "../queries";
import { UpdateVoucherTranslations } from "../types/UpdateVoucherTranslations";
+import { languageEntitiesUrl, TranslatableEntities } from "../urls";
export interface TranslationsVouchersQueryParams {
activeField: string;
@@ -86,6 +87,14 @@ const TranslationsVouchers: React.FC<TranslationsVouchersProps> = ({
}
languageCode={languageCode}
saveButtonState={saveButtonState}
+ onBack={() =>
+ navigate(
+ languageEntitiesUrl(
+ languageCode,
+ TranslatableEntities.vouchers
+ )
+ )
+ }
onEdit={onEdit}
onSubmit={handleSubmit}
voucher={maybe(() => voucherTranslations.data.voucher)}