Skip to content

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

Remove unused imports and variables

dominik-zeglena612993a5e97
diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx
index 0c3b9ddfbe..7e3d1a8f19 100644
--- a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx
+++ b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx
@@ -1,6 +1,4 @@
-import IconButton from "@material-ui/core/IconButton";
import { withStyles } from "@material-ui/core/styles";
-import DeleteIcon from "@material-ui/icons/Delete";
import * as React from "react";
import DialogContentText from "@material-ui/core/DialogContentText";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx b/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx
index 448ff12f1e..013bd998b6 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx
@@ -7,7 +7,6 @@ import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
-import * as classNames from "classnames";
import * as React from "react";
import DateFormatter from "../../../components/DateFormatter";
@@ -40,7 +39,7 @@ interface CustomerOrdersProps {
onRowClick?(id: string);
}
-const decorate = withStyles(theme => ({
+const decorate = withStyles({
link: {
color: blue[500],
cursor: "pointer",
@@ -49,11 +48,10 @@ const decorate = withStyles(theme => ({
textRight: {
textAlign: "right" as "right"
}
-}));
+});
const CustomerOrders = decorate<CustomerOrdersProps>(
({
classes,
- dateNow,
hasNextPage,
hasPreviousPage,
orders,
diff --git a/saleor/static/dashboard-next/orders/components/OrderCancelDialog/OrderCancelDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderCancelDialog/OrderCancelDialog.tsx
index 92e80fcc48..ca4ac91c3f 100644
--- a/saleor/static/dashboard-next/orders/components/OrderCancelDialog/OrderCancelDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderCancelDialog/OrderCancelDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
@@ -29,7 +29,7 @@ const decorate = withStyles(
{ name: "OrderCancelDialog" }
);
const OrderCancelDialog = decorate<OrderCancelDialogProps>(
- ({ children, classes, id, open, onConfirm, onClose }) => (
+ ({ classes, id, open, onConfirm, onClose }) => (
<Dialog open={open}>
<DialogTitle>{i18n.t("Cancel order", { context: "title" })}</DialogTitle>
<DialogContent>
diff --git a/saleor/static/dashboard-next/orders/components/OrderCustomerEditDialog/OrderCustomerEditDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderCustomerEditDialog/OrderCustomerEditDialog.tsx
index 0b1110d615..e470fc9254 100644
--- a/saleor/static/dashboard-next/orders/components/OrderCustomerEditDialog/OrderCustomerEditDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderCustomerEditDialog/OrderCustomerEditDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index 6adb504cb1..1c3134a6ce 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -1,12 +1,7 @@
import { withStyles, WithStyles } from "@material-ui/core/styles";
import * as React from "react";
-import {
- AddressType,
- OrderStatus,
- transformAddressToForm,
- transformOrderStatus
-} from "../..";
+import { AddressType, OrderStatus, transformAddressToForm } from "../..";
import { Container } from "../../../components/Container";
import DateFormatter from "../../../components/DateFormatter";
import Form from "../../../components/Form";
@@ -229,7 +224,6 @@ class OrderDetailsPageComponent extends React.Component<
shippingMethods,
user,
users,
- usersLoading,
variants,
variantsLoading,
fetchShippingMethods,
@@ -243,7 +237,6 @@ class OrderDetailsPageComponent extends React.Component<
onOrderLineRemove,
onPackingSlipClick,
onPaymentRelease,
- onPrintClick,
onProductClick
} = this.props;
const {
diff --git a/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx b/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx
index b1eb795395..74e18ae29b 100644
--- a/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderFulfillment/OrderFulfillment.tsx
@@ -1,17 +1,12 @@
-import Avatar from "@material-ui/core/Avatar";
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import CardActions from "@material-ui/core/CardActions";
-import CardContent from "@material-ui/core/CardContent";
-import IconButton from "@material-ui/core/IconButton";
import { withStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
-import Cached from "@material-ui/icons/Cached";
-import PrintIcon from "@material-ui/icons/Print";
import * as React from "react";
import { transformFulfillmentStatus } from "../..";
diff --git a/saleor/static/dashboard-next/orders/components/OrderFulfillmentCancelDialog/OrderFulfillmentCancelDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderFulfillmentCancelDialog/OrderFulfillmentCancelDialog.tsx
index d4c254f9dc..734c408614 100644
--- a/saleor/static/dashboard-next/orders/components/OrderFulfillmentCancelDialog/OrderFulfillmentCancelDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderFulfillmentCancelDialog/OrderFulfillmentCancelDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
@@ -30,7 +30,7 @@ const decorate = withStyles(
);
const OrderFulfillmentCancelDialog = decorate<
OrderFulfillmentCancelDialogProps
->(({ children, classes, id, open, onConfirm, onClose }) => (
+>(({ classes, id, open, onConfirm, onClose }) => (
<Dialog open={open}>
<DialogTitle>
{i18n.t("Cancel fulfillment", { context: "title" })}
diff --git a/saleor/static/dashboard-next/orders/components/OrderFulfillmentTrackingDialog/OrderFulfillmentTrackingDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderFulfillmentTrackingDialog/OrderFulfillmentTrackingDialog.tsx
index 1d3d31f7a9..2e5274372c 100644
--- a/saleor/static/dashboard-next/orders/components/OrderFulfillmentTrackingDialog/OrderFulfillmentTrackingDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderFulfillmentTrackingDialog/OrderFulfillmentTrackingDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
@@ -19,15 +19,7 @@ interface OrderFulfillmentTrackingDialogProps {
const OrderFulfillmentTrackingDialog: React.StatelessComponent<
OrderFulfillmentTrackingDialogProps
-> = ({
- children,
- open,
- variant,
- trackingCode,
- onConfirm,
- onClose,
- onChange
-}) => (
+> = ({ open, variant, trackingCode, onConfirm, onClose, onChange }) => (
<Dialog open={open}>
<DialogTitle>
{variant === "edit"
diff --git a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
index 93c27aa324..9b7fbdda4b 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPaymentDialog/OrderPaymentDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
@@ -18,7 +18,6 @@ interface OrderPaymentDialogProps {
}
const OrderPaymentDialog: React.StatelessComponent<OrderPaymentDialogProps> = ({
- children,
open,
variant,
onConfirm,
diff --git a/saleor/static/dashboard-next/orders/components/OrderPaymentReleaseDialog/OrderPaymentReleaseDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderPaymentReleaseDialog/OrderPaymentReleaseDialog.tsx
index 869b7b9d7a..32b800650f 100644
--- a/saleor/static/dashboard-next/orders/components/OrderPaymentReleaseDialog/OrderPaymentReleaseDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderPaymentReleaseDialog/OrderPaymentReleaseDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
@@ -16,7 +16,7 @@ interface OrderPaymentReleaseDialogProps {
const OrderPaymentReleaseDialog: React.StatelessComponent<
OrderPaymentReleaseDialogProps
-> = ({ children, open, onConfirm, onClose }) => (
+> = ({ open, onConfirm, onClose }) => (
<Dialog open={open}>
<DialogTitle>{i18n.t("Release payment", { context: "title" })}</DialogTitle>
<DialogContent>
diff --git a/saleor/static/dashboard-next/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx b/saleor/static/dashboard-next/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx
index b24fdeaec8..11721ab973 100644
--- a/saleor/static/dashboard-next/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button";
-import Dialog, { DialogProps } from "@material-ui/core/Dialog";
+import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions";
import DialogContent from "@material-ui/core/DialogContent";
import DialogTitle from "@material-ui/core/DialogTitle";
diff --git a/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx b/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx
index 6b49f9925f..14ec933926 100644
--- a/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderSummary/OrderSummary.tsx
@@ -1,10 +1,6 @@
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import CardActions from "@material-ui/core/CardActions";
-import CardContent from "@material-ui/core/CardContent";
-import IconButton from "@material-ui/core/IconButton";
-import { withStyles } from "@material-ui/core/styles";
-import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
import {
@@ -14,7 +10,6 @@ import {
transformOrderStatus
} from "../..";
import CardTitle from "../../../components/CardTitle";
-import PageHeader from "../../../components/PageHeader";
import StatusLabel from "../../../components/StatusLabel/StatusLabel";
import i18n from "../../../i18n";
import OrderProducts, {
@@ -45,138 +40,119 @@ interface OrderSummaryProps extends OrderProductsProps {
onShippingMethodClick?();
}
-const decorate = withStyles(
- theme => ({
- hr: {
- backgroundColor: theme.palette.grey[200],
- border: "none",
- display: "block",
- height: 1,
- width: "100%"
- },
- root: {},
- statusBar: {
- paddingTop: 0
- }
- }),
- { name: "OrderSummary" }
-);
-const OrderSummary = decorate<OrderSummaryProps>(
- ({
- classes,
- net,
- paid,
- paymentStatus,
- paymentVariant,
- products,
- refunded,
- shippingMethod,
- status,
- subtotal,
- total,
- onCapture,
- onCreate,
- onFulfill,
- onOrderCancel,
- onOrderLineChange,
- onOrderLineRemove,
- onProductAdd,
- onRefund,
- onRelease,
- onRowClick,
- onShippingMethodClick
- }) => {
- const orderStatus = status ? transformOrderStatus(status) : undefined;
- const canCapture =
- paymentStatus && status
- ? paymentStatus === PaymentStatus.PREAUTH &&
- !([OrderStatus.DRAFT, OrderStatus.CANCELLED] as any).includes(status)
- : false;
- const canRelease =
- paymentStatus && status ? paymentStatus === PaymentStatus.PREAUTH : false;
- const canRefund =
- paymentStatus && status
- ? paymentStatus === PaymentStatus.CONFIRMED &&
- paymentVariant !== PaymentVariants.MANUAL
- : false;
- const canFulfill = ([
- OrderStatus.UNFULFILLED,
- OrderStatus.PARTIALLY_FULFILLED
- ] as any).includes(status);
- const canCancel = status !== OrderStatus.CANCELLED;
- const canGetInvoice = paymentStatus === PaymentStatus.CONFIRMED;
- const isDraft = status === OrderStatus.DRAFT;
- return (
- <Card>
- <CardTitle
- title={i18n.t("Order Summary")}
- toolbar={
- isDraft && (
- <Button color="secondary" variant="flat" onClick={onProductAdd}>
- {i18n.t("Add product")}
- </Button>
- )
- }
- >
- {status && (
- <StatusLabel
- status={orderStatus.status}
- label={orderStatus.localized}
- typographyProps={{ variant: "body1" }}
- />
- )}
- </CardTitle>
- <OrderProducts
- isDraft={isDraft}
- net={net}
- paid={paid}
- products={products}
- refunded={refunded}
- shippingMethod={shippingMethod}
- subtotal={subtotal}
- total={total}
- onOrderLineChange={onOrderLineChange}
- onOrderLineRemove={onOrderLineRemove}
- onRowClick={onRowClick}
- onShippingMethodClick={onShippingMethodClick}
- />
- {status &&
- (canGetInvoice ||
- canFulfill ||
- canCapture ||
- canRefund ||
- canRelease ||
- canCancel ||
- isDraft) && (
- <CardActions>
- {isDraft ? (
- <Button onClick={onCreate}>{i18n.t("Finalize")}</Button>
- ) : (
- <>
- {canGetInvoice && <Button>{i18n.t("Invoice")}</Button>}
- {canFulfill && (
- <Button onClick={onFulfill}>{i18n.t("Fulfill")}</Button>
- )}
- {canCapture && (
- <Button onClick={onCapture}>{i18n.t("Capture")}</Button>
- )}
- {canRefund && (
- <Button onClick={onRefund}>{i18n.t("Refund")}</Button>
- )}
- {canRelease && (
- <Button onClick={onRelease}>{i18n.t("Release")}</Button>
- )}
- {canCancel && (
- <Button onClick={onOrderCancel}>
- {i18n.t("Cancel order")}
- </Button>
- )}
- </>
- )}
- </CardActions>
- )}
- </Card>
- );
- }
-);
+const OrderSummary: React.StatelessComponent<OrderSummaryProps> = ({
+ net,
+ paid,
+ paymentStatus,
+ paymentVariant,
+ products,
+ refunded,
+ shippingMethod,
+ status,
+ subtotal,
+ total,
+ onCapture,
+ onCreate,
+ onFulfill,
+ onOrderCancel,
+ onOrderLineChange,
+ onOrderLineRemove,
+ onProductAdd,
+ onRefund,
+ onRelease,
+ onRowClick,
+ onShippingMethodClick
+}) => {
+ const orderStatus = status ? transformOrderStatus(status) : undefined;
+ const canCapture =
+ paymentStatus && status
+ ? paymentStatus === PaymentStatus.PREAUTH &&
+ !([OrderStatus.DRAFT, OrderStatus.CANCELLED] as any).includes(status)
+ : false;
+ const canRelease =
+ paymentStatus && status ? paymentStatus === PaymentStatus.PREAUTH : false;
+ const canRefund =
+ paymentStatus && status
+ ? paymentStatus === PaymentStatus.CONFIRMED &&
+ paymentVariant !== PaymentVariants.MANUAL
+ : false;
+ const canFulfill = ([
+ OrderStatus.UNFULFILLED,
+ OrderStatus.PARTIALLY_FULFILLED
+ ] as any).includes(status);
+ const canCancel = status !== OrderStatus.CANCELLED;
+ const canGetInvoice = paymentStatus === PaymentStatus.CONFIRMED;
+ const isDraft = status === OrderStatus.DRAFT;
+ return (
+ <Card>
+ <CardTitle
+ title={i18n.t("Order Summary")}
+ toolbar={
+ isDraft && (
+ <Button color="secondary" variant="flat" onClick={onProductAdd}>
+ {i18n.t("Add product")}
+ </Button>
+ )
+ }
+ >
+ {status && (
+ <StatusLabel
+ status={orderStatus.status}
+ label={orderStatus.localized}
+ typographyProps={{ variant: "body1" }}
+ />
+ )}
+ </CardTitle>
+ <OrderProducts
+ isDraft={isDraft}
+ net={net}
+ paid={paid}
+ products={products}
+ refunded={refunded}
+ shippingMethod={shippingMethod}
+ subtotal={subtotal}
+ total={total}
+ onOrderLineChange={onOrderLineChange}
+ onOrderLineRemove={onOrderLineRemove}
+ onRowClick={onRowClick}
+ onShippingMethodClick={onShippingMethodClick}
+ />
+ {status &&
+ (canGetInvoice ||
+ canFulfill ||
+ canCapture ||
+ canRefund ||
+ canRelease ||
+ canCancel ||
+ isDraft) && (
+ <CardActions>
+ {isDraft ? (
+ <Button onClick={onCreate}>{i18n.t("Finalize")}</Button>
+ ) : (
+ <>
+ {canGetInvoice && <Button>{i18n.t("Invoice")}</Button>}
+ {canFulfill && (
+ <Button onClick={onFulfill}>{i18n.t("Fulfill")}</Button>
+ )}
+ {canCapture && (
+ <Button onClick={onCapture}>{i18n.t("Capture")}</Button>
+ )}
+ {canRefund && (
+ <Button onClick={onRefund}>{i18n.t("Refund")}</Button>
+ )}
+ {canRelease && (
+ <Button onClick={onRelease}>{i18n.t("Release")}</Button>
+ )}
+ {canCancel && (
+ <Button onClick={onOrderCancel}>
+ {i18n.t("Cancel order")}
+ </Button>
+ )}
+ </>
+ )}
+ </CardActions>
+ )}
+ </Card>
+ );
+};
export default OrderSummary;
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
index 5f1e8adca1..39422a0cec 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
@@ -1,7 +1,5 @@
import DialogContentText from "@material-ui/core/DialogContentText";
-import IconButton from "@material-ui/core/IconButton";
import { withStyles } from "@material-ui/core/styles";
-import DeleteIcon from "@material-ui/icons/Delete";
import * as React from "react";
import ActionDialog from "../../../components/ActionDialog";
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderSummary.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderSummary.tsx
index fb068ee36e..02dbcb1df3 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderSummary.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderSummary.tsx
@@ -3,11 +3,7 @@ import * as React from "react";
import * as placeholderImage from "../../../../images/placeholder60x60.png";
import OrderSummary from "../../../orders/components/OrderSummary";
-import {
- countries,
- order as orderFixture,
- prefixes
-} from "../../../orders/fixtures";
+import { order as orderFixture } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
const order = orderFixture(placeholderImage);
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherUsability/VoucherUsability.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherUsability/VoucherUsability.tsx
index 8ebc462f2c..671d05e3d5 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherUsability/VoucherUsability.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherUsability/VoucherUsability.tsx
@@ -1,6 +1,5 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
-import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import * as React from "react";