Skip to content

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

Update stories

dominik-zeglen3fdf2f2ac81a
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index ad9063bf1b..b1e98970ae 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -2,12 +2,11 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import { CardSpacer } from "../../../components/CardSpacer";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import Tabs, { Tab } from "../../../components/Tab";
import i18n from "../../../i18n";
@@ -41,7 +40,7 @@ export interface CategoryUpdatePageProps {
hasNextPage: boolean;
hasPreviousPage: boolean;
};
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onImageDelete: () => void;
onSubmit: (data: FormData) => void;
onImageUpload(event: React.ChangeEvent<any>);
diff --git a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
index 0ea56cafc9..765888ecb4 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
@@ -5,6 +5,7 @@ import * as React from "react";
import { CardSpacer } from "../../../components/CardSpacer";
import CardTitle from "../../../components/CardTitle";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
import { ControlledSwitch } from "../../../components/ControlledSwitch";
import Form from "../../../components/Form";
@@ -30,6 +31,7 @@ export interface CollectionCreatePageFormData {
export interface CollectionCreatePageProps {
disabled: boolean;
errors: UserError[];
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: CollectionCreatePageFormData) => void;
}
@@ -53,7 +55,7 @@ const decorate = withStyles(theme => ({
}
}));
const CollectionCreatePage = decorate<CollectionCreatePageProps>(
- ({ classes, disabled, errors, onBack, onSubmit }) => (
+ ({ classes, disabled, errors, saveButtonBarState, onBack, onSubmit }) => (
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
@@ -141,6 +143,7 @@ const CollectionCreatePage = decorate<CollectionCreatePageProps>(
</div>
</div>
<SaveButtonBar
+ state={saveButtonBarState}
disabled={disabled || !hasChanged}
onCancel={onBack}
onSave={submit}
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index c50f40ea50..872dc484c1 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -2,6 +2,7 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import { CardSpacer } from "../../../components/CardSpacer";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -27,6 +28,7 @@ export interface CollectionDetailsPageFormData {
export interface CollectionDetailsPageProps extends PageListProps {
collection: CollectionDetails_collection;
isFeatured: boolean;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onCollectionRemove: () => void;
onImageDelete: () => void;
@@ -48,6 +50,7 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(
collection,
disabled,
isFeatured,
+ saveButtonBarState,
onBack,
onCollectionRemove,
onImageDelete,
@@ -116,6 +119,7 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(
</div>
</div>
<SaveButtonBar
+ state={saveButtonBarState}
disabled={disabled || !hasChanged}
onCancel={onBack}
onDelete={onCollectionRemove}
diff --git a/saleor/static/dashboard-next/components/ActionDialog/ActionDialog.tsx b/saleor/static/dashboard-next/components/ActionDialog/ActionDialog.tsx
index e438f77037..90005f09d7 100644
--- a/saleor/static/dashboard-next/components/ActionDialog/ActionDialog.tsx
+++ b/saleor/static/dashboard-next/components/ActionDialog/ActionDialog.tsx
@@ -13,7 +13,7 @@ import ConfirmButton, {
} from "../ConfirmButton/ConfirmButton";
interface ActionDialogProps {
- confirmButtonState: ConfirmButtonTransitionState;
+ confirmButtonState?: ConfirmButtonTransitionState;
open: boolean;
title: string;
variant?: string;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
index bad4e81cfc..03d4f84d18 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
@@ -2,12 +2,11 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import { CardSpacer } from "../../../components/CardSpacer";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
import { UserError } from "../../../types";
import { AddressTypeInput } from "../../types";
@@ -25,7 +24,7 @@ export interface CustomerCreatePageProps {
countries: CustomerCreateData_shop_countries[];
disabled: boolean;
errors: UserError[];
- saveButtonBar: SaveButtonBarState;
+ saveButtonBar: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: CustomerCreatePageFormData) => void;
}
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index 6ffcd57410..ee660a4fd5 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -2,12 +2,11 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import { CardSpacer } from "../../../components/CardSpacer";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import { maybe } from "../../../misc";
import { UserError } from "../../../types";
import { CustomerDetails_user } from "../../types/CustomerDetails";
@@ -26,7 +25,7 @@ export interface CustomerDetailsPageProps {
customer: CustomerDetails_user;
disabled: boolean;
errors: UserError[];
- saveButtonBar: SaveButtonBarState;
+ saveButtonBar: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: CustomerDetailsPageFormData) => void;
onViewAllOrdersClick: () => void;
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
index d70d0a13d3..7172517b6b 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
@@ -3,6 +3,7 @@ import Typography from "@material-ui/core/Typography";
import * as React from "react";
import { CardMenu } from "../../../components/CardMenu/CardMenu";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
import DateFormatter from "../../../components/DateFormatter";
import PageHeader from "../../../components/PageHeader";
@@ -28,6 +29,7 @@ export interface OrderDraftPageProps {
code: string;
label: string;
}>;
+ saveButtonBarState: ConfirmButtonTransitionState;
variants: Array<{
id: string;
name: string;
@@ -77,6 +79,7 @@ const OrderDraftPage = decorate<OrderDraftPageProps>(
classes,
disabled,
fetchUsers,
+ saveButtonBarState,
onBack,
onBillingAddressEdit,
onCustomerEdit,
@@ -146,6 +149,7 @@ const OrderDraftPage = decorate<OrderDraftPageProps>(
</div>
</div>
<SaveButtonBar
+ state={saveButtonBarState}
disabled={disabled || maybe(() => order.lines.length === 0)}
onCancel={onBack}
onSave={onDraftFinalize}
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
index e333a71eb4..9cdaf2fcf6 100644
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import { Container } from "../../../components/Container";
import Form, { FormProps } from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
import PageContent from "../PageContent";
import PageDeleteDialog from "../PageDeleteDialog";
@@ -19,7 +18,7 @@ interface PageInput {
availableOn: string;
isVisible: boolean;
}
-interface PageDetailsPageProps {
+export interface PageDetailsPageProps {
page?: PageInput & {
created?: string;
};
@@ -29,7 +28,7 @@ interface PageDetailsPageProps {
}>;
disabled?: boolean;
title?: string;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack?();
onDelete?();
onSubmit(data: PageInput);
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
index 8f7757065c..cb7800e7e9 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeCreatePage/ProductTypeCreatePage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import { TaxRateType, WeightUnitsEnum } from "../../../types/globalTypes";
import ProductTypeDetails from "../ProductTypeDetails/ProductTypeDetails";
import ProductTypeShipping from "../ProductTypeShipping/ProductTypeShipping";
@@ -19,7 +18,7 @@ export interface ProductTypeForm {
taxRate: TaxRateType;
weight: number;
}
-interface ProductTypeCreatePageProps {
+export interface ProductTypeCreatePageProps {
errors: Array<{
field: string;
message: string;
@@ -27,7 +26,7 @@ interface ProductTypeCreatePageProps {
defaultWeightUnit: WeightUnitsEnum;
disabled: boolean;
pageTitle: string;
- saveButtonBarState: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: ProductTypeForm) => void;
}
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
index db5cb5da0a..8c3ed64127 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
@@ -3,13 +3,12 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import ActionDialog from "../../../components/ActionDialog";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import { ControlledCheckbox } from "../../../components/ControlledCheckbox";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
@@ -46,7 +45,7 @@ export interface ProductTypeDetailsPageProps {
defaultWeightUnit: WeightUnitsEnum;
disabled: boolean;
pageTitle: string;
- saveButtonBarState: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onAttributeAdd: (type: AttributeTypeEnum) => void;
onAttributeDelete: (id: string, event: React.MouseEvent<any>) => void;
onAttributeUpdate: (id: string) => void;
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
index 88bb3ff41f..2637cf838a 100644
--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
import { UserError } from "../../../types";
@@ -62,7 +61,7 @@ interface ProductCreatePageProps {
productAttributes: ProductCreateData_productTypes_edges_node_productAttributes[];
}>;
header: string;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onAttributesEdit: () => void;
onBack?();
onSubmit?(data: FormData);
diff --git a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
index 71e333aff7..cfd4a08638 100644
--- a/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImagePage/ProductImagePage.tsx
@@ -5,12 +5,11 @@ import TextField from "@material-ui/core/TextField";
import * as React from "react";
import CardTitle from "../../../components/CardTitle";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
import ProductImageNavigation from "../ProductImageNavigation";
@@ -26,7 +25,7 @@ interface ProductImagePageProps {
url: string;
}>;
disabled: boolean;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onDelete: () => void;
onRowClick: (id: string) => () => void;
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 09d3dee65c..e2bd91286a 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
import { UserError } from "../../../types";
@@ -50,7 +49,7 @@ interface ProductUpdateProps {
images?: ProductDetails_product_images[];
product?: ProductDetails_product;
header: string;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onVariantShow: (id: string) => () => void;
onImageDelete: (id: string) => () => void;
onAttributesEdit: () => void;
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index a447ff4eb1..93c6eb79e8 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
import { UserError } from "../../../types";
@@ -33,7 +32,7 @@ interface ProductVariantCreatePageProps {
header: string;
loading: boolean;
product: ProductVariantCreateData_product;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: FormData) => void;
onVariantClick: (variantId: string) => void;
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
index bb348662dd..a2a9273233 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
@@ -1,12 +1,11 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
import { maybe } from "../../../misc";
import { UserError } from "../../../types";
@@ -21,7 +20,7 @@ import ProductVariantStock from "../ProductVariantStock";
interface ProductVariantPageProps {
variant?: ProductVariant;
errors: UserError[];
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState: ConfirmButtonTransitionState;
loading?: boolean;
placeholderImage?: string;
header: string;
@@ -158,7 +157,7 @@ const ProductVariantPage = decorate<ProductVariantPageProps>(
</div>
</div>
<SaveButtonBar
- disabled={loading || !onSubmit || !hasChanged}
+ disabled={loading || !hasChanged}
state={saveButtonBarState}
onCancel={onBack}
onDelete={onDelete}
diff --git a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
index c18d7a231b..82730d7eb4 100644
--- a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
+++ b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
@@ -2,6 +2,7 @@ import { withStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -26,6 +27,7 @@ export interface SiteSettingsPageProps {
message: string;
}>;
shop: SiteSettings_shop;
+ saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onKeyAdd: () => void;
onKeyRemove: (keyType: AuthorizationKeyType) => void;
@@ -45,6 +47,7 @@ const SiteSettingsPage = decorate<SiteSettingsPageProps>(
classes,
disabled,
errors,
+ saveButtonBarState,
shop,
onBack,
onKeyAdd,
@@ -89,6 +92,7 @@ const SiteSettingsPage = decorate<SiteSettingsPageProps>(
/>
</div>
<SaveButtonBar
+ state={saveButtonBarState}
disabled={disabled || !hasChanged}
onCancel={onBack}
onSave={submit}
diff --git a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
index 32dd608ec2..772978f81f 100644
--- a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
@@ -1,6 +1,7 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -23,6 +24,7 @@ interface FormData {
export interface StaffDetailsPageProps {
disabled: boolean;
permissions: StaffMemberDetails_shop_permissions[];
+ saveButtonBarState: ConfirmButtonTransitionState;
staffMember: StaffMemberDetails_user;
onBack: () => void;
onDelete: () => void;
@@ -44,6 +46,7 @@ const StaffDetailsPage = decorate<StaffDetailsPageProps>(
classes,
disabled,
permissions,
+ saveButtonBarState,
staffMember,
onBack,
onDelete,
@@ -71,7 +74,7 @@ const StaffDetailsPage = decorate<StaffDetailsPageProps>(
onSubmit={onSubmit}
key={JSON.stringify({ staffMember, permissions })}
>
- {({ data, change, submit }) => (
+ {({ data, change, hasChanged, submit }) => (
<Container width="md">
<PageHeader
title={maybe(() => staffMember.email)}
@@ -101,6 +104,8 @@ const StaffDetailsPage = decorate<StaffDetailsPageProps>(
</div>
</div>
<SaveButtonBar
+ disabled={disabled || !hasChanged}
+ state={saveButtonBarState}
onCancel={onBack}
onSave={submit}
onDelete={onDelete}
diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx
index bc3caf5a8a..1366ec42e3 100644
--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryCreatePage.tsx
@@ -10,7 +10,8 @@ const createProps: CategoryCreatePageProps = {
disabled: false,
errors: [],
onBack: () => undefined,
- onSubmit: () => undefined
+ onSubmit: () => undefined,
+ saveButtonBarState: "default"
};
storiesOf("Views / Categories / Create category", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
index 82ec147fe1..29fd3ef30f 100644
--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
@@ -32,6 +32,7 @@ const updateProps: CategoryUpdatePageProps = {
},
placeholderImage,
products: category.products.edges.map(edge => edge.node),
+ saveButtonBarState: "default",
subcategories: category.children.edges.map(edge => edge.node)
};
diff --git a/saleor/static/dashboard-next/storybook/stories/collections/CollectionCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/collections/CollectionCreatePage.tsx
index 955173c347..9a54175c0d 100644
--- a/saleor/static/dashboard-next/storybook/stories/collections/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/collections/CollectionCreatePage.tsx
@@ -10,7 +10,8 @@ const props: CollectionCreatePageProps = {
disabled: false,
errors: [],
onBack: () => undefined,
- onSubmit: () => undefined
+ onSubmit: () => undefined,
+ saveButtonBarState: "default"
};
storiesOf("Views / Collections / Create collection", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
index 6821f76fc1..652d8a5322 100644
--- a/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
@@ -25,7 +25,8 @@ const props: CollectionDetailsPageProps = {
onImageDelete: () => undefined,
onImageUpload: () => undefined,
onProductUnassign: () => undefined,
- onSubmit: () => undefined
+ onSubmit: () => undefined,
+ saveButtonBarState: "default"
};
storiesOf("Views / Collections / Collection details", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
index 2281d8a553..2ff80c61e2 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/SaveButtonBar.tsx
@@ -1,20 +1,23 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import SaveButtonBar from "../../../components/SaveButtonBar";
import Decorator from "../../Decorator";
-const callbacks = {
+const props = {
+ disabled: false,
onCancel: undefined,
onDelete: undefined,
- onSave: undefined
+ onSave: undefined,
+ state: "default" as ConfirmButtonTransitionState
};
interface InteractiveDemoProps {
targetState: "success" | "error" | "string";
}
interface InteractiveDemoState {
- state: "success" | "error" | "loading" | "default";
+ state: ConfirmButtonTransitionState;
}
class InteractiveDemo extends React.Component<
@@ -41,7 +44,7 @@ class InteractiveDemo extends React.Component<
this.setState({
state: this.props.targetState as "success" | "error"
});
- }, 2000);
+ }, 3000);
}
);
}
@@ -50,9 +53,10 @@ class InteractiveDemo extends React.Component<
render() {
return (
<SaveButtonBar
+ disabled={false}
onCancel={() => undefined}
onSave={this.handleButtonClick}
- state={this.state.state as any}
+ state={this.state.state}
/>
);
}
@@ -60,10 +64,10 @@ class InteractiveDemo extends React.Component<
storiesOf("Generics / SaveButtonBar", module)
.addDecorator(Decorator)
- .add("idle", () => <SaveButtonBar {...callbacks} state="default" />)
- .add("loading", () => <SaveButtonBar {...callbacks} state="loading" />)
- .add("success", () => <SaveButtonBar {...callbacks} state="success" />)
- .add("error", () => <SaveButtonBar {...callbacks} state="error" />)
- .add("disabled", () => <SaveButtonBar {...callbacks} disabled />)
+ .add("idle", () => <SaveButtonBar {...props} state="default" />)
+ .add("loading", () => <SaveButtonBar {...props} state="loading" />)
+ .add("success", () => <SaveButtonBar {...props} state="success" />)
+ .add("error", () => <SaveButtonBar {...props} state="error" />)
+ .add("disabled", () => <SaveButtonBar {...props} disabled />)
.add("interactive success", () => <InteractiveDemo targetState="success" />)
.add("interactive error", () => <InteractiveDemo targetState="error" />);
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
index f2e81a5674..c5d7fd8b96 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
@@ -34,6 +34,7 @@ const props: OrderDraftPageProps = {
onShippingAddressEdit: undefined,
onShippingMethodEdit: undefined,
order,
+ saveButtonBarState: "default",
users: clients,
usersLoading: false,
variants,
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
index 6d66965726..6417539dc2 100644
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
@@ -1,13 +1,16 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import PageDetailsPage from "../../../pages/components/PageDetailsPage";
+import PageDetailsPage, {
+ PageDetailsPageProps
+} from "../../../pages/components/PageDetailsPage";
import { page } from "../../../pages/fixtures";
import Decorator from "../../Decorator";
-const callbacks = {
+const callbacks: PageDetailsPageProps = {
onBack: () => undefined,
- onSubmit: () => undefined
+ onSubmit: () => undefined,
+ saveButtonBarState: "default"
};
storiesOf("Views / Pages / Page details", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx
index 83a1887a69..f0bbef8132 100644
--- a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeCreatePage.tsx
@@ -1,16 +1,17 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import ProductTypeCreatePage from "../../../productTypes/components/ProductTypeCreatePage";
+import ProductTypeCreatePage, {
+ ProductTypeCreatePageProps
+} from "../../../productTypes/components/ProductTypeCreatePage";
import { WeightUnitsEnum } from "../../../types/globalTypes";
import Decorator from "../../Decorator";
-const props = {
+const props: ProductTypeCreatePageProps = {
defaultWeightUnit: "kg" as WeightUnitsEnum,
disabled: false,
errors: [],
onBack: () => undefined,
- onDelete: () => undefined,
onSubmit: () => undefined,
pageTitle: "Create product type",
saveButtonBarState: "default"
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
index bb2c61083c..f510e73dfe 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
@@ -22,6 +22,7 @@ storiesOf("Views / Products / Create product", module)
onAttributesEdit={undefined}
onBack={() => undefined}
onSubmit={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("When loading", () => (
@@ -36,5 +37,6 @@ storiesOf("Views / Products / Create product", module)
onAttributesEdit={undefined}
onBack={() => undefined}
onSubmit={() => undefined}
+ saveButtonBarState="default"
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
index b43dfdf64f..9d34079b81 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductImagePage.tsx
@@ -21,6 +21,7 @@ storiesOf("Views / Products / Product image details", module)
onDelete={undefined}
onRowClick={() => undefined}
onSubmit={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("when loading data", () => (
@@ -30,5 +31,6 @@ storiesOf("Views / Products / Product image details", module)
onDelete={undefined}
onRowClick={() => undefined}
onSubmit={() => undefined}
+ saveButtonBarState="default"
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
index 3ff93bacc4..45123b345e 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
@@ -29,6 +29,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantAdd={undefined}
onVariantShow={() => undefined}
onImageDelete={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("when product has no images", () => (
@@ -50,6 +51,7 @@ storiesOf("Views / Products / Product edit", module)
onImageDelete={() => undefined}
onVariantAdd={undefined}
onVariantShow={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("when product has no variants", () => (
@@ -76,6 +78,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantAdd={undefined}
onImageDelete={() => undefined}
onVariantShow={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("when loading data", () => (
@@ -91,5 +94,6 @@ storiesOf("Views / Products / Product edit", module)
onDelete={undefined}
onImageDelete={() => undefined}
onVariantShow={() => undefined}
+ saveButtonBarState="default"
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
index 809d1addd5..e07f67695c 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx
@@ -38,6 +38,7 @@ storiesOf("Views / Products / Create product variant", module)
onBack={() => undefined}
onSubmit={() => undefined}
onVariantClick={undefined}
+ saveButtonBarState="default"
/>
))
.add("with errors", () => (
@@ -50,6 +51,7 @@ storiesOf("Views / Products / Create product variant", module)
onBack={() => undefined}
onSubmit={() => undefined}
onVariantClick={undefined}
+ saveButtonBarState="default"
/>
))
.add("when loading data", () => (
@@ -62,5 +64,6 @@ storiesOf("Views / Products / Create product variant", module)
onBack={() => undefined}
onSubmit={() => undefined}
onVariantClick={undefined}
+ saveButtonBarState="default"
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
index d93f9cbbc2..111f82acab 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantPage.tsx
@@ -20,6 +20,7 @@ storiesOf("Views / Products / Product variant details", module)
onImageSelect={() => undefined}
onSubmit={() => undefined}
onVariantClick={() => undefined}
+ saveButtonBarState="default"
/>
))
.add("when loading data", () => (
@@ -33,5 +34,6 @@ storiesOf("Views / Products / Product variant details", module)
onImageSelect={() => undefined}
onSubmit={() => undefined}
onVariantClick={() => undefined}
+ saveButtonBarState="default"
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx b/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx
index 2b0c2b25e0..2a6232ed67 100644
--- a/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/siteSettings/SiteSettingsPage.tsx
@@ -15,6 +15,7 @@ const props: SiteSettingsPageProps = {
onKeyAdd: () => undefined,
onKeyRemove: () => undefined,
onSubmit: () => undefined,
+ saveButtonBarState: "default",
shop
};
diff --git a/saleor/static/dashboard-next/storybook/stories/staff/StaffDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/staff/StaffDetailsPage.tsx
index c5dd4bd839..51a5c55016 100644
--- a/saleor/static/dashboard-next/storybook/stories/staff/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/staff/StaffDetailsPage.tsx
@@ -13,6 +13,7 @@ const props: StaffDetailsPageProps = {
onDelete: () => undefined,
onSubmit: () => undefined,
permissions,
+ saveButtonBarState: "default",
staffMember
};
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx
index e2c4ba5901..a2f78ba77e 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherDetailsPage/VoucherDetailsPage.tsx
@@ -5,12 +5,11 @@ import * as React from "react";
import { createVoucherName, VoucherType } from "../..";
import ActionDialog from "../../../components/ActionDialog";
+import { ConfirmButtonTransitionState } from "../../../components/ConfirmButton/ConfirmButton";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
+import SaveButtonBar from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
import i18n from "../../../i18n";
import VoucherDetails from "../VoucherDetails/VoucherDetails";
@@ -56,7 +55,7 @@ interface VoucherDetailsPageProps {
label: string;
code: string;
}>;
- saveButtonBarState?: SaveButtonBarState;
+ saveButtonBarState?: ConfirmButtonTransitionState;
loadingCategories?: boolean;
loadingProducts?: boolean;
loadingShipping?: boolean;