Skip to content

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

Fix types and review comments

Krzysztof Bialoglowicz1788f57ab87e
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index 92942c3b27..013d217508 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -44,7 +44,7 @@ const styles = (theme: Theme) =>
colSubcategories: {
textAlign: "center"
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -98,29 +98,24 @@ const CategoryList = withStyles(styles, { name: "CategoryList" })(
}
/>
)}
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={categories}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Category Name", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colSubcategories}>
- {i18n.t("Subcategories", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colProducts}>
- {i18n
- .t("No. Products", { context: "object" })
- .replace(" ", "\xa0")}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Category Name", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colSubcategories}>
+ {i18n.t("Subcategories", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colProducts}>
+ {i18n.t("No. Products", { context: "object" }).replace(" ", "\xa0")}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
index 696ddd8313..ad661d520c 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
@@ -38,7 +38,7 @@ const styles = (theme: Theme) =>
colProducts: {
textAlign: "center"
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -69,29 +69,26 @@ const CollectionList = withStyles(styles, { name: "CollectionList" })(
toolbar
}: CollectionListProps) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={collections}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Category Name", { context: "table cell" })}
- </TableCell>
- <TableCell className={classes.colProducts}>
- {i18n
- .t("No. Products", { context: "table cell" })
- .replace(" ", "\xa0")}
- </TableCell>
- <TableCell className={classes.colAvailability}>
- {i18n.t("Availability", { context: "table cell" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Category Name", { context: "table cell" })}
+ </TableCell>
+ <TableCell className={classes.colProducts}>
+ {i18n
+ .t("No. Products", { context: "table cell" })
+ .replace(" ", "\xa0")}
+ </TableCell>
+ <TableCell className={classes.colAvailability}>
+ {i18n.t("Availability", { context: "table cell" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
index f6bd1b5d9c..a79f94aaf3 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
@@ -35,7 +35,7 @@ const styles = (theme: Theme) =>
},
width: 48 + theme.spacing.unit / 2
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -92,27 +92,20 @@ const CollectionProducts = withStyles(styles, { name: "CollectionProducts" })(
</Button>
}
/>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
- items={collection}
+ items={maybe(() => collection.products.edges.map(edge => edge.node))}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell>
- {i18n.t("Name", { context: "table header" })}
- </TableCell>
- <TableCell>
- {i18n.t("Type", { context: "table header" })}
- </TableCell>
- <TableCell>
- {i18n.t("Published", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell>{i18n.t("Name", { context: "table header" })}</TableCell>
+ <TableCell>{i18n.t("Type", { context: "table header" })}</TableCell>
+ <TableCell>
+ {i18n.t("Published", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
index f6f8e95356..d3021ea0ab 100644
--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
@@ -53,7 +53,7 @@ const styles = (theme: Theme) =>
link: {
cursor: "pointer"
},
- relative: {
+ table: {
position: "relative"
},
textLeft: {
@@ -86,31 +86,28 @@ export const ProductList = withStyles(styles, { name: "ProductList" })(
onPreviousPage,
onRowClick
}: ProductListProps) => (
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={products}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Name", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colType}>
- {i18n.t("Type", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colPublished}>
- {i18n.t("Published", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colPrice}>
- {i18n.t("Price", { context: "object" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell />
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colType}>
+ {i18n.t("Type", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colPublished}>
+ {i18n.t("Published", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colPrice}>
+ {i18n.t("Price", { context: "object" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx b/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
index 77677cce3e..79d12299da 100644
--- a/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
+++ b/saleor/static/dashboard-next/components/TableHead/TableHead.tsx
@@ -14,16 +14,17 @@ import Typography from "@material-ui/core/Typography";
import * as classNames from "classnames";
import * as React from "react";
+import { Node } from "../../types";
+
import i18n from "../../i18n";
import Checkbox from "../Checkbox";
export interface TableHeadProps extends MuiTableHeadProps {
disabled: boolean;
- items: React.ReactNode | React.ReactNodeArray;
selected: number;
+ items: Node[];
toolbar: React.ReactNode | React.ReactNodeArray;
- tablebar: React.ReactNode | React.ReactNodeArray;
- toggleAll: (items: any, selected: any) => void;
+ toggleAll: (items: Node[], selected: number) => void;
}
const styles = (theme: Theme) =>
@@ -31,6 +32,9 @@ const styles = (theme: Theme) =>
cell: {
padding: 0
},
+ checkboxSelected: {
+ backgroundColor: fade(theme.palette.primary.main, 0.05)
+ },
container: {
alignItems: "center",
display: "flex",
@@ -44,6 +48,7 @@ const styles = (theme: Theme) =>
},
root: {
backgroundColor: fade(theme.palette.primary.main, 0.05),
+ borderBottom: "1px solid rgba(224, 224, 224, 1)",
paddingLeft: 12,
paddingRight: 24,
position: "absolute",
@@ -63,12 +68,11 @@ const TableHead = withStyles(styles, {
name: "TableHead"
})(
({
- children,
classes,
+ children,
disabled,
items,
selected,
- tablebar,
toggleAll,
toolbar,
...muiTableHeadProps
@@ -77,7 +81,12 @@ const TableHead = withStyles(styles, {
return (
<MuiTableHead {...muiTableHeadProps}>
<TableRow>
- <TableCell padding="checkbox">
+ <TableCell
+ padding="checkbox"
+ className={classNames({
+ [classes.checkboxSelected]: selected
+ })}
+ >
<Checkbox
checked={isSelected}
disabled={disabled}
@@ -105,7 +114,7 @@ const TableHead = withStyles(styles, {
</div>
</>
) : (
- tablebar
+ children
)}
</TableRow>
</MuiTableHead>
diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
index f631c75605..f3ea623e07 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
@@ -35,7 +35,7 @@ const styles = (theme: Theme) =>
colOrders: {
textAlign: "center"
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -66,27 +66,24 @@ const CustomerList = withStyles(styles, { name: "CustomerList" })(
isChecked
}: CustomerListProps) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={customers}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Customer Name", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colEmail}>
- {i18n.t("Customer e-mail", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colOrders}>
- {i18n.t("Orders", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Customer Name", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colEmail}>
+ {i18n.t("Customer e-mail", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colOrders}>
+ {i18n.t("Orders", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
index 9fbb0355f0..621e8744b2 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCategories/DiscountCategories.tsx
@@ -84,22 +84,21 @@ const DiscountCategories = withStyles(styles, {
<TableHead
selected={selected}
disabled={disabled}
- items={sale}
+ items={maybe(() => sale.categories.edges.map(edge => edge.node))}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell />
- <TableCell className={classes.wideColumn}>
- {i18n.t("Category name")}
- </TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Products")}
- </TableCell>
- <TableCell />
- </>
- }
- />
+ >
+ <>
+ <TableCell />
+ <TableCell className={classes.wideColumn}>
+ {i18n.t("Category name")}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {i18n.t("Products")}
+ </TableCell>
+ <TableCell />
+ </>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
index 2e98aa64fd..acac5d0df1 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountCollections/DiscountCollections.tsx
@@ -84,22 +84,17 @@ const DiscountCollections = withStyles(styles, {
<TableHead
selected={selected}
disabled={disabled}
- items={sale}
+ items={maybe(() => sale.collections.edges.map(edge => edge.node))}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell />
- <TableCell className={classes.wideColumn}>
- {i18n.t("Collection name")}
- </TableCell>
- <TableCell className={classes.textRight}>
- {i18n.t("Products")}
- </TableCell>
- <TableCell />
- </>
- }
- />
+ >
+ <TableCell className={classes.wideColumn}>
+ {i18n.t("Collection name")}
+ </TableCell>
+ <TableCell className={classes.textRight}>
+ {i18n.t("Products")}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
index cad9ba4c3c..f0fd4f275a 100644
--- a/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
+++ b/saleor/static/dashboard-next/discounts/components/DiscountProducts/DiscountProducts.tsx
@@ -92,26 +92,23 @@ const DiscountProducts = withStyles(styles, {
<TableHead
selected={selected}
disabled={disabled}
- items={sale}
+ items={maybe(() => sale.products.edges.map(edge => edge.node))}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell />
- <TableCell />
- <TableCell className={classes.colName}>
- {i18n.t("Product name")}
- </TableCell>
- <TableCell className={classes.colType}>
- {i18n.t("Product Type")}
- </TableCell>
- <TableCell className={classes.colPublished}>
- {i18n.t("Published")}
- </TableCell>
- <TableCell />
- </>
- }
- />
+ >
+ <TableCell />
+ <TableCell />
+ <TableCell className={classes.colName}>
+ {i18n.t("Product name")}
+ </TableCell>
+ <TableCell className={classes.colType}>
+ {i18n.t("Product Type")}
+ </TableCell>
+ <TableCell className={classes.colPublished}>
+ {i18n.t("Published")}
+ </TableCell>
+ <TableCell />
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
index 53c8371bdd..459c57ef54 100644
--- a/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/SaleList/SaleList.tsx
@@ -54,7 +54,7 @@ const styles = (theme: Theme) =>
colValue: {
textAlign: "right"
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -81,38 +81,35 @@ const SaleList = withStyles(styles, {
toolbar
}: SaleListProps & WithStyles<typeof styles>) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={sales}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Name", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colStart}>
- {i18n.t("Starts", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colEnd}>
- {i18n.t("Ends", {
- context: "sale list table header"
- })}
- </TableCell>
- <TableCell className={classes.colValue}>
- {i18n.t("Value", {
- context: "sale list table header"
- })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colStart}>
+ {i18n.t("Starts", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colEnd}>
+ {i18n.t("Ends", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colValue}>
+ {i18n.t("Value", {
+ context: "sale list table header"
+ })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
index 51923fb9e6..90fcf9f357 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherList/VoucherList.tsx
@@ -66,7 +66,7 @@ const styles = (theme: Theme) =>
colValue: {
textAlign: "right"
},
- relative: {
+ table: {
position: "relative"
},
tableRow: {
@@ -96,48 +96,45 @@ const VoucherList = withStyles(styles, {
toolbar
}: VoucherListProps & WithStyles<typeof styles>) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={vouchers}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Name", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colMinSpent}>
- {i18n.t("Min. Spent", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colStart}>
- {i18n.t("Starts", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colEnd}>
- {i18n.t("Ends", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colValue}>
- {i18n.t("Value", {
- context: "voucher list table header"
- })}
- </TableCell>
- <TableCell className={classes.colUses}>
- {i18n.t("Uses", {
- context: "voucher list table header"
- })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colMinSpent}>
+ {i18n.t("Min. Spent", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colStart}>
+ {i18n.t("Starts", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colEnd}>
+ {i18n.t("Ends", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colValue}>
+ {i18n.t("Value", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ <TableCell className={classes.colUses}>
+ {i18n.t("Uses", {
+ context: "voucher list table header"
+ })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/hooks/useBulkActions.ts b/saleor/static/dashboard-next/hooks/useBulkActions.ts
index 2165a82c21..9863087822 100644
--- a/saleor/static/dashboard-next/hooks/useBulkActions.ts
+++ b/saleor/static/dashboard-next/hooks/useBulkActions.ts
@@ -1,4 +1,5 @@
import { useState } from "react";
+import { Node } from "../types";
function useBulkActions(initial: string[] = []) {
const [listElements, setListElements] = useState(initial);
@@ -23,15 +24,10 @@ function useBulkActions(initial: string[] = []) {
isSelected(id) ? remove(id) : add(id);
}
- function toggleAll(items: any, selected: number) {
- const allItems = [];
- items.map(item => {
- allItems.push(item.id);
- });
- if (selected === allItems.length) {
- reset();
- } else {
- reset();
+ function toggleAll(items: Node[], selected: number) {
+ const allItems = items.map(item => item.id);
+ reset();
+ if (selected !== allItems.length) {
setListElements(allItems);
}
}
diff --git a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
index 8bf268b513..55989a6c77 100644
--- a/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
+++ b/saleor/static/dashboard-next/navigation/components/MenuList/MenuList.tsx
@@ -40,11 +40,11 @@ const styles = (theme: Theme) =>
textAlign: "right"
},
colTitle: {},
- relative: {
- position: "relative"
- },
row: {
cursor: "pointer"
+ },
+ table: {
+ position: "relative"
}
});
const MenuList = withStyles(styles, { name: "MenuList" })(
@@ -64,24 +64,21 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
toolbar
}: MenuListProps & WithStyles<typeof styles>) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={menus}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colTitle}>
- {i18n.t("Menu Title", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colItems}>
- {i18n.t("Items", { context: "number of menu items" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colTitle}>
+ {i18n.t("Menu Title", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colItems}>
+ {i18n.t("Items", { context: "number of menu items" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
index d266e71f75..82fa751647 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftList/OrderDraftList.tsx
@@ -89,23 +89,20 @@ export const OrderDraftList = withStyles(styles, { name: "OrderDraftList" })(
items={orders}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell padding="dense" className={classes.colNumber}>
- {i18n.t("No. of Order", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colDate}>
- {i18n.t("Date", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colCustomer}>
- {i18n.t("Customer", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTotal} padding="dense">
- {i18n.t("Total", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell padding="dense" className={classes.colNumber}>
+ {i18n.t("No. of Order", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colDate}>
+ {i18n.t("Date", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colCustomer}>
+ {i18n.t("Customer", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTotal} padding="dense">
+ {i18n.t("Total", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index c03dea6e05..8a649373d2 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -57,7 +57,7 @@ const styles = (theme: Theme) =>
link: {
cursor: "pointer"
},
- relative: {
+ table: {
position: "relative"
}
});
@@ -92,36 +92,33 @@ export const OrderList = withStyles(styles, { name: "OrderList" })(
}))
: undefined;
return (
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={orders}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell padding="dense" className={classes.colNumber}>
- {i18n.t("No. of Order", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colDate}>
- {i18n.t("Date", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colCustomer}>
- {i18n.t("Customer", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colPayment}>
- {i18n.t("Payment", { context: "table header" })}
- </TableCell>
- <TableCell padding="dense" className={classes.colFulfillment}>
- {i18n.t("Fulfillment status", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTotal} padding="dense">
- {i18n.t("Total", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell padding="dense" className={classes.colNumber}>
+ {i18n.t("No. of Order", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colDate}>
+ {i18n.t("Date", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colCustomer}>
+ {i18n.t("Customer", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colPayment}>
+ {i18n.t("Payment", { context: "table header" })}
+ </TableCell>
+ <TableCell padding="dense" className={classes.colFulfillment}>
+ {i18n.t("Fulfillment status", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTotal} padding="dense">
+ {i18n.t("Total", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index 39aaa24049..a82fd6c16c 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -43,7 +43,7 @@ const styles = (theme: Theme) =>
link: {
cursor: "pointer"
},
- relative: {
+ table: {
position: "relative"
}
});
@@ -63,27 +63,24 @@ const PageList = withStyles(styles, { name: "PageList" })(
toolbar
}: PageListProps & WithStyles<typeof styles>) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={pages}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colTitle} padding="dense">
- {i18n.t("Title", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colSlug} padding="dense">
- {i18n.t("Slug", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colVisibility} padding="dense">
- {i18n.t("Visibility", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colTitle} padding="dense">
+ {i18n.t("Title", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colSlug} padding="dense">
+ {i18n.t("Slug", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colVisibility} padding="dense">
+ {i18n.t("Visibility", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
index 1c8eabb1b0..cb50d14f7e 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
@@ -39,7 +39,7 @@ const styles = (theme: Theme) =>
link: {
cursor: "pointer"
},
- relative: {
+ table: {
position: "relative"
}
});
@@ -67,27 +67,24 @@ const ProductTypeList = withStyles(styles, { name: "ProductTypeList" })(
toolbar
}: ProductTypeListProps) => (
<Card>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={productTypes}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Type Name", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colType}>
- {i18n.t("Type", { context: "table header" })}
- </TableCell>
- <TableCell className={classes.colTax}>
- {i18n.t("Tax", { context: "table header" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Type Name", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colType}>
+ {i18n.t("Type", { context: "table header" })}
+ </TableCell>
+ <TableCell className={classes.colTax}>
+ {i18n.t("Tax", { context: "table header" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
index 83afbd2bb7..7fe50e2ded 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
@@ -115,23 +115,18 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })(
items={variants}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Name")}
- </TableCell>
- <TableCell className={classes.colStatus}>
- {i18n.t("Status")}
- </TableCell>
- <TableCell className={classes.colSku}>{i18n.t("SKU")}</TableCell>
- <Hidden smDown>
- <TableCell className={classes.colPrice}>
- {i18n.t("Price")}
- </TableCell>
- </Hidden>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>{i18n.t("Name")}</TableCell>
+ <TableCell className={classes.colStatus}>
+ {i18n.t("Status")}
+ </TableCell>
+ <TableCell className={classes.colSku}>{i18n.t("SKU")}</TableCell>
+ <Hidden smDown>
+ <TableCell className={classes.colPrice}>
+ {i18n.t("Price")}
+ </TableCell>
+ </Hidden>
+ </TableHead>
<TableBody>
{renderCollection(
variants,
diff --git a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
index a59cebb56c..776136265c 100644
--- a/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
+++ b/saleor/static/dashboard-next/shipping/components/ShippingZonesList/ShippingZonesList.tsx
@@ -46,11 +46,11 @@ const styles = (theme: Theme) =>
},
colCountries: {},
colName: {},
- relative: {
- position: "relative"
- },
row: {
cursor: "pointer"
+ },
+ table: {
+ position: "relative"
}
});
const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
@@ -82,24 +82,21 @@ const ShippingZonesList = withStyles(styles, { name: "ShippingZonesList" })(
</Button>
}
/>
- <Table className={classes.relative}>
+ <Table className={classes.table}>
<TableHead
selected={selected}
disabled={disabled}
items={shippingZones}
toggleAll={toggleAll}
toolbar={toolbar}
- tablebar={
- <>
- <TableCell className={classes.colName}>
- {i18n.t("Name", { context: "object" })}
- </TableCell>
- <TableCell className={classes.colCountries}>
- {i18n.t("Countries", { context: "object" })}
- </TableCell>
- </>
- }
- />
+ >
+ <TableCell className={classes.colName}>
+ {i18n.t("Name", { context: "object" })}
+ </TableCell>
+ <TableCell className={classes.colCountries}>
+ {i18n.t("Countries", { context: "object" })}
+ </TableCell>
+ </TableHead>
<TableFooter>
<TableRow>
<TablePagination
diff --git a/saleor/static/dashboard-next/types.ts b/saleor/static/dashboard-next/types.ts
index 5f8b0be632..9535af9225 100644
--- a/saleor/static/dashboard-next/types.ts
+++ b/saleor/static/dashboard-next/types.ts
@@ -17,7 +17,7 @@ export interface ListProps {
}
export interface ListActionsWithoutToolbar {
toggle: (id: string) => void;
- toggleAll: (items: any, selected: number) => void;
+ toggleAll: (items: React.ReactNodeArray, selected: number) => void;
isChecked: (id: string) => boolean;
selected: number;
}
@@ -40,6 +40,10 @@ export interface PartialMutationProviderOutput<
mutate: (variables: TVariables) => void;
}
+export interface Node {
+ id: string;
+}
+
export type FormErrors<TKeys extends string> = Partial<Record<TKeys, string>>;
export type Pagination = Partial<{