import Card from "@material-ui/core/Card"; import { createStyles, Theme, withStyles, 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 TableRow from "@material-ui/core/TableRow"; import React from "react"; import { FormattedMessage } from "react-intl"; import Checkbox from "@saleor/components/Checkbox"; import Skeleton from "@saleor/components/Skeleton"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import { getUserName, maybe, renderCollection } from "@saleor/misc"; import { ListActions, ListProps } from "@saleor/types"; import { ListCustomers_customers_edges_node } from "../../types/ListCustomers"; const styles = (theme: Theme) => createStyles({ [theme.breakpoints.up("lg")]: { colEmail: {}, colName: {}, colOrders: { width: 200 } }, colEmail: {}, colName: { paddingLeft: 0 }, colOrders: { textAlign: "center" }, tableRow: { cursor: "pointer" } }); export interface CustomerListProps extends ListProps, ListActions, WithStyles { customers: ListCustomers_customers_edges_node[]; } const numberOfColumns = 4; const CustomerList = withStyles(styles, { name: "CustomerList" })( ({ classes, settings, disabled, customers, pageInfo, onNextPage, onPreviousPage, onUpdateListSettings, onRowClick, toolbar, toggle, toggleAll, selected, isChecked }: CustomerListProps) => ( {renderCollection( customers, customer => { const isSelected = customer ? isChecked(customer.id) : false; return ( toggle(customer.id)} /> {getUserName(customer)} {maybe(() => customer.email, )} {maybe( () => customer.orders.totalCount, )} ); }, () => ( ) )}
) ); CustomerList.displayName = "CustomerList"; export default CustomerList;