Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Refactor the delete dialog
Patryk Zawadzkia56fb5cbd4d9
diff --git a/saleor/static/dashboard-next/category/views/details.tsx b/saleor/static/dashboard-next/category/views/details.tsxindex eabbcf69fe..200a87e243 100644--- a/saleor/static/dashboard-next/category/views/details.tsx+++ b/saleor/static/dashboard-next/category/views/details.tsx@@ -6,12 +6,12 @@ import { stringify as stringifyQs } from "qs";import * as React from "react";import { Redirect } from "react-router-dom";+import CategoryDeleteDialog from "../../components/CategoryDeleteDialog";import CategoryPropertiesCard from "../../components/CategoryPropertiesCard";import ErrorMessageCard from "../../components/ErrorMessageCard";import Navigator, { NavigatorLink } from "../../components/Navigator";import Toggle from "../../components/Toggle";import { CategoryPropertiesQuery } from "../../gql-types";-import CategoryDeleteDialog from "../components/CategoryDeleteDialog";import CategoryProducts from "../components/CategoryProducts";import CategorySubcategories from "../components/CategorySubcategories";import ProductFilters from "../components/ProductFilters";@@ -245,7 +245,7 @@ const CategoryDetails = decorate<CategoryDetailsProps>(}onClose={hideDelete}onConfirm={deleteCategory}- opened={deleteVisible}+ open={deleteVisible}productCount={data.category &&data.category.products &&diff --git a/saleor/static/dashboard-next/category/components/CategoryDeleteDialog.tsx b/saleor/static/dashboard-next/components/CategoryDeleteDialog/CategoryDeleteDialog.tsxsimilarity index 94%rename from saleor/static/dashboard-next/category/components/CategoryDeleteDialog.tsxrename to saleor/static/dashboard-next/components/CategoryDeleteDialog/CategoryDeleteDialog.tsxindex e59c54d136..00d7ed0cce 100644--- a/saleor/static/dashboard-next/category/components/CategoryDeleteDialog.tsx+++ b/saleor/static/dashboard-next/components/CategoryDeleteDialog/CategoryDeleteDialog.tsx@@ -3,6 +3,7 @@ import Dialog, {DialogActions,DialogContent,DialogContentText,+ DialogProps,DialogTitle} from "material-ui/Dialog";import { withStyles } from "material-ui/styles";@@ -20,9 +21,8 @@ const decorate = withStyles(theme => ({}}));-interface CategoryDeleteDialogProps {+export interface CategoryDeleteDialogProps extends DialogProps {name: string;- opened?: boolean;productCount?: number;onClose?();onConfirm?();@@ -33,14 +33,13 @@ const CategoryDeleteDialog = decorate<CategoryDeleteDialogProps>(props => {children,classes,name,- opened,onConfirm,onClose,productCount,...dialogProps} = props;return (- <Dialog open={opened} {...dialogProps}>+ <Dialog {...dialogProps}><DialogTitle>{i18n.t("Delete category", { context: "title" })}</DialogTitle>diff --git a/saleor/static/dashboard-next/components/CategoryDeleteDialog/index.ts b/saleor/static/dashboard-next/components/CategoryDeleteDialog/index.tsnew file mode 100644index 0000000000..31957694a0--- /dev/null+++ b/saleor/static/dashboard-next/components/CategoryDeleteDialog/index.ts@@ -0,0 +1,2 @@+export { default } from "./CategoryDeleteDialog";+export * from "./CategoryDeleteDialog";