
* Clean up stories * Add missing props * Add zip codes section (#861) * Add zip code listing * Add list wrapping * Update snapshots * Set up API data * Fix lgtm warning * Update snapshots * Run Actions on all PR * Checks on PR * Test envs on PR * Cleanup action on PR * Update messages Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> * Allow zip codes to be assigned to shipping method * Add zip code deletion (#871) * Add zip code range dialog * Fix path management * Use query params to handle modal actions * Allow zip codes to be assigned to shipping method * Make params optional * Fix types * Clean up urls * Add zip code range delete action * Update snapshots and messages * Update schema * Refresh zip code list after assigning them * Update types and snapshots * Update snapshots * Fix error message, checkbox default value (#880) * Fix error message, checkbox default value * Update snapshots * Update schema and types * Update stories * add excluded products section in shipping methods views * create UnassignDialog component * use priceRangeFragment in shipping queries * remove unneeded price from ShippingMethodAddProductsDialog * update messages in ShippingMethodProducts * updates after rebase * update snapshots, fix lint errors * fix ShippingMethodProductsAddDialog * update snapshots * small fix in ShippingMethodProducts * update snapshots after rebase * add handleClose func in ShippingMethodProductsAddDialog * Fix metadata not showing in category update * update snapshots again * update ShippingMethodProductsAddDialog * updates after rebase * update Price and Weight rates views Co-authored-by: dominik-zeglen <flesz3@o2.pl> Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> Co-authored-by: Tomasz Szymański <lime129@gmail.com> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
95 lines
2.3 KiB
TypeScript
95 lines
2.3 KiB
TypeScript
import { shippingZone } from "@saleor/shipping/fixtures";
|
|
import Decorator from "@saleor/storybook//Decorator";
|
|
import { ShippingMethodTypeEnum } from "@saleor/types/globalTypes";
|
|
import { storiesOf } from "@storybook/react";
|
|
import React from "react";
|
|
|
|
import ShippingZoneRatesPage, {
|
|
ShippingZoneRatesPageProps
|
|
} from "./ShippingZoneRatesPage";
|
|
|
|
const channels = [
|
|
{
|
|
currency: "USD",
|
|
id: "1",
|
|
maxValue: "10",
|
|
minValue: "0",
|
|
name: "channel",
|
|
price: "5"
|
|
},
|
|
{
|
|
currency: "USD",
|
|
id: "2",
|
|
maxValue: "20",
|
|
minValue: "1",
|
|
name: "test",
|
|
price: "6"
|
|
}
|
|
];
|
|
|
|
const defaultChannels = [
|
|
{
|
|
currency: "USD",
|
|
id: "1",
|
|
maxValue: "",
|
|
minValue: "",
|
|
name: "channel",
|
|
price: ""
|
|
}
|
|
];
|
|
|
|
const props: ShippingZoneRatesPageProps = {
|
|
allChannelsCount: 3,
|
|
channelErrors: [],
|
|
disabled: false,
|
|
errors: [],
|
|
isChecked: () => undefined,
|
|
onBack: () => undefined,
|
|
onChannelsChange: () => undefined,
|
|
onDelete: () => undefined,
|
|
onNextPage: () => undefined,
|
|
onPreviousPage: () => undefined,
|
|
onProductAssign: () => undefined,
|
|
onProductUnassign: () => undefined,
|
|
onSubmit: () => undefined,
|
|
onZipCodeAssign: () => undefined,
|
|
onZipCodeUnassign: () => undefined,
|
|
openChannelsModal: () => undefined,
|
|
rate: shippingZone.shippingMethods[0],
|
|
saveButtonBarState: "default",
|
|
selected: 0,
|
|
shippingChannels: defaultChannels,
|
|
toggle: () => undefined,
|
|
toggleAll: () => undefined,
|
|
toolbar: () => undefined,
|
|
variant: ShippingMethodTypeEnum.PRICE
|
|
};
|
|
|
|
storiesOf("Views / Shipping / Shipping rate", module)
|
|
.addDecorator(Decorator)
|
|
.add("create price rate", () => <ShippingZoneRatesPage {...props} />)
|
|
.add("create weight rate", () => (
|
|
<ShippingZoneRatesPage {...props} variant={ShippingMethodTypeEnum.WEIGHT} />
|
|
))
|
|
.add("loading", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
disabled={true}
|
|
rate={undefined}
|
|
saveButtonBarState={"loading"}
|
|
/>
|
|
))
|
|
.add("update price rate", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
shippingChannels={channels}
|
|
rate={shippingZone.shippingMethods[2]}
|
|
/>
|
|
))
|
|
.add("update weight rate", () => (
|
|
<ShippingZoneRatesPage
|
|
{...props}
|
|
shippingChannels={channels}
|
|
variant={ShippingMethodTypeEnum.WEIGHT}
|
|
/>
|
|
));
|