Skip to content

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

Update stories

dominik-zeglen6c7534512fdf
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftDetails/OrderDraftDetails.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftDetails/OrderDraftDetails.tsx
index ad2a027def..9e1690d3dc 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftDetails/OrderDraftDetails.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftDetails/OrderDraftDetails.tsx
@@ -19,6 +19,7 @@ interface OrderDraftDetailsProps {
id: string,
data: OrderDraftDetailsProductsFormData
) => void;
+ onOrderLineRemove: (id: string) => void;
onShippingMethodEdit: () => void;
}
@@ -26,6 +27,7 @@ const OrderDraftDetails: React.StatelessComponent<OrderDraftDetailsProps> = ({
order,
onOrderLineAdd,
onOrderLineChange,
+ onOrderLineRemove,
onShippingMethodEdit
}) => (
<Card>
@@ -44,6 +46,7 @@ const OrderDraftDetails: React.StatelessComponent<OrderDraftDetailsProps> = ({
<OrderDraftDetailsProducts
lines={maybe(() => order.lines)}
onOrderLineChange={onOrderLineChange}
+ onOrderLineRemove={onOrderLineRemove}
/>
{maybe(() => order.lines.length) !== 0 && (
<CardContent>
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftDetailsProducts/OrderDraftDetailsProducts.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftDetailsProducts/OrderDraftDetailsProducts.tsx
index db9f917b71..959c08c688 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftDetailsProducts/OrderDraftDetailsProducts.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftDetailsProducts/OrderDraftDetailsProducts.tsx
@@ -26,6 +26,7 @@ export interface FormData {
interface OrderDraftDetailsProductsProps {
lines: OrderDetails_order_lines[];
onOrderLineChange: (id: string, data: FormData) => void;
+ onOrderLineRemove: (id: string) => void;
}
const decorate = withStyles(theme => ({
@@ -46,7 +47,7 @@ const decorate = withStyles(theme => ({
}
}));
const OrderDraftDetailsProducts = decorate<OrderDraftDetailsProductsProps>(
- ({ classes, lines, onOrderLineChange }) => (
+ ({ classes, lines, onOrderLineChange, onOrderLineRemove }) => (
<Table>
{maybe(() => !!lines.length) && (
<TableHead>
@@ -138,7 +139,7 @@ const OrderDraftDetailsProducts = decorate<OrderDraftDetailsProductsProps>(
)}
</TableCell>
<TableCell className={classes.iconCell}>
- <IconButton>
+ <IconButton onClick={() => onOrderLineRemove(line.id)}>
<DeleteIcon color="secondary" />
</IconButton>
</TableCell>
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
index 597478d81b..fdc49bed10 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
@@ -151,6 +151,7 @@ class OrderDraftPageComponent extends React.Component<
onNoteAdd,
onOrderLineAdd,
onOrderLineChange,
+ onOrderLineRemove,
onShippingAddressEdit,
onShippingMethodEdit
} = this.props;
@@ -194,6 +195,7 @@ class OrderDraftPageComponent extends React.Component<
order={order}
onOrderLineAdd={this.toggleOrderLineAddDialog}
onOrderLineChange={onOrderLineChange}
+ onOrderLineRemove={onOrderLineRemove}
onShippingMethodEdit={this.toggleShippingMethodEditDialog}
/>
<OrderProductAddDialog
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
index 63d8a349e6..f2e81a5674 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftPage.tsx
@@ -9,7 +9,6 @@ import {
clients,
countries,
draftOrder,
- shippingMethods,
variants
} from "../../../orders/fixtures";
import Decorator from "../../Decorator";
@@ -35,7 +34,6 @@ const props: OrderDraftPageProps = {
onShippingAddressEdit: undefined,
onShippingMethodEdit: undefined,
order,
- shippingMethods,
users: clients,
usersLoading: false,
variants,
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderPaymentDialog.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderPaymentDialog.tsx
index af281f05a6..1162b414cf 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderPaymentDialog.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderPaymentDialog.tsx
@@ -8,6 +8,7 @@ storiesOf("Orders / OrderPaymentDialog", module)
.addDecorator(Decorator)
.add("capture payment", () => (
<OrderPaymentDialog
+ initial={0}
variant="capture"
open={true}
onClose={undefined}
@@ -16,6 +17,7 @@ storiesOf("Orders / OrderPaymentDialog", module)
))
.add("refund payment", () => (
<OrderPaymentDialog
+ initial={0}
variant="refund"
open={true}
onClose={undefined}
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderShippingMethodEditDialog.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderShippingMethodEditDialog.tsx
index 1932e765b5..d986d268e4 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderShippingMethodEditDialog.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderShippingMethodEditDialog.tsx
@@ -2,11 +2,11 @@ import { storiesOf } from "@storybook/react";
import * as React from "react";
import OrderShippingMethodEditDialog from "../../../orders/components/OrderShippingMethodEditDialog";
-import {
- shippingMethods
-} from "../../../orders/fixtures";
+import { order as orderFixture } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
+const order = orderFixture("");
+
storiesOf("Orders / OrderShippingMethodEditDialog", module)
.addDecorator(Decorator)
.add("default", () => (
@@ -15,6 +15,6 @@ storiesOf("Orders / OrderShippingMethodEditDialog", module)
onSubmit={undefined}
open={true}
shippingMethod={null}
- shippingMethods={shippingMethods}
+ shippingMethods={order.availableShippingMethods}
/>
));