Skip to content

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

Fix stories

dominik-zeglend63964e280db
diff --git a/saleor/static/dashboard-next/productTypes/fixtures.ts b/saleor/static/dashboard-next/productTypes/fixtures.ts
index 9718befc76..7980e0ed79 100644
--- a/saleor/static/dashboard-next/productTypes/fixtures.ts
+++ b/saleor/static/dashboard-next/productTypes/fixtures.ts
@@ -2,6 +2,7 @@ import {
ProductCreateData_productTypes_edges_node,
ProductCreateData_productTypes_edges_node_productAttributes
} from "../products/types/ProductCreateData";
+import { AttributeInputTypeEnum } from "../types/globalTypes";
import { ProductTypeDetails_productType } from "./types/ProductTypeDetails";
import { ProductTypeList_productTypes_edges_node } from "./types/ProductTypeList";
@@ -10,6 +11,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo5",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Author",
slug: "author",
values: [
@@ -38,6 +40,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo2",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Box Size",
slug: "box-size",
values: [
@@ -84,6 +87,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZToz",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Brand",
slug: "brand",
values: [
@@ -103,6 +107,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo4",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Candy Box Size",
slug: "candy-box-size",
values: [
@@ -140,6 +145,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo1",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Coffee Genre",
slug: "coffee-genre",
values: [
@@ -168,6 +174,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZToy",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Collar",
slug: "collar",
values: [
@@ -205,6 +212,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTox",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Color",
slug: "color",
values: [
@@ -233,6 +241,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZToxMg==",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Cover",
slug: "cover",
values: [
@@ -297,6 +306,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo3",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Flavor",
slug: "flavor",
values: [
@@ -325,6 +335,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZToxMQ==",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Language",
slug: "language",
values: [
@@ -353,6 +364,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZToxMA==",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Publisher",
slug: "publisher",
values: [
@@ -381,6 +393,7 @@ export const attributes: ProductCreateData_productTypes_edges_node_productAttrib
node: {
__typename: "Attribute" as "Attribute",
id: "UHJvZHVjdEF0dHJpYnV0ZTo0",
+ inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Size",
slug: "size",
values: [
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 5f2f8f52ce..169aa649e5 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -45,7 +45,7 @@ import ProductPricing from "../ProductPricing";
import ProductStock from "../ProductStock";
import ProductVariants from "../ProductVariants";
-interface ProductUpdatePageProps extends ListActions {
+export interface ProductUpdatePageProps extends ListActions {
errors: UserError[];
placeholderImage: string;
collections: SearchCollections_collections_edges_node[];
diff --git a/saleor/static/dashboard-next/products/fixtures.ts b/saleor/static/dashboard-next/products/fixtures.ts
index 6c67af5ab7..5926d151e2 100644
--- a/saleor/static/dashboard-next/products/fixtures.ts
+++ b/saleor/static/dashboard-next/products/fixtures.ts
@@ -33,12 +33,14 @@ export const product: (
}
]
},
- value: {
- __typename: "AttributeValue",
- id: "ptav47282",
- name: "portals",
- slug: "portals"
- }
+ values: [
+ {
+ __typename: "AttributeValue",
+ id: "ptav47282",
+ name: "portals",
+ slug: "portals"
+ }
+ ]
},
{
__typename: "SelectedAttribute",
@@ -75,12 +77,14 @@ export const product: (
}
]
},
- value: {
- __typename: "AttributeValue",
- id: "ptav14907",
- name: "Auto Loan Account",
- slug: "Auto-Loan-Account"
- }
+ values: [
+ {
+ __typename: "AttributeValue",
+ id: "ptav14907",
+ name: "Auto Loan Account",
+ slug: "Auto-Loan-Account"
+ }
+ ]
}
],
basePrice: {
diff --git a/saleor/static/dashboard-next/storybook/stories/components/AddressEdit.tsx b/saleor/static/dashboard-next/storybook/stories/components/AddressEdit.tsx
index 33be7ec699..f1b23149c8 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/AddressEdit.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/AddressEdit.tsx
@@ -22,8 +22,13 @@ storiesOf("Generics / AddressEdit", module)
<AddressEdit
errors={{}}
data={transformAddressToForm(customer.defaultBillingAddress)}
- countries={countries}
+ countries={countries.map(c => ({
+ label: c.label,
+ value: c.code
+ }))}
+ countryDisplayValue={customer.defaultBillingAddress.country.country}
onChange={undefined}
+ onCountryChange={() => undefined}
/>
</CardContent>
</Card>
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderCustomerEditDialog.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderCustomerEditDialog.tsx
index 824bbd1382..698292ebe8 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderCustomerEditDialog.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderCustomerEditDialog.tsx
@@ -17,10 +17,8 @@ storiesOf("Orders / OrderCustomerEditDialog", module)
onClose={undefined}
onConfirm={undefined}
open={true}
- user={{
- label: user.email,
- value: user.id
- }}
+ user={user.id}
+ userDisplayValue={user.email}
users={users}
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
index a45b3d187d..9ce5100a0f 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
@@ -3,123 +3,64 @@ import React from "react";
import { collections } from "@saleor/collections/fixtures";
import { listActionsProps } from "@saleor/fixtures";
-import ProductUpdatePage from "@saleor/products/components/ProductUpdatePage";
+import ProductUpdatePage, {
+ ProductUpdatePageProps
+} from "@saleor/products/components/ProductUpdatePage";
import { product as productFixture } from "@saleor/products/fixtures";
import placeholderImage from "../../../../images/placeholder255x255.png";
import Decorator from "../../Decorator";
const product = productFixture(placeholderImage);
+const props: ProductUpdatePageProps = {
+ ...listActionsProps,
+ categories: [product.category],
+ collections,
+ disabled: false,
+ errors: [],
+ fetchCategories: () => undefined,
+ fetchCollections: () => undefined,
+ header: product.name,
+ images: product.images,
+ onAttributesEdit: () => undefined,
+ onBack: () => undefined,
+ onDelete: () => undefined,
+ onImageDelete: () => undefined,
+ onImageUpload: () => undefined,
+ onProductShow: () => undefined,
+ onSubmit: () => undefined,
+ onVariantAdd: () => undefined,
+ onVariantShow: () => undefined,
+ placeholderImage,
+ product,
+ saveButtonBarState: "default",
+ variants: product.variants
+};
+
storiesOf("Views / Products / Product edit", module)
.addDecorator(Decorator)
- .add("when data is fully loaded", () => (
- <ProductUpdatePage
- disabled={false}
- errors={[]}
- onBack={() => undefined}
- onSubmit={() => undefined}
- product={product}
- header={product.name}
- collections={collections}
- categories={[product.category]}
- fetchCategories={() => undefined}
- fetchCollections={undefined}
- placeholderImage={placeholderImage}
- images={product.images}
- variants={product.variants}
- productCollections={product.collections}
- onAttributesEdit={undefined}
- onDelete={undefined}
- onProductShow={undefined}
- onVariantAdd={undefined}
- onVariantShow={() => undefined}
- onImageDelete={() => undefined}
- onImageUpload={() => undefined}
- saveButtonBarState="default"
- {...listActionsProps}
- />
- ))
+ .add("when data is fully loaded", () => <ProductUpdatePage {...props} />)
.add("when product has no images", () => (
- <ProductUpdatePage
- disabled={false}
- errors={[]}
- onBack={() => undefined}
- onSubmit={() => undefined}
- product={product}
- header={product.name}
- collections={collections}
- categories={[product.category]}
- fetchCategories={() => undefined}
- fetchCollections={undefined}
- placeholderImage={placeholderImage}
- images={[]}
- variants={product.variants}
- productCollections={product.collections}
- onAttributesEdit={undefined}
- onDelete={undefined}
- onProductShow={undefined}
- onImageDelete={() => undefined}
- onVariantAdd={undefined}
- onVariantShow={() => undefined}
- onImageUpload={() => undefined}
- saveButtonBarState="default"
- {...listActionsProps}
- />
+ <ProductUpdatePage {...props} images={[]} />
))
.add("when product has no variants", () => (
<ProductUpdatePage
- disabled={false}
- errors={[]}
- onBack={() => undefined}
- onSubmit={() => undefined}
- product={
- {
- ...product,
- productType: { ...product.productType, hasVariants: false }
- } as any
- }
- header={product.name}
- collections={collections}
- categories={[product.category]}
- fetchCategories={() => undefined}
- fetchCollections={undefined}
- placeholderImage={placeholderImage}
- images={product.images}
- variants={product.variants}
- productCollections={product.collections}
- onAttributesEdit={undefined}
- onDelete={undefined}
- onProductShow={undefined}
- onVariantAdd={undefined}
- onImageDelete={() => undefined}
- onVariantShow={() => undefined}
- onImageUpload={() => undefined}
- saveButtonBarState="default"
- {...listActionsProps}
+ {...props}
+ product={{
+ ...product,
+ productType: { ...product.productType, hasVariants: false }
+ }}
/>
))
.add("when loading data", () => (
<ProductUpdatePage
- errors={[]}
+ {...props}
+ disabled={true}
header={undefined}
categories={[]}
- fetchCategories={() => undefined}
- fetchCollections={undefined}
- onBack={() => undefined}
- onSubmit={() => undefined}
- disabled={true}
- placeholderImage={placeholderImage}
- onAttributesEdit={undefined}
- onDelete={undefined}
- onImageDelete={() => undefined}
- onVariantShow={() => undefined}
- onImageUpload={() => undefined}
- saveButtonBarState="default"
variants={undefined}
product={undefined}
collections={undefined}
images={undefined}
- productCollections={undefined}
- {...listActionsProps}
/>
));