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 Date from "@saleor/components/Date"; import Money from "@saleor/components/Money"; import Percent from "@saleor/components/Percent"; import Skeleton from "@saleor/components/Skeleton"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import { maybe, renderCollection } from "@saleor/misc"; import { ListActions, ListProps } from "@saleor/types"; import { SaleType } from "@saleor/types/globalTypes"; import { SaleList_sales_edges_node } from "../../types/SaleList"; export interface SaleListProps extends ListProps, ListActions { defaultCurrency: string; sales: SaleList_sales_edges_node[]; } const styles = (theme: Theme) => createStyles({ [theme.breakpoints.up("lg")]: { colEnd: { width: 250 }, colName: {}, colStart: { width: 250 }, colValue: { width: 200 } }, colEnd: { textAlign: "right" }, colName: { paddingLeft: 0 }, colStart: { textAlign: "right" }, colValue: { textAlign: "right" }, tableRow: { cursor: "pointer" } }); const numberOfColumns = 5; const SaleList = withStyles(styles, { name: "SaleList" })( ({ classes, settings, defaultCurrency, disabled, onNextPage, onPreviousPage, onUpdateListSettings, onRowClick, pageInfo, sales, isChecked, selected, toggle, toggleAll, toolbar }: SaleListProps & WithStyles) => ( {renderCollection( sales, sale => { const isSelected = sale ? isChecked(sale.id) : false; return ( toggle(sale.id)} /> {maybe(() => sale.name, )} {sale && sale.startDate ? ( ) : ( )} {sale && sale.endDate ? ( ) : sale && sale.endDate === null ? ( "-" ) : ( )} {sale && sale.type && sale.value ? ( sale.type === SaleType.FIXED ? ( ) : ( ) ) : ( )} ); }, () => ( ) )}
) ); SaleList.displayName = "SaleList"; export default SaleList;