Skip to content

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

Remove no longer needed files

dominik-zeglen86540cb40f29
diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx b/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx
deleted file mode 100644
index 83050223e4..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerAddress/CustomerAddress.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import Button from "@material-ui/core/Button";
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import { withStyles } from "@material-ui/core/styles";
-import Typography from "@material-ui/core/Typography";
-import * as React from "react";
-
-import { AddressType } from "../../";
-import AddressFormatter from "../../../components/AddressFormatter";
-import CardTitle from "../../../components/CardTitle";
-import i18n from "../../../i18n";
-
-interface CustomerAddressProps {
- billingAddress: AddressType;
- shippingAddress: AddressType;
- onBillingAddressEdit?();
- onShippingAddressEdit?();
-}
-
-const decorate = withStyles(theme => ({
- hr: {
- backgroundColor: theme.palette.grey[200],
- border: "none",
- display: "block",
- height: 1,
- width: "100%"
- }
-}));
-const CustomerAddress = decorate<CustomerAddressProps>(
- ({
- classes,
- billingAddress,
- shippingAddress,
- onBillingAddressEdit,
- onShippingAddressEdit
- }) => (
- <Card>
- <CardTitle
- title={i18n.t("Default billing address")}
- toolbar={
- !!onBillingAddressEdit && (
- <Button
- color="secondary"
- variant="flat"
- onClick={onBillingAddressEdit}
- >
- {i18n.t("Edit address")}
- </Button>
- )
- }
- />
- <CardContent>
- <AddressFormatter address={billingAddress} />
- </CardContent>
- <hr className={classes.hr} />
- <CardTitle
- title={i18n.t("Default shipping address")}
- toolbar={
- !!onShippingAddressEdit && (
- <Button
- color="secondary"
- variant="flat"
- onClick={onShippingAddressEdit}
- >
- {i18n.t("Edit address")}
- </Button>
- )
- }
- />
- <CardContent>
- {billingAddress &&
- shippingAddress &&
- billingAddress.id === shippingAddress.id ? (
- <Typography color="textSecondary">
- {i18n.t("Same as billing address")}
- </Typography>
- ) : (
- <AddressFormatter address={shippingAddress} />
- )}
- </CardContent>
- </Card>
- )
-);
-export default CustomerAddress;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddress/index.ts b/saleor/static/dashboard-next/customers/components/CustomerAddress/index.ts
deleted file mode 100644
index 6dc6dd7dc8..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerAddress/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./CustomerAddress";
-export * from "./CustomerAddress";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx
deleted file mode 100644
index 2e4f0fd3ff..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerDetails/CustomerDetails.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import Button from "@material-ui/core/Button";
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import { withStyles } from "@material-ui/core/styles";
-import Typography from "@material-ui/core/Typography";
-import * as React from "react";
-
-import CardTitle from "../../../components/CardTitle";
-import DateFormatter from "../../../components/DateFormatter";
-import Skeleton from "../../../components/Skeleton";
-import StatusLabel from "../../../components/StatusLabel";
-import i18n from "../../../i18n";
-
-interface CustomerDetailsProps {
- customer?: {
- id: string;
- dateJoined: string;
- email: string;
- isActive: boolean;
- isStaff: boolean;
- note: string;
- };
- onDelete?();
- onEdit?();
-}
-
-const decorate = withStyles(theme => ({
- date: {
- marginBottom: theme.spacing.unit * 2
- },
- header: {
- flex: 1,
- paddingBottom: theme.spacing.unit * 2,
- paddingTop: theme.spacing.unit * 2
- },
- root: {
- marginBottom: theme.spacing.unit * 2,
- [theme.breakpoints.down("md")]: {
- marginBottom: theme.spacing.unit
- }
- },
- status: {
- marginLeft: theme.spacing.unit * 2,
- position: "relative" as "relative",
- top: -2
- },
- title: {
- display: "inline-block" as "inline-block"
- },
- userJoinDate: {
- display: "inline"
- }
-}));
-const CustomerDetails = decorate<CustomerDetailsProps>(
- ({ classes, customer, onDelete, onEdit }) => (
- <Card className={classes.root}>
- <CardTitle
- title={i18n.t("User details")}
- toolbar={
- <>
- <Button
- color="secondary"
- variant="flat"
- disabled={!customer}
- onClick={onEdit}
- >
- {i18n.t("Edit customer")}
- </Button>
- <Button
- color="secondary"
- variant="flat"
- disabled={!customer}
- onClick={onDelete}
- >
- {i18n.t("Remove customer")}
- </Button>
- </>
- }
- >
- {customer ? (
- <Typography component="span">
- <StatusLabel
- className={classes.status}
- status={customer.isActive ? "success" : "error"}
- label={customer.isActive ? i18n.t("Active") : i18n.t("Inactive")}
- />
- </Typography>
- ) : (
- <Skeleton style={{ width: "10rem" }} />
- )}
- </CardTitle>
- <CardContent>
- {customer ? (
- <>
- <div className={classes.date}>
- <Typography
- component="span"
- className={classes.userJoinDate}
- variant="caption"
- >
- {i18n.t("Joined")}
- </Typography>{" "}
- <Typography variant="caption">
- <DateFormatter date={customer.dateJoined} />
- </Typography>
- </div>
- {customer.note ? (
- <Typography>{customer.note}</Typography>
- ) : (
- <Typography color="textSecondary">{i18n.t("No note")}</Typography>
- )}
- </>
- ) : (
- <Skeleton />
- )}
- </CardContent>
- </Card>
- )
-);
-export default CustomerDetails;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetails/index.ts b/saleor/static/dashboard-next/customers/components/CustomerDetails/index.ts
deleted file mode 100644
index 0c9569a115..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerDetails/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./CustomerDetails";
-export * from "./CustomerDetails";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
deleted file mode 100644
index 11546a1847..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import DialogContentText from "@material-ui/core/DialogContentText";
-import { withStyles } from "@material-ui/core/styles";
-import * as React from "react";
-
-import { AddressType } from "../../";
-import ActionDialog from "../../../components/ActionDialog";
-import { Container } from "../../../components/Container";
-import PageHeader from "../../../components/PageHeader";
-import Toggle from "../../../components/Toggle";
-import i18n from "../../../i18n";
-import CustomerAddress from "../CustomerAddress/CustomerAddress";
-import CustomerDetails from "../CustomerDetails/CustomerDetails";
-import CustomerOrders from "../CustomerOrders/CustomerOrders";
-
-interface CustomerDetailsPageProps {
- customer?: {
- id: string;
- dateJoined: string;
- defaultBillingAddress: AddressType;
- defaultShippingAddress: AddressType;
- email: string;
- isActive: boolean;
- isStaff: boolean;
- note: string;
- };
- orders?: Array<{
- id: string;
- number: string;
- created: string;
- orderStatus: {
- localized: string;
- status: string;
- };
- total: {
- gross: {
- amount: number;
- currency: string;
- };
- };
- }>;
- pageInfo?: {
- hasPreviousPage: boolean;
- hasNextPage: boolean;
- };
- onBack?();
- onOrderClick?(id: string): () => void;
- onBillingAddressEdit?();
- onCustomerDelete?();
- onCustomerEdit?();
- onEmailClick?();
- onShippingAddressEdit?();
- onNextPage?();
- onPreviousPage?();
-}
-
-const decorate = withStyles(theme => ({
- root: {
- display: "grid" as "grid",
- gridColumnGap: `${theme.spacing.unit * 2}px`,
- gridTemplateColumns: "2fr 1fr",
- [theme.breakpoints.down("md")]: {
- gridColumnGap: `${theme.spacing.unit}px`
- }
- }
-}));
-const CustomerDetailsPage = decorate<CustomerDetailsPageProps>(
- ({
- classes,
- customer,
- orders,
- pageInfo,
- onBack,
- onOrderClick,
- onCustomerDelete,
- onCustomerEdit,
- onPreviousPage,
- onNextPage
- }) => (
- <Container width="md">
- <PageHeader
- title={customer ? customer.email : undefined}
- onBack={onBack}
- />
- <Toggle>
- {(isDialogOpened, { toggle: toggleDialog }) => (
- <>
- <div className={classes.root}>
- <div>
- <CustomerDetails
- customer={customer}
- onEdit={onCustomerEdit}
- onDelete={toggleDialog}
- />
- <CustomerOrders
- hasNextPage={pageInfo ? pageInfo.hasNextPage : undefined}
- hasPreviousPage={
- pageInfo ? pageInfo.hasPreviousPage : undefined
- }
- orders={orders}
- onNextPage={onNextPage}
- onPreviousPage={onPreviousPage}
- onRowClick={onOrderClick}
- />
- </div>
- <div>
- <CustomerAddress
- billingAddress={
- customer ? customer.defaultBillingAddress : undefined
- }
- shippingAddress={
- customer ? customer.defaultShippingAddress : undefined
- }
- />
- </div>
- </div>
-
- {customer && (
- <ActionDialog
- open={isDialogOpened}
- title={i18n.t("Delete customer")}
- variant="delete"
- onClose={toggleDialog}
- onConfirm={onCustomerDelete}
- >
- <DialogContentText
- dangerouslySetInnerHTML={{
- __html: i18n.t(
- "Are you sure you want to remove <strong>{{ email }}</strong>?",
- { email: customer.email }
- )
- }}
- />
- </ActionDialog>
- )}
- </>
- )}
- </Toggle>
- </Container>
- )
-);
-export default CustomerDetailsPage;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/index.ts b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/index.ts
deleted file mode 100644
index 7625dc8725..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./CustomerDetailsPage";
-export * from "./CustomerDetailsPage";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
deleted file mode 100644
index 09554ec64f..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import Card from "@material-ui/core/Card";
-import CardContent from "@material-ui/core/CardContent";
-import TextField from "@material-ui/core/TextField";
-import * as CRC from "crc-32";
-import * as React from "react";
-
-import { Container } from "../../../components/Container";
-import Form from "../../../components/Form";
-import FormSpacer from "../../../components/FormSpacer";
-import PageHeader from "../../../components/PageHeader";
-import SaveButtonBar, {
- SaveButtonBarState
-} from "../../../components/SaveButtonBar";
-import i18n from "../../../i18n";
-
-interface CustomerEditPageProps {
- customer?: {
- id: string;
- email: string;
- note: string;
- };
- disabled?: boolean;
- errors?: Array<{
- field: string;
- message: string;
- }>;
- variant: "add" | "edit";
- saveButtonBarState?: SaveButtonBarState;
- onBack?();
- onSubmit?();
-}
-
-const CustomerEditPage: React.StatelessComponent<CustomerEditPageProps> = ({
- customer,
- disabled,
- errors,
- onBack,
- onSubmit,
- saveButtonBarState,
- variant
-}) => {
- const errorList: { [key: string]: string } = errors
- ? errors.reduce((acc, curr) => {
- acc[curr.field] = curr.message;
- return acc;
- }, {})
- : {};
- return (
- <Form
- initial={{
- email: customer && customer.email ? customer.email : "",
- note:
- customer && customer.note !== undefined && customer.note !== null
- ? customer.note
- : ""
- }}
- key={customer ? CRC.str(JSON.stringify(customer)) : "loading"}
- >
- {({ change, data, hasChanged }) => (
- <Container width="md">
- <PageHeader
- title={
- variant === "add"
- ? i18n.t("Add customer")
- : i18n.t("Edit customer")
- }
- onBack={onBack}
- />
- <Card>
- <CardContent>
- <TextField
- disabled={disabled}
- error={!!errorList.email}
- fullWidth
- helperText={errorList.email}
- label={i18n.t("E-mail")}
- name="email"
- onChange={change}
- value={data.email}
- />
- <FormSpacer />
- <TextField
- disabled={disabled}
- error={!!errorList.note}
- fullWidth
- helperText={
- errorList.note ? errorList.note : i18n.t("Optional")
- }
- label={i18n.t("Note")}
- name="note"
- onChange={change}
- value={data.note}
- multiline
- rows={10}
- />
- </CardContent>
- </Card>
- <SaveButtonBar
- disabled={disabled || !onSubmit || !hasChanged}
- state={saveButtonBarState}
- onCancel={onBack}
- onSave={onSubmit}
- />
- </Container>
- )}
- </Form>
- );
-};
-export default CustomerEditPage;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerEditPage/index.ts b/saleor/static/dashboard-next/customers/components/CustomerEditPage/index.ts
deleted file mode 100644
index e8dce78555..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerEditPage/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./CustomerEditPage";
-export * from "./CustomerEditPage";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx b/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx
deleted file mode 100644
index 50bbbaf460..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerOrders/CustomerOrders.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import Card from "@material-ui/core/Card";
-import blue from "@material-ui/core/colors/blue";
-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 TableFooter from "@material-ui/core/TableFooter";
-import TableHead from "@material-ui/core/TableHead";
-import TableRow from "@material-ui/core/TableRow";
-import * as React from "react";
-
-import DateFormatter from "../../../components/DateFormatter";
-import Money from "../../../components/Money";
-import Skeleton from "../../../components/Skeleton";
-import StatusLabel from "../../../components/StatusLabel";
-import TablePagination from "../../../components/TablePagination";
-import i18n from "../../../i18n";
-import { renderCollection } from "../../../misc";
-
-interface CustomerOrdersProps {
- orders?: Array<{
- id: string;
- number: string;
- orderStatus: {
- localized: string;
- status: string;
- };
- created: string;
- total: {
- gross: {
- amount: number;
- currency: string;
- };
- };
- }>;
- dateNow?: number;
- hasPreviousPage?: boolean;
- hasNextPage?: boolean;
- onPreviousPage?();
- onNextPage?();
- onRowClick?(id: string);
-}
-
-const decorate = withStyles({
- link: {
- color: blue[500],
- cursor: "pointer",
- textDecoration: "none"
- },
- textRight: {
- textAlign: "right" as "right"
- }
-});
-const CustomerOrders = decorate<CustomerOrdersProps>(
- ({
- classes,
- hasNextPage,
- hasPreviousPage,
- orders,
- onNextPage,
- onPreviousPage,
- onRowClick
- }) => (
- <Card>
- <Table>
- <TableHead>
- <TableRow>
- <TableCell>{i18n.t("#", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Created", { context: "object" })}</TableCell>
- <TableCell>{i18n.t("Status", { context: "object" })}</TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Price", { context: "object" })}
- </TableCell>
- </TableRow>
- </TableHead>
- <TableFooter>
- <TableRow>
- <TablePagination
- colSpan={4}
- hasNextPage={hasNextPage || false}
- onNextPage={onNextPage}
- hasPreviousPage={hasPreviousPage || false}
- onPreviousPage={onPreviousPage}
- />
- </TableRow>
- </TableFooter>
- <TableBody>
- {renderCollection(
- orders,
- order => (
- <TableRow key={order ? order.id : "skeleton"}>
- <TableCell
- onClick={order && onRowClick && onRowClick(order.id)}
- className={classes.link}
- >
- {order ? order.number : <Skeleton />}
- </TableCell>
- <TableCell>
- {order ? (
- <DateFormatter date={order.created} />
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell>
- {order && order.orderStatus ? (
- <StatusLabel
- status={order.orderStatus.status}
- label={order.orderStatus.localized}
- />
- ) : (
- <Skeleton />
- )}
- </TableCell>
- <TableCell className={classes.textRight}>
- {order && order.total && order.total.gross ? (
- <Money
- amount={order.total.gross.amount}
- currency={order.total.gross.currency}
- />
- ) : (
- <Skeleton />
- )}
- </TableCell>
- </TableRow>
- ),
- () => (
- <TableRow>
- <TableCell colSpan={4}>{i18n.t("No orders found")}</TableCell>
- </TableRow>
- )
- )}
- </TableBody>
- </Table>
- </Card>
- )
-);
-export default CustomerOrders;
diff --git a/saleor/static/dashboard-next/customers/components/CustomerOrders/index.ts b/saleor/static/dashboard-next/customers/components/CustomerOrders/index.ts
deleted file mode 100644
index 8a3fbc5332..0000000000
--- a/saleor/static/dashboard-next/customers/components/CustomerOrders/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default } from "./CustomerOrders";
-export * from "./CustomerOrders";
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerAddress.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerAddress.tsx
deleted file mode 100644
index e5e1e942e3..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerAddress.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import CustomerAddress from "../../../customers/components/CustomerAddress";
-import Decorator from "../../Decorator";
-
-storiesOf("Customers / CustomerAddress", module)
- .addDecorator(Decorator)
- .add("default", () => <CustomerAddress />)
- .add("other", () => <CustomerAddress />);
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetails.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetails.tsx
deleted file mode 100644
index 67c88c382a..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetails.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import CustomerDetails from "../../../customers/components/CustomerDetails";
-import Decorator from "../../Decorator";
-
-storiesOf("Customers / CustomerDetails", module)
- .addDecorator(Decorator)
- .add("default", () => <CustomerDetails />)
- .add("other", () => <CustomerDetails />);
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
deleted file mode 100644
index c8f54e3dec..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import CustomerDetailsPage from "../../../customers/components/CustomerDetailsPage";
-import { customer } from "../../../customers/fixtures";
-import { flatOrders } from "../../../orders/fixtures";
-import Decorator from "../../Decorator";
-
-const callbacks = {
- onBack: undefined,
- onBillingAddressEdit: undefined,
- onCustomerDelete: undefined,
- onCustomerEdit: undefined,
- onEmailClick: undefined,
- onOrderClick: () => undefined,
- onShippingAddressEdit: undefined
-};
-
-storiesOf("Views / Customers / Customer details", module)
- .addDecorator(Decorator)
- .add("default", () => (
- <CustomerDetailsPage
- customer={customer}
- orders={flatOrders}
- {...callbacks}
- />
- ))
- .add("when loading", () => <CustomerDetailsPage {...callbacks} />);
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerEditPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerEditPage.tsx
deleted file mode 100644
index 3fdac6a13c..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerEditPage.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import CustomerEditPage from "../../../customers/components/CustomerEditPage";
-import { customer } from "../../../customers/fixtures";
-import Decorator from "../../Decorator";
-
-const errors = [
- { field: "email", message: "This field cannot be empty" },
- { field: "note", message: "this field cannot be empty" }
-];
-const callbacks = {
- onBack: undefined,
- onSubmit: () => undefined
-};
-
-storiesOf("Views / Customers / Edit customer", module)
- .addDecorator(Decorator)
- .add("default", () => (
- <CustomerEditPage customer={customer} variant="edit" {...callbacks} />
- ))
- .add("with errors", () => (
- <CustomerEditPage
- customer={customer}
- variant="edit"
- errors={errors}
- {...callbacks}
- />
- ))
- .add("when adding new customer", () => (
- <CustomerEditPage variant="add" {...callbacks} />
- ))
- .add("when loading", () => (
- <CustomerEditPage disabled={true} variant="edit" {...callbacks} />
- ));
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerOrders.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerOrders.tsx
deleted file mode 100644
index 4ea4c9a903..0000000000
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerOrders.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { storiesOf } from "@storybook/react";
-import * as React from "react";
-
-import CustomerOrders from "../../../customers/components/CustomerOrders";
-import Decorator from "../../Decorator";
-
-storiesOf("Customers / CustomerOrders", module)
- .addDecorator(Decorator)
- .add("default", () => <CustomerOrders />)
- .add("other", () => <CustomerOrders />);