import { makeStyles } from "@material-ui/core/styles"; 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, useIntl } from "react-intl"; import Checkbox from "@saleor/components/Checkbox"; import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; import StatusLabel from "@saleor/components/StatusLabel"; import TableHead from "@saleor/components/TableHead"; import TablePagination from "@saleor/components/TablePagination"; import { maybe, renderCollection } from "@saleor/misc"; import { ListActions, ListProps, SortPage } from "@saleor/types"; import { CollectionListUrlSortField } from "@saleor/collections/urls"; import TableCellHeader from "@saleor/components/TableCellHeader"; import { getArrowDirection } from "@saleor/utils/sort"; import { CollectionList_collections_edges_node } from "../../types/CollectionList"; const useStyles = makeStyles( theme => ({ [theme.breakpoints.up("lg")]: { colAvailability: { width: 240 }, colName: { paddingLeft: 0 }, colProducts: { width: 240 } }, colAvailability: {}, colName: {}, colProducts: { textAlign: "center" }, tableRow: { cursor: "pointer" as "pointer" } }), { name: "CollectionList" } ); interface CollectionListProps extends ListProps, ListActions, SortPage { collections: CollectionList_collections_edges_node[]; } const numberOfColumns = 5; const CollectionList: React.FC = props => { const { collections, disabled, settings, sort, onNextPage, onPreviousPage, onUpdateListSettings, onRowClick, onSort, pageInfo, isChecked, selected, toggle, toggleAll, toolbar } = props; const classes = useStyles(props); const intl = useIntl(); return ( onSort(CollectionListUrlSortField.name)} className={classes.colName} > onSort(CollectionListUrlSortField.productCount)} className={classes.colProducts} > onSort(CollectionListUrlSortField.available)} className={classes.colAvailability} > {renderCollection( collections, collection => { const isSelected = collection ? isChecked(collection.id) : false; return ( collection.id)} > toggle(collection.id)} /> {maybe(() => collection.name, )} {maybe( () => collection.products.totalCount, )} collection.isPublished)} > {maybe( () => ( ), )} ); }, () => ( ) )} ); }; CollectionList.displayName = "CollectionList"; export default CollectionList;