Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add "add variant" button
dominik-zeglena3fab16989a3
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx b/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsxindex 1a598e4207..8d8d6ad7d5 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx@@ -1,3 +1,4 @@+import Button from "@material-ui/core/Button";import Card from "@material-ui/core/Card";import {createStyles,@@ -47,6 +48,7 @@ interface ProductVariantNavigationProps extends WithStyles<typeof styles> {variants:| ProductVariantDetails_productVariant[]| ProductVariantCreateData_product_variants[];+ onAdd?: () => void;onRowClick: (variantId: string) => void;}@@ -57,6 +59,7 @@ const ProductVariantNavigation = withStyles(styles, {classes,current,variants,+ onAdd,onRowClick}: ProductVariantNavigationProps) => (<Card>@@ -89,6 +92,15 @@ const ProductVariantNavigation = withStyles(styles, {</TableRow>))}+ {onAdd && (+ <TableRow>+ <TableCell colSpan={2}>+ <Button color="primary" onClick={onAdd}>+ {i18n.t("Add variant")}+ </Button>+ </TableCell>+ </TableRow>+ )}</TableBody></Table></Card>diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsxindex 7895269c89..d2cd45aa9d 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx@@ -26,6 +26,7 @@ interface ProductVariantPageProps {loading?: boolean;placeholderImage?: string;header: string;+ onAdd();onBack();onDelete();onSubmit(data: any);@@ -40,6 +41,7 @@ const ProductVariantPage: React.StatelessComponent<ProductVariantPageProps> = ({placeholderImage,saveButtonBarState,variant,+ onAdd,onBack,onDelete,onImageSelect,@@ -97,6 +99,7 @@ const ProductVariantPage: React.StatelessComponent<ProductVariantPageProps> = ({<ProductVariantNavigationcurrent={variant ? variant.id : undefined}variants={maybe(() => variant.product.variants)}+ onAdd={onAdd}onRowClick={(variantId: string) => {if (variant) {return onVariantClick(variantId);diff --git a/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx b/saleor/static/dashboard-next/products/views/ProductVariant/index.tsxindex 72cc01aac1..17e1787f61 100644--- a/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx+++ b/saleor/static/dashboard-next/products/views/ProductVariant/index.tsx@@ -12,7 +12,11 @@ import ProductVariantPage from "../../components/ProductVariantPage";import ProductVariantOperations from "../../containers/ProductVariantOperations";import { TypedProductVariantQuery } from "../../queries";import { VariantUpdate } from "../../types/VariantUpdate";-import { productUrl, productVariantEditUrl } from "../../urls";+import {+ productUrl,+ productVariantAddUrl,+ productVariantEditUrl+} from "../../urls";import { productVariantRemovePath, productVariantRemoveUrl } from "./urls";interface ProductUpdateProps {@@ -130,6 +134,9 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({header={variant ? variant.name || variant.sku : undefined}+ onAdd={() =>+ navigate(productVariantAddUrl(productId))+ }onBack={handleBack}onDelete={() =>navigate(