diff --git a/src/products/components/ProductCreatePage/ProductCreatePage.tsx b/src/products/components/ProductCreatePage/ProductCreatePage.tsx index 97cbb189a..3874ae966 100644 --- a/src/products/components/ProductCreatePage/ProductCreatePage.tsx +++ b/src/products/components/ProductCreatePage/ProductCreatePage.tsx @@ -78,7 +78,6 @@ interface ProductCreatePageProps { fetchCategories: (data: string) => void; fetchCollections: (data: string) => void; fetchProductTypes: (data: string) => void; - onAttributesEdit: () => void; onBack?(); onSubmit?(data: ProductCreatePageSubmitData); } @@ -220,12 +219,14 @@ export const ProductCreatePage: React.StatelessComponent< onChange={change} /> - + {attributes.length > 0 && ( + + )} void; onVariantShow: (id: string) => () => void; onImageDelete: (id: string) => () => void; - onAttributesEdit: () => void; onBack?(); onDelete(); onImageEdit?(id: string); @@ -92,7 +91,6 @@ export const ProductUpdatePage: React.FC = ({ product, saveButtonBarState, variants, - onAttributesEdit, onBack, onDelete, onImageDelete, @@ -215,12 +213,14 @@ export const ProductUpdatePage: React.FC = ({ onImageUpload={onImageUpload} /> - + {attributes.length > 0 && ( + + )} = ({ disabled={disabled} variants={variants} fallbackPrice={product ? product.basePrice : undefined} - onAttributesEdit={onAttributesEdit} onRowClick={onVariantShow} onVariantAdd={onVariantAdd} toolbar={toolbar} diff --git a/src/products/components/ProductVariants/ProductVariants.tsx b/src/products/components/ProductVariants/ProductVariants.tsx index 803b46e7f..bf6332396 100644 --- a/src/products/components/ProductVariants/ProductVariants.tsx +++ b/src/products/components/ProductVariants/ProductVariants.tsx @@ -67,7 +67,6 @@ interface ProductVariantsProps extends ListActions, WithStyles { disabled: boolean; variants: ProductDetails_product_variants[]; fallbackPrice?: ProductVariant_costPrice; - onAttributesEdit: () => void; onRowClick: (id: string) => () => void; onVariantAdd?(); } @@ -80,7 +79,6 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })( disabled, variants, fallbackPrice, - onAttributesEdit, onRowClick, onVariantAdd, isChecked, @@ -90,6 +88,8 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })( toolbar }: ProductVariantsProps) => { const intl = useIntl(); + const hasVariants = maybe(() => variants.length > 0, true); + return ( - - - {!variants.length && ( - + )} - - - - - - - - - - - - - + {hasVariants && ( + + + - - - - {renderCollection( - variants, - variant => { + + + + + + + + + + + + + + {renderCollection(variants, variant => { const isSelected = variant ? isChecked(variant.id) : false; return ( @@ -237,17 +225,10 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })( ); - }, - () => ( - - - - - - ) - )} - - + })} + + + )} ); } diff --git a/src/products/views/ProductCreate.tsx b/src/products/views/ProductCreate.tsx index f9ee3af0b..aac14ea19 100644 --- a/src/products/views/ProductCreate.tsx +++ b/src/products/views/ProductCreate.tsx @@ -29,7 +29,6 @@ export const ProductUpdate: React.StatelessComponent< const shop = useShop(); const intl = useIntl(); - const handleAttributesEdit = undefined; const handleBack = () => navigate(productListUrl()); return ( @@ -146,7 +145,6 @@ export const ProductUpdate: React.StatelessComponent< edge => edge.node ) )} - onAttributesEdit={handleAttributesEdit} onBack={handleBack} onSubmit={handleSubmit} saveButtonBarState={formTransitionState} diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index 9e9e9f866..d86c58c25 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -15,7 +15,6 @@ import { DEFAULT_INITIAL_SEARCH_DATA } from "../../../config"; import SearchCategories from "../../../containers/SearchCategories"; import SearchCollections from "../../../containers/SearchCollections"; import { getMutationState, maybe } from "../../../misc"; -import { productTypeUrl } from "../../../productTypes/urls"; import ProductUpdatePage from "../../components/ProductUpdatePage"; import ProductUpdateOperations from "../../containers/ProductUpdateOperations"; import { TypedProductDetailsQuery } from "../../queries"; @@ -234,11 +233,6 @@ export const ProductUpdate: React.StatelessComponent = ({ placeholderImage={placeholderImg} product={product} variants={maybe(() => product.variants)} - onAttributesEdit={() => - navigate( - productTypeUrl(data.product.productType.id) - ) - } onBack={() => { navigate(productListUrl()); }} diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 21cfb6bbc..2c4e5d74f 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -82383,71 +82383,6 @@ Ctrl + K" - - - - Attributes - - - - - - - - - - 0 Attributes - - - - - - - - - - - - - @@ -83483,71 +83418,6 @@ Ctrl + K" - - - - Attributes - - - - - - - - - - 0 Attributes - - - - - - - - - - - - - @@ -84577,71 +84447,6 @@ Ctrl + K" - - - - Attributes - - - - - - - - - - 0 Attributes - - - - - - - - - - - - - @@ -87189,6 +86994,3237 @@ exports[`Storyshots Views / Products / Create product variant with errors 1`] = `; +exports[`Storyshots Views / Products / Product edit no product attributes 1`] = ` + + + + + + Ergonomic Plastic Bacon + + + + + + + + + + + General Informations + + + + + + + + + Name + + + + + + + + + + + + + + + + + Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ↵ + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + italic + + + + + + + + + strikethrough + + + + + + + + + h1 + + + + + + + + + h2 + + + + + + + + + h3 + + + + + + + + + blockquote + + + + + + + + + + ul + + + + + + + + + + + ol + + + + + + + + + + link + + + + + + + + + + + + + + + + + + Images + + + + + Upload image + + + + + + + + + + + + + + + + + + + + + + Drop here to upload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pricing + + + + + + + + + + Charge taxes for this item + + + + + + + + + Price + + + + + + + + + + + + + NZD + + + + + + + + + + + + Variants + + + + + Create variant + + + + + + + + + + + + + + + + Name + + + Status + + + SKU + + + + + + + + + + + + Cordoba Oro + + + + Available + + + + 87192-94370 + + + + + + + + + + silver + + + + Available + + + + 69055-15190 + + + + + + + + + + Search Engine Preview + + + + + Edit website SEO + + + + + + + + + Add search engine title and description to make this product easier to find + + + + + + + + + Organize Product + + + + + + + + Product Type + + + Versatile + + + + Product Type + + + Configurable + + + + + + + + Category + + + + + + + + + + + + + + + + + + + + + + + + + + + Collections + + + + + + + + + + + + + + + + + + + + *Optional. Adding product to collection helps users find it. + + + + + + + + Winter sale + + + + + + + + + + + + + + + + + + + Visibility + + + + + + + + + + + + + + + + + + + + Visible + + + since Aug 25, 2018 + + + + + + + + + + + + + + + Hidden + + + + + + + + + + + + + + +`; + +exports[`Storyshots Views / Products / Product edit no variants 1`] = ` + + + + + + Ergonomic Plastic Bacon + + + + + + + + + + + General Informations + + + + + + + + + Name + + + + + + + + + + + + + + + + + Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ↵ + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + italic + + + + + + + + + strikethrough + + + + + + + + + h1 + + + + + + + + + h2 + + + + + + + + + h3 + + + + + + + + + blockquote + + + + + + + + + + ul + + + + + + + + + + + ol + + + + + + + + + + link + + + + + + + + + + + + + + + + + + Images + + + + + Upload image + + + + + + + + + + + + + + + + + + + + + + Drop here to upload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Attributes + + + + + + + + + + 2 Attributes + + + + + + + + + + + + + + + + Borders + + + + + + + Value + + + + + + + + + + + + + + + + + + + + + + + + + + + Legacy + + + + + + + Values + + + + + + + + + + + + + + + + + + + + + + + + + Auto Loan Account + + + + + + + + + + + + + + + + + + + + + Pricing + + + + + + + + + + Charge taxes for this item + + + + + + + + + Price + + + + + + + + + + + + + NZD + + + + + + + + + + + + Variants + + + + + Create variant + + + + + + + + + + + + + + + + Name + + + Status + + + SKU + + + + + + + + + + + + Cordoba Oro + + + + Available + + + + 87192-94370 + + + + + + + + + + silver + + + + Available + + + + 69055-15190 + + + + + + + + + + Search Engine Preview + + + + + Edit website SEO + + + + + + + + + Add search engine title and description to make this product easier to find + + + + + + + + + Organize Product + + + + + + + + Product Type + + + Versatile + + + + Product Type + + + Configurable + + + + + + + + Category + + + + + + + + + + + + + + + + + + + + + + + + + + + Collections + + + + + + + + + + + + + + + + + + + + *Optional. Adding product to collection helps users find it. + + + + + + + + Winter sale + + + + + + + + + + + + + + + + + + + Visibility + + + + + + + + + + + + + + + + + + + + Visible + + + since Aug 25, 2018 + + + + + + + + + + + + + + + Hidden + + + + + + + + + + + + + + +`; + exports[`Storyshots Views / Products / Product edit when data is fully loaded 1`] = ` - - - Edit attributes - - - - - - Attributes - - - - - - - - - - 0 Attributes - - - - - - - - - - - - - @@ -91174,18 +94133,6 @@ Ctrl + K" - - - Edit attributes - - undefined} productTypes={productTypes} categories={[product.category]} - onAttributesEdit={undefined} onBack={() => undefined} onSubmit={() => undefined} saveButtonBarState="default" @@ -45,7 +44,6 @@ storiesOf("Views / Products / Create product", module) fetchProductTypes={() => undefined} productTypes={productTypes} categories={[product.category]} - onAttributesEdit={undefined} onBack={() => undefined} onSubmit={() => undefined} saveButtonBarState="default" @@ -65,7 +63,6 @@ storiesOf("Views / Products / Create product", module) fetchProductTypes={() => undefined} productTypes={productTypes} categories={[product.category]} - onAttributesEdit={undefined} onBack={() => undefined} onSubmit={() => undefined} saveButtonBarState="default" diff --git a/src/storybook/stories/products/ProductUpdatePage.tsx b/src/storybook/stories/products/ProductUpdatePage.tsx index 65b3d591c..7791884ce 100644 --- a/src/storybook/stories/products/ProductUpdatePage.tsx +++ b/src/storybook/stories/products/ProductUpdatePage.tsx @@ -22,7 +22,6 @@ const props: ProductUpdatePageProps = { fetchCollections: () => undefined, header: product.name, images: product.images, - onAttributesEdit: () => undefined, onBack: () => undefined, onDelete: () => undefined, onImageDelete: () => undefined, @@ -63,4 +62,22 @@ storiesOf("Views / Products / Product edit", module) collections={undefined} images={undefined} /> + )) + .add("no variants", () => ( + + )) + .add("no product attributes", () => ( + ));
+ + + + blockquote + + + +
+ Drop here to upload +
+ NZD +
+ Add search engine title and description to make this product easier to find +
+ Versatile +
+ Configurable +
+ *Optional. Adding product to collection helps users find it. +
+ Winter sale +
+ Visible +
+ Hidden +
+ Borders +
+ Legacy +
+ Auto Loan Account +