2023-06-21 09:28:00 +00:00
|
|
|
// @ts-strict-ignore
|
2019-09-12 13:31:08 +00:00
|
|
|
import {
|
2020-05-14 09:30:32 +00:00
|
|
|
filterPageProps,
|
2019-09-12 13:31:08 +00:00
|
|
|
listActionsProps,
|
|
|
|
pageListProps,
|
|
|
|
searchPageProps,
|
2020-01-02 12:22:12 +00:00
|
|
|
sortPageProps,
|
2022-06-21 09:36:55 +00:00
|
|
|
tabPageProps,
|
2023-01-16 09:45:12 +00:00
|
|
|
} from "@dashboard/fixtures";
|
2023-05-22 09:09:36 +00:00
|
|
|
import { Meta, StoryObj } from "@storybook/react";
|
2023-01-05 12:34:34 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2023-05-12 11:06:27 +00:00
|
|
|
import { PaginatorContextDecorator } from "../../../../.storybook/decorators";
|
|
|
|
import { MockedUserProvider } from "../../../../.storybook/helpers";
|
2023-01-05 12:34:34 +00:00
|
|
|
import { customerList } from "../../fixtures";
|
|
|
|
import { CustomerListUrlSortField } from "../../urls";
|
|
|
|
import CustomerListPageComponent, {
|
|
|
|
CustomerListPageProps,
|
|
|
|
} from "./CustomerListPage";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
const props: CustomerListPageProps = {
|
2020-01-02 12:22:12 +00:00
|
|
|
...filterPageProps,
|
2019-06-19 14:40:52 +00:00
|
|
|
...listActionsProps,
|
|
|
|
...pageListProps.default,
|
2019-09-12 13:31:08 +00:00
|
|
|
...searchPageProps,
|
2019-12-17 17:13:56 +00:00
|
|
|
...sortPageProps,
|
2019-09-12 13:31:08 +00:00
|
|
|
...tabPageProps,
|
2019-12-17 17:13:56 +00:00
|
|
|
customers: customerList,
|
2022-10-26 11:19:20 +00:00
|
|
|
selectedCustomerIds: ["123"],
|
2020-01-02 12:22:12 +00:00
|
|
|
filterOpts: {
|
|
|
|
joined: {
|
|
|
|
active: false,
|
|
|
|
value: {
|
|
|
|
max: undefined,
|
2022-06-21 09:36:55 +00:00
|
|
|
min: undefined,
|
|
|
|
},
|
2020-01-02 12:22:12 +00:00
|
|
|
},
|
|
|
|
numberOfOrders: {
|
|
|
|
active: false,
|
|
|
|
value: {
|
|
|
|
max: undefined,
|
2022-06-21 09:36:55 +00:00
|
|
|
min: undefined,
|
|
|
|
},
|
|
|
|
},
|
2020-01-02 12:22:12 +00:00
|
|
|
},
|
2019-12-17 17:13:56 +00:00
|
|
|
sort: {
|
|
|
|
...sortPageProps.sort,
|
2022-06-21 09:36:55 +00:00
|
|
|
sort: CustomerListUrlSortField.name,
|
|
|
|
},
|
2019-06-19 14:40:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-01 08:38:23 +00:00
|
|
|
const CustomerListPage = props => (
|
|
|
|
<MockedUserProvider>
|
|
|
|
<CustomerListPageComponent {...props} />
|
|
|
|
</MockedUserProvider>
|
|
|
|
);
|
|
|
|
|
2023-05-22 09:09:36 +00:00
|
|
|
const meta: Meta<typeof CustomerListPage> = {
|
2023-05-12 11:06:27 +00:00
|
|
|
title: "Customers / Customer list",
|
|
|
|
decorators: [PaginatorContextDecorator],
|
2023-05-22 09:09:36 +00:00
|
|
|
component: CustomerListPage,
|
2023-05-12 11:06:27 +00:00
|
|
|
};
|
2023-05-22 09:09:36 +00:00
|
|
|
export default meta;
|
|
|
|
type Story = StoryObj<typeof CustomerListPage>;
|
2023-05-12 11:06:27 +00:00
|
|
|
|
2023-05-22 09:09:36 +00:00
|
|
|
export const Default: Story = {
|
|
|
|
args: {
|
|
|
|
...props,
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
chromatic: { diffThreshold: 0.85 },
|
|
|
|
},
|
|
|
|
};
|
2023-05-12 11:06:27 +00:00
|
|
|
|
2023-05-22 09:09:36 +00:00
|
|
|
export const Loading: Story = {
|
|
|
|
args: {
|
|
|
|
...props,
|
|
|
|
customers: undefined,
|
|
|
|
disabled: true,
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
chromatic: { diffThreshold: 0.85 },
|
|
|
|
},
|
|
|
|
};
|
2023-05-12 11:06:27 +00:00
|
|
|
|
2023-05-22 09:09:36 +00:00
|
|
|
export const NoData: Story = {
|
|
|
|
args: {
|
|
|
|
...props,
|
|
|
|
customers: [],
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
chromatic: { diffThreshold: 0.85 },
|
|
|
|
},
|
|
|
|
};
|