Skip to content

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

Enforce noUnusedParameters rule

dominik-zeglen7e9586ceae83
diff --git a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx b/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx
index 4542e1f0f5..35286576d0 100644
--- a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx
+++ b/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx
@@ -44,7 +44,7 @@ const decorate = withStyles(theme => ({
}
}));
const AttributeValueList = decorate<AttributeValueListProps>(
- ({ classes, disabled, loading, values, onChange }) => {
+ ({ classes, disabled, values, onChange }) => {
const defaultValue = i18n.t("New value");
const handleAdd = () =>
onChange({
diff --git a/saleor/static/dashboard-next/auth/components/LoginPage/LoginPage.tsx b/saleor/static/dashboard-next/auth/components/LoginPage/LoginPage.tsx
index 16e5e1e80e..c080897b40 100644
--- a/saleor/static/dashboard-next/auth/components/LoginPage/LoginPage.tsx
+++ b/saleor/static/dashboard-next/auth/components/LoginPage/LoginPage.tsx
@@ -70,75 +70,73 @@ const decorate = withStyles(theme => ({
height: "100vh"
}
}));
-const LoginCard = decorate<LoginCardProps>(
- ({ classes, error, onPasswordRecovery, onSubmit }) => {
- return (
- <Form
- initial={{ email: "", password: "", rememberMe: false }}
- onSubmit={onSubmit}
- >
- {({ change: handleChange, data, submit: handleSubmit }) => (
- <Container className={classes.root} width="sm">
- <Card className={classes.card}>
- <SVG className={classes.logo} src={saleorLogo} />
- {error && (
- <div className={classes.panel}>
- <Typography
- variant="caption"
- dangerouslySetInnerHTML={{
- __html: i18n.t(
- "Sorry, your username and/or password are incorrect. <br />Please try again."
- )
- }}
- />
- </div>
- )}
- <TextField
- autoFocus
- fullWidth
- autoComplete="username"
- label={i18n.t("Email", { context: "form" })}
- name="email"
- onChange={handleChange}
- value={data.email}
- />
- <FormSpacer />
- <TextField
- fullWidth
- autoComplete="current-password"
- label={i18n.t("Password")}
- name="password"
- onChange={handleChange}
- type="password"
- value={data.password}
- />
- <FormSpacer />
- <ControlledCheckbox
- checked={data.rememberMe}
- label={i18n.t("Remember me")}
- name="rememberMe"
- onChange={handleChange}
- />
- <FormSpacer />
- <Button
- className={classes.loginButton}
- color="secondary"
- variant="raised"
- onClick={handleSubmit}
- type="submit"
- >
- {i18n.t("Login")}
- </Button>
- {/* <FormSpacer />
+const LoginCard = decorate<LoginCardProps>(({ classes, error, onSubmit }) => {
+ return (
+ <Form
+ initial={{ email: "", password: "", rememberMe: false }}
+ onSubmit={onSubmit}
+ >
+ {({ change: handleChange, data, submit: handleSubmit }) => (
+ <Container className={classes.root} width="sm">
+ <Card className={classes.card}>
+ <SVG className={classes.logo} src={saleorLogo} />
+ {error && (
+ <div className={classes.panel}>
+ <Typography
+ variant="caption"
+ dangerouslySetInnerHTML={{
+ __html: i18n.t(
+ "Sorry, your username and/or password are incorrect. <br />Please try again."
+ )
+ }}
+ />
+ </div>
+ )}
+ <TextField
+ autoFocus
+ fullWidth
+ autoComplete="username"
+ label={i18n.t("Email", { context: "form" })}
+ name="email"
+ onChange={handleChange}
+ value={data.email}
+ />
+ <FormSpacer />
+ <TextField
+ fullWidth
+ autoComplete="current-password"
+ label={i18n.t("Password")}
+ name="password"
+ onChange={handleChange}
+ type="password"
+ value={data.password}
+ />
+ <FormSpacer />
+ <ControlledCheckbox
+ checked={data.rememberMe}
+ label={i18n.t("Remember me")}
+ name="rememberMe"
+ onChange={handleChange}
+ />
+ <FormSpacer />
+ <Button
+ className={classes.loginButton}
+ color="secondary"
+ variant="raised"
+ onClick={handleSubmit}
+ type="submit"
+ >
+ {i18n.t("Login")}
+ </Button>
+ {/* <FormSpacer />
<Typography className={classes.link}>
{i18n.t("Reset your password")}
</Typography> */}
- </Card>
- </Container>
- )}
- </Form>
- );
- }
-);
+ </Card>
+ </Container>
+ )}
+ </Form>
+ );
+});
export default LoginCard;
diff --git a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
index ccede05df6..baa6db60b5 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryList/CategoryList.tsx
@@ -29,7 +29,7 @@ interface CategoryListProps {
onRowClick?(id: string): () => void;
}
-const decorate = withStyles(theme => ({
+const decorate = withStyles({
centerText: {
textAlign: "center" as "center"
},
@@ -39,7 +39,7 @@ const decorate = withStyles(theme => ({
wideColumn: {
width: "100%"
}
-}));
+});
const CategoryList = decorate<CategoryListProps>(
({ categories, classes, isRoot, onAdd, onRowClick }) => (
diff --git a/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx b/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx
index eb2a1721ad..862806de2f 100644
--- a/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx
+++ b/saleor/static/dashboard-next/components/DateFormatter/DateFormatter.tsx
@@ -12,16 +12,19 @@ interface DateFormatterProps {
typographyProps?: TypographyProps;
}
-const decorate = withStyles(theme => ({ root: { display: "inline" } }), {
- name: "DateFormatter"
-});
+const decorate = withStyles(
+ { root: { display: "inline" } },
+ {
+ name: "DateFormatter"
+ }
+);
const DateFormatter = decorate<DateFormatterProps>(
({ classes, date, typographyProps }) => {
return (
<LocaleConsumer>
- {locale => (
+ {_ => (
<Consumer>
- {dateNow => (
+ {_ => (
<Typography
component="span"
className={classes.root}
diff --git a/saleor/static/dashboard-next/components/EditableTableCell/EditableTableCell.tsx b/saleor/static/dashboard-next/components/EditableTableCell/EditableTableCell.tsx
index 05e102bc23..2bc5d71c96 100644
--- a/saleor/static/dashboard-next/components/EditableTableCell/EditableTableCell.tsx
+++ b/saleor/static/dashboard-next/components/EditableTableCell/EditableTableCell.tsx
@@ -69,7 +69,7 @@ export const EditableTableCell = decorate<EditableTableCellProps>(
onSubmit={handleConfirm}
useForm={false}
>
- {({ change, data, submit }) => (
+ {({ change, data }) => (
<>
<Typography
variant="caption"
diff --git a/saleor/static/dashboard-next/components/FileUpload/FileUpload.tsx b/saleor/static/dashboard-next/components/FileUpload/FileUpload.tsx
index af7476fb60..65caef34f8 100644
--- a/saleor/static/dashboard-next/components/FileUpload/FileUpload.tsx
+++ b/saleor/static/dashboard-next/components/FileUpload/FileUpload.tsx
@@ -11,7 +11,7 @@ interface FileUploadProps {
onChange?(event: React.ChangeEvent<any>);
}
-const decorate = withStyles(theme => ({
+const decorate = withStyles({
fileUploadField: {
display: "none"
},
@@ -21,7 +21,7 @@ const decorate = withStyles(theme => ({
textField: {
flex: 1
}
-}));
+});
const FileUpload = decorate<FileUploadProps>(
({ classes, disabled, name, value, onChange }) => (
<div className={classes.root}>
diff --git a/saleor/static/dashboard-next/components/Form/FormActions.tsx b/saleor/static/dashboard-next/components/Form/FormActions.tsx
index 3eefbe9ad1..2d47bfa226 100644
--- a/saleor/static/dashboard-next/components/Form/FormActions.tsx
+++ b/saleor/static/dashboard-next/components/Form/FormActions.tsx
@@ -5,11 +5,11 @@ import * as React from "react";
import i18n from "../../i18n";
-const decorate = withStyles(theme => ({
+const decorate = withStyles({
cardActions: {
flexDirection: "row-reverse" as "row-reverse"
}
-}));
+});
interface FormActionsProps {
submitLabel: string;
@@ -18,7 +18,7 @@ interface FormActionsProps {
}
const FormActions = decorate<FormActionsProps>(
- ({ children, classes, onCancel, onSubmit, submitLabel }) => (
+ ({ classes, onCancel, onSubmit, submitLabel }) => (
<Toolbar className={classes.cardActions}>
<Button variant="raised" color="primary" onClick={onSubmit} type="submit">
{submitLabel}
diff --git a/saleor/static/dashboard-next/components/MenuToggle.tsx b/saleor/static/dashboard-next/components/MenuToggle.tsx
index c980b309cb..9f892a7787 100644
--- a/saleor/static/dashboard-next/components/MenuToggle.tsx
+++ b/saleor/static/dashboard-next/components/MenuToggle.tsx
@@ -6,7 +6,7 @@ interface MenuToggleProps {
| ((
props: {
actions: {
- open: (event: React.MouseEvent<any>) => void;
+ open: () => void;
close: () => void;
};
open: boolean;
@@ -24,7 +24,7 @@ class MenuToggle extends React.Component<MenuToggleProps, MenuToggleState> {
open: false
};
- handleClick = (event: React.MouseEvent<any>) => {
+ handleClick = () => {
this.setState({ open: true });
};
diff --git a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
index 011d853e88..35f6b01da9 100644
--- a/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
+++ b/saleor/static/dashboard-next/components/SaveButtonBar/SaveButtonBar.tsx
@@ -116,7 +116,7 @@ export const SaveButtonBar = decorate<SaveButtonBarProps>(
break;
}
return (
- <div className={classes.root}>
+ <div className={classes.root} {...props}>
{!!onDelete && (
<Button
variant="contained"
diff --git a/saleor/static/dashboard-next/components/Skeleton.tsx b/saleor/static/dashboard-next/components/Skeleton.tsx
index f921d1e08a..3440c27e86 100644
--- a/saleor/static/dashboard-next/components/Skeleton.tsx
+++ b/saleor/static/dashboard-next/components/Skeleton.tsx
@@ -2,7 +2,7 @@ import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
const decorate = withStyles(
- theme => ({
+ {
"@keyframes skeleton-animation": {
"0%": {
opacity: 0.6
@@ -19,7 +19,7 @@ const decorate = withStyles(
height: "0.8em",
margin: "0.2em 0"
}
- }),
+ },
{ name: "Skeleton" }
);
diff --git a/saleor/static/dashboard-next/components/messages/MessageManager.tsx b/saleor/static/dashboard-next/components/messages/MessageManager.tsx
index bd79b0bf4d..614c626e02 100644
--- a/saleor/static/dashboard-next/components/messages/MessageManager.tsx
+++ b/saleor/static/dashboard-next/components/messages/MessageManager.tsx
@@ -21,7 +21,7 @@ export class MessageManager extends React.Component<{}, MessageManagerState> {
};
queue = [];
- handleClose = (event, reason) => {
+ handleClose = (_, reason) => {
if (reason === "clickaway") {
return;
}
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index 7485cc6460..b0cb1ceaa8 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -69,11 +69,8 @@ const CustomerDetailsPage = decorate<CustomerDetailsPageProps>(
pageInfo,
onBack,
onOrderClick,
- onBillingAddressEdit,
onCustomerDelete,
onCustomerEdit,
- onEmailClick,
- onShippingAddressEdit,
onPreviousPage,
onNextPage
}) => (
diff --git a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
index f4a45a7eea..3462eb5e69 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerEditPage/CustomerEditPage.tsx
@@ -56,7 +56,7 @@ const CustomerEditPage: React.StatelessComponent<CustomerEditPageProps> = ({
}}
key={customer ? CRC.str(JSON.stringify(customer)) : "loading"}
>
- {({ change, data, hasChanged, submit }) => (
+ {({ change, data, hasChanged }) => (
<Container width="md">
<PageHeader
title={
diff --git a/saleor/static/dashboard-next/fixtures.ts b/saleor/static/dashboard-next/fixtures.ts
index 8937267e97..b2d68477cb 100644
--- a/saleor/static/dashboard-next/fixtures.ts
+++ b/saleor/static/dashboard-next/fixtures.ts
@@ -10,7 +10,7 @@ export const pageListProps: { [key: string]: PageListProps } = {
onAdd: undefined,
onNextPage: undefined,
onPreviousPage: undefined,
- onRowClick: (id: string) => undefined,
+ onRowClick: () => undefined,
pageInfo
},
loading: {
@@ -18,7 +18,7 @@ export const pageListProps: { [key: string]: PageListProps } = {
onAdd: undefined,
onNextPage: undefined,
onPreviousPage: undefined,
- onRowClick: (id: string) => undefined,
+ onRowClick: () => undefined,
pageInfo
}
};
diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsx
index ceb66b252b..3c375a73ac 100644
--- a/saleor/static/dashboard-next/index.tsx
+++ b/saleor/static/dashboard-next/index.tsx
@@ -38,7 +38,7 @@ const invalidTokenLink = onError((error: ResponseError) => {
}
});
-const authLink = setContext((operation, context) => {
+const authLink = setContext((_, context) => {
const authToken = getAuthToken();
return {
...context,
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index 1c3134a6ce..c5973ed552 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -381,7 +381,7 @@ class OrderDetailsPageComponent extends React.Component<
}
}}
>
- {({ change, data, submit }) => (
+ {({ change, data }) => (
<OrderShippingMethodEditDialog
open={openedShippingMethodEditDialog}
shippingMethod={data.shippingMethod}
@@ -440,7 +440,7 @@ class OrderDetailsPageComponent extends React.Component<
trackingCode: fulfillment.trackingCode
}}
>
- {({ change, data, submit }) => (
+ {({ change, data }) => (
<OrderFulfillmentTrackingDialog
open={openedTrackingDialog}
trackingCode={data.trackingCode}
@@ -486,7 +486,7 @@ class OrderDetailsPageComponent extends React.Component<
: { label: "", value: "" }
}}
>
- {({ change, data, submit }) => (
+ {({ change, data }) => (
<OrderCustomerEditDialog
open={openedCustomerEditDialog}
user={data.email}
diff --git a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx b/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx
index 99a383cb71..15a3406d1f 100644
--- a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx
@@ -1,6 +1,5 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
-import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
@@ -20,78 +19,74 @@ interface PagePropertiesProps {
onChange?(event: React.ChangeEvent<any>);
}
-const decorate = withStyles(theme => ({ root: {} }));
-const PageProperties = decorate<PagePropertiesProps>(
- ({
- classes,
- created,
- errors,
- slug,
- availableOn,
- loading,
- isVisible,
- onChange
- }) => {
- const errorList: { [key: string]: string } = errors
- ? errors.reduce((acc, curr) => {
- acc[curr.field] = curr.message;
- return acc;
- }, {})
- : {};
- return (
- <Card>
- <CardContent>
- <TextField
- disabled={loading}
- name="slug"
- label={i18n.t("Slug", { context: "object" })}
- value={slug}
- helperText={
- errorList && errorList.slug
- ? errorList.slug
- : i18n.t("Slug is being used to create page URL", {
- context: "object"
- })
- }
- onChange={onChange}
- error={!!(errorList && errorList.slug)}
- fullWidth
- />
- <FormSpacer />
- <TextField
- disabled={loading}
- name="availableOn"
- label={i18n.t("Available on", { context: "label" })}
- type="date"
- value={availableOn}
- onChange={onChange}
- InputLabelProps={{
- shrink: true
- }}
- helperText={
- errorList && errorList.availableOn ? errorList.availableOn : ""
- }
- error={!!(errorList && errorList.availableOn)}
- fullWidth
- />
- <FormSpacer />
- {created && (
- <div>
- <Typography variant="body1">{i18n.t("Created:")} </Typography>
- <DateFormatter date={created} />
- </div>
- )}
- <FormSpacer />
- <ControlledCheckbox
- checked={isVisible}
- disabled={loading}
- label={i18n.t("Published", { context: "label" })}
- name="isVisible"
- onChange={onChange}
- />
- </CardContent>
- </Card>
- );
- }
-);
+const PageProperties: React.StatelessComponent<PagePropertiesProps> = ({
+ created,
+ errors,
+ slug,
+ availableOn,
+ loading,
+ isVisible,
+ onChange
+}) => {
+ const errorList: { [key: string]: string } = errors
+ ? errors.reduce((acc, curr) => {
+ acc[curr.field] = curr.message;
+ return acc;
+ }, {})
+ : {};
+ return (
+ <Card>
+ <CardContent>
+ <TextField
+ disabled={loading}
+ name="slug"
+ label={i18n.t("Slug", { context: "object" })}
+ value={slug}
+ helperText={
+ errorList && errorList.slug
+ ? errorList.slug
+ : i18n.t("Slug is being used to create page URL", {
+ context: "object"
+ })
+ }
+ onChange={onChange}
+ error={!!(errorList && errorList.slug)}
+ fullWidth
+ />
+ <FormSpacer />
+ <TextField
+ disabled={loading}
+ name="availableOn"
+ label={i18n.t("Available on", { context: "label" })}
+ type="date"
+ value={availableOn}
+ onChange={onChange}
+ InputLabelProps={{
+ shrink: true
+ }}
+ helperText={
+ errorList && errorList.availableOn ? errorList.availableOn : ""
+ }
+ error={!!(errorList && errorList.availableOn)}
+ fullWidth
+ />
+ <FormSpacer />
+ {created && (
+ <div>
+ <Typography variant="body1">{i18n.t("Created:")} </Typography>
+ <DateFormatter date={created} />
+ </div>
+ )}
+ <FormSpacer />
+ <ControlledCheckbox
+ checked={isVisible}
+ disabled={loading}
+ label={i18n.t("Published", { context: "label" })}
+ name="isVisible"
+ onChange={onChange}
+ />
+ </CardContent>
+ </Card>
+ );
+};
export default PageProperties;
diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
index 275f9b3bf2..7952126352 100644
--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
@@ -7,14 +7,9 @@ import i18n from "../../i18n";
import PageDetailsPage from "../../pages/components/PageDetailsPage";
import { TypedPageCreateMutation } from "../mutations";
-interface PageCreateFormProps {
- id: string;
-}
-export const PageCreateForm: React.StatelessComponent<PageCreateFormProps> = ({
- id
-}) => (
+export const PageCreateForm: React.StatelessComponent = () => (
<TypedPageCreateMutation>
- {(createPage, { called, data: createResult, error, loading }) => {
+ {(createPage, { called, data: createResult, loading }) => {
if (called && !loading && !createResult.pageCreate.errors.length) {
return <Redirect to={pageListUrl} push={false} />;
}
diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
index 1c15814da6..dd8d21fa6e 100644
--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
@@ -6,10 +6,7 @@ import ErrorMessageCard from "../../components/ErrorMessageCard";
import { NavigatorLink } from "../../components/Navigator";
import i18n from "../../i18n";
import PageDetailsPage from "../components/PageDetailsPage";
-import {
- TypedPageDeleteMutation,
- TypedPageUpdateMutation
-} from "../mutations";
+import { TypedPageDeleteMutation, TypedPageUpdateMutation } from "../mutations";
import { pageDetailsQuery, TypedPageDetailsQuery } from "../queries";
interface PageUpdateFormProps {
@@ -45,7 +42,7 @@ export class PageUpdateForm extends React.Component<
return (
<TypedPageDeleteMutation>
{(
- deletePage,
+ _,
{ called, data: deleteResult, error, loading: deleteInProgress }
) => {
if (called && !deleteInProgress) {
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetails/ProductTypeDetails.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetails/ProductTypeDetails.tsx
index b6134dcb8f..0f1e0f21e5 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetails/ProductTypeDetails.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetails/ProductTypeDetails.tsx
@@ -29,11 +29,11 @@ interface ProductTypeDetailsProps {
onChange: (event: React.ChangeEvent<any>) => void;
}
-const decorate = withStyles(theme => ({
+const decorate = withStyles({
root: {
overflow: "visible" as "visible"
}
-}));
+});
const ProductTypeDetails = decorate<ProductTypeDetailsProps>(
({
classes,
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx
index 33d5a69b1f..643c957eba 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeProperties/ProductTypeProperties.tsx
@@ -1,6 +1,5 @@
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
-import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
import CardTitle from "../../../components/CardTitle";
@@ -20,41 +19,40 @@ interface ProductTypePropertiesProps {
onChange: (event: React.ChangeEvent<any>) => void;
}
-const decorate = withStyles(theme => ({ root: {} }));
-const ProductTypeProperties = decorate<ProductTypePropertiesProps>(
- ({ classes, data, disabled, taxRates, onChange }) => (
- <Card>
- <CardTitle title={i18n.t("Properties")} />
- <CardContent>
- <ControlledCheckbox
- checked={data.hasVariants}
- disabled={disabled}
- label={i18n.t("Has variants")}
- name="hasVariants"
- onChange={onChange}
- />
- <ControlledCheckbox
- checked={data.isShippingRequired}
- disabled={disabled}
- label={i18n.t("Requires shipping")}
- name="isShippingRequired"
- onChange={onChange}
- />
- <FormSpacer />
- <SingleSelectField
- choices={[
- { label: "no tax rate", value: null },
- ...taxRates.map(t => ({ label: t, value: t }))
- ]}
- hint={i18n.t("Optional")}
- label={i18n.t("Tax rate")}
- name="taxRate"
- onChange={onChange}
- value={data.taxRate}
- />
- </CardContent>
- </Card>
- )
+const ProductTypeProperties: React.StatelessComponent<
+ ProductTypePropertiesProps
+> = ({ data, disabled, taxRates, onChange }) => (
+ <Card>
+ <CardTitle title={i18n.t("Properties")} />
+ <CardContent>
+ <ControlledCheckbox
+ checked={data.hasVariants}
+ disabled={disabled}
+ label={i18n.t("Has variants")}
+ name="hasVariants"
+ onChange={onChange}
+ />
+ <ControlledCheckbox
+ checked={data.isShippingRequired}
+ disabled={disabled}
+ label={i18n.t("Requires shipping")}
+ name="isShippingRequired"
+ onChange={onChange}
+ />
+ <FormSpacer />
+ <SingleSelectField
+ choices={[
+ { label: "no tax rate", value: null },
+ ...taxRates.map(t => ({ label: t, value: t }))
+ ]}
+ hint={i18n.t("Optional")}
+ label={i18n.t("Tax rate")}
+ name="taxRate"
+ onChange={onChange}
+ value={data.taxRate}
+ />
+ </CardContent>
+ </Card>
);
ProductTypeProperties.displayName = "ProductTypeProperties";
export default ProductTypeProperties;
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
index 16bdabec62..7b6593ca9f 100644
--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
@@ -105,7 +105,6 @@ export const ProductCreatePage = decorate<ProductCreatePageProps>(
header,
productTypes,
saveButtonBarState,
- onAttributesEdit,
onBack,
onSubmit
}) => {
diff --git a/saleor/static/dashboard-next/products/components/ProductImageNavigation/ProductImageNavigation.tsx b/saleor/static/dashboard-next/products/components/ProductImageNavigation/ProductImageNavigation.tsx
index 4bc6c1480d..81a0c8bc26 100644
--- a/saleor/static/dashboard-next/products/components/ProductImageNavigation/ProductImageNavigation.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImageNavigation/ProductImageNavigation.tsx
@@ -50,7 +50,7 @@ const decorate = withStyles(theme => ({
toolbar: { marginTop: -theme.spacing.unit / 2 }
}));
const ProductImageNavigation = decorate<ProductImageNavigationProps>(
- ({ classes, disabled, highlighted, images, onRowClick }) => (
+ ({ classes, highlighted, images, onRowClick }) => (
<Card className={classes.card}>
<CardTitle title={i18n.t("All photos")} />
<CardContent>
diff --git a/saleor/static/dashboard-next/products/components/ProductImages/ProductImages.tsx b/saleor/static/dashboard-next/products/components/ProductImages/ProductImages.tsx
index d695cc8b96..cadd8830e6 100644
--- a/saleor/static/dashboard-next/products/components/ProductImages/ProductImages.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductImages/ProductImages.tsx
@@ -206,7 +206,7 @@ const ProductImages = decorate<ProductImagesProps>(
toolbar={
<>
<Button
- onClick={e => this.upload.click()}
+ onClick={() => this.upload.click()}
disabled={loading}
variant="flat"
color="secondary"
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index 28f339a3ea..f6e0835535 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -9,7 +9,6 @@ import PageHeader from "../../../components/PageHeader";
import SaveButtonBar, {
SaveButtonBarState
} from "../../../components/SaveButtonBar";
-import Toggle from "../../../components/Toggle";
import i18n from "../../../i18n";
import ProductVariantAttributes from "../ProductVariantAttributes";
import ProductVariantNavigation from "../ProductVariantNavigation";
@@ -113,87 +112,81 @@ const ProductVariantCreatePage = decorate<ProductVariantCreatePageProps>(
stock: 0
};
return (
- <Toggle>
- {(isImageSelectModalActive, { toggle: toggleImageSelectModal }) => (
- <Container width="md">
- <PageHeader title={header} onBack={onBack} />
- <Form
- initial={initialForm}
- errors={formErrors}
- onSubmit={onSubmit}
- key={product ? JSON.stringify(product) : "noproduct"}
- >
- {({ change, data, errors, hasChanged, submit }) => {
- return (
- <>
- <div className={classes.root}>
- <div>
- <ProductVariantNavigation
- variants={
- product &&
- product.variants &&
- product.variants.edges
- ? product.variants.edges.map(edge => edge.node)
- : undefined
- }
- onRowClick={(variantId: string) => {
- if (product && product.variants) {
- return onVariantClick(variantId);
- }
- }}
- />
- </div>
- <div>
- <ProductVariantAttributes
- attributes={
- product &&
- product.productType &&
- product.productType.variantAttributes &&
- product.productType.variantAttributes.edges
- ? product.productType.variantAttributes.edges.map(
- edge => edge.node
- )
- : undefined
- }
- data={data}
- disabled={loading}
- onChange={change}
- />
- <ProductVariantPrice
- errors={errors}
- priceOverride={data.priceOverride}
- // FIXME: currency symbol should be fetched from API
- currencySymbol="USD"
- costPrice={data.costPrice}
- loading={loading}
- onChange={change}
- />
- <ProductVariantStock
- errors={errors}
- sku={data.sku}
- stock={data.stock}
- loading={loading}
- onChange={change}
- />
- </div>
- </div>
- <SaveButtonBar
- disabled={loading || !onSubmit || !hasChanged}
- labels={{
- delete: i18n.t("Remove variant"),
- save: i18n.t("Save variant")
+ <Container width="md">
+ <PageHeader title={header} onBack={onBack} />
+ <Form
+ initial={initialForm}
+ errors={formErrors}
+ onSubmit={onSubmit}
+ key={product ? JSON.stringify(product) : "noproduct"}
+ >
+ {({ change, data, errors, hasChanged, submit }) => {
+ return (
+ <>
+ <div className={classes.root}>
+ <div>
+ <ProductVariantNavigation
+ variants={
+ product && product.variants && product.variants.edges
+ ? product.variants.edges.map(edge => edge.node)
+ : undefined
+ }
+ onRowClick={(variantId: string) => {
+ if (product && product.variants) {
+ return onVariantClick(variantId);
+ }
}}
- state={saveButtonBarState}
- onCancel={onBack}
- onSave={submit}
/>
- </>
- );
- }}
- </Form>
- </Container>
- )}
- </Toggle>
+ </div>
+ <div>
+ <ProductVariantAttributes
+ attributes={
+ product &&
+ product.productType &&
+ product.productType.variantAttributes &&
+ product.productType.variantAttributes.edges
+ ? product.productType.variantAttributes.edges.map(
+ edge => edge.node
+ )
+ : undefined
+ }
+ data={data}
+ disabled={loading}
+ onChange={change}
+ />
+ <ProductVariantPrice
+ errors={errors}
+ priceOverride={data.priceOverride}
+ // FIXME: currency symbol should be fetched from API
+ currencySymbol="USD"
+ costPrice={data.costPrice}
+ loading={loading}
+ onChange={change}
+ />
+ <ProductVariantStock
+ errors={errors}
+ sku={data.sku}
+ stock={data.stock}
+ loading={loading}
+ onChange={change}
+ />
+ </div>
+ </div>
+ <SaveButtonBar
+ disabled={loading || !onSubmit || !hasChanged}
+ labels={{
+ delete: i18n.t("Remove variant"),
+ save: i18n.t("Save variant")
+ }}
+ state={saveButtonBarState}
+ onCancel={onBack}
+ onSave={submit}
+ />
+ </>
+ );
+ }}
+ </Form>
+ </Container>
);
}
);
diff --git a/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx b/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
index b7d52de7b8..971e864f07 100644
--- a/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
@@ -12,7 +12,6 @@ import { TypedProductUpdateMutation } from "../mutations";
interface ProductUpdateProviderProps
extends PartialMutationProviderProps<ProductUpdateMutation> {
- productId: string;
children: PartialMutationProviderRenderProps<
ProductUpdateMutation,
ProductUpdateMutationVariables
@@ -21,7 +20,7 @@ interface ProductUpdateProviderProps
const ProductUpdateProvider: React.StatelessComponent<
ProductUpdateProviderProps
-> = ({ productId, children, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedProductUpdateMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, error, loading }) =>
children({
diff --git a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
index fde734416a..905e690314 100644
--- a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
@@ -58,7 +58,6 @@ const ProductDeleteProvider: React.StatelessComponent<
interface ProductImageCreateProviderProps
extends PartialMutationProviderProps<ProductImageCreateMutation> {
- productId: string;
children: PartialMutationProviderRenderProps<
ProductImageCreateMutation,
ProductImageCreateMutationVariables
@@ -67,7 +66,7 @@ interface ProductImageCreateProviderProps
const ProductImageCreateProvider: React.StatelessComponent<
ProductImageCreateProviderProps
-> = ({ productId, children, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedProductImageCreateMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, error, loading }) =>
children({
@@ -86,12 +85,11 @@ interface ProductImageDeleteProviderProps
ProductImageDeleteMutation,
ProductImageDeleteMutationVariables
>;
- productId: string;
}
const ProductImageDeleteProvider: React.StatelessComponent<
ProductImageDeleteProviderProps
-> = ({ children, productId, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedProductImageDeleteMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, error, loading }) =>
children({
@@ -160,11 +158,7 @@ const ProductUpdateOperations: React.StatelessComponent<
}) => {
const productId = product ? product.id : "";
return (
- <ProductUpdateProvider
- productId={productId}
- onError={onError}
- onSuccess={onUpdate}
- >
+ <ProductUpdateProvider onError={onError} onSuccess={onUpdate}>
{updateProduct => (
<ProductImagesReorderProvider
productId={productId}
@@ -178,7 +172,6 @@ const ProductUpdateOperations: React.StatelessComponent<
>
{reorderProductImages => (
<ProductImageCreateProvider
- productId={productId}
onError={onError}
onSuccess={onImageCreate}
>
@@ -190,7 +183,6 @@ const ProductUpdateOperations: React.StatelessComponent<
>
{deleteProduct => (
<ProductImageDeleteProvider
- productId={productId}
onError={onError}
onSuccess={onImageDelete}
>
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
index 546189bc71..d05e98af9b 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
@@ -11,7 +11,6 @@ import {
import { TypedVariantImageAssignMutation } from "../mutations";
interface VariantImageAssignProviderProps extends PartialMutationProviderProps {
- id: string;
children: PartialMutationProviderRenderProps<
VariantImageAssignMutation,
VariantImageAssignMutationVariables
@@ -20,7 +19,7 @@ interface VariantImageAssignProviderProps extends PartialMutationProviderProps {
const VariantImageAssignProvider: React.StatelessComponent<
VariantImageAssignProviderProps
-> = ({ id, children, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedVariantImageAssignMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, loading, error }) => {
return children({
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
index ae1e6b5031..51bfb92da6 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
@@ -12,7 +12,6 @@ import { TypedVariantImageUnassignMutation } from "../mutations";
interface VariantImageUnassignProviderProps
extends PartialMutationProviderProps {
- id: string;
children: PartialMutationProviderRenderProps<
VariantImageUnassignMutation,
VariantImageUnassignMutationVariables
@@ -21,7 +20,7 @@ interface VariantImageUnassignProviderProps
const VariantImageUnassignProvider: React.StatelessComponent<
VariantImageUnassignProviderProps
-> = ({ id, children, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedVariantImageUnassignMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, loading, error }) => {
return children({
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
index caea89ff72..2dc25dd617 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
@@ -47,15 +47,11 @@ const VariantUpdateOperations: React.StatelessComponent<
VariantDeleteOperationsProps
> = ({ id, children, onError, onDelete, onUpdate }) => {
return (
- <VariantImageAssignProvider id={id}>
+ <VariantImageAssignProvider>
{assignImage => (
- <VariantImageUnassignProvider id={id}>
+ <VariantImageUnassignProvider>
{unassignImage => (
- <VariantUpdateProvider
- id={id}
- onError={onError}
- onSuccess={onUpdate}
- >
+ <VariantUpdateProvider onError={onError} onSuccess={onUpdate}>
{updateVariant => (
<VariantDeleteProvider
id={id}
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
index 26db5a44b5..d84d60d8aa 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
@@ -16,12 +16,11 @@ interface ProductVariantUpdateProviderProps
VariantUpdateMutation,
VariantUpdateMutationVariables
>;
- id: string;
}
const ProductVariantUpdateProvider: React.StatelessComponent<
ProductVariantUpdateProviderProps
-> = ({ id, children, onError, onSuccess }) => (
+> = ({ children, onError, onSuccess }) => (
<TypedVariantUpdateMutation onCompleted={onSuccess} onError={onError}>
{(mutate, { data, error, loading }) => {
return children({
diff --git a/saleor/static/dashboard-next/products/views/ProductCreate.tsx b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
index 9b0864822d..a22b3603d2 100644
--- a/saleor/static/dashboard-next/products/views/ProductCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
@@ -14,9 +14,9 @@ interface ProductUpdateProps {
id: string;
}
-export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
- id
-}) => (
+export const ProductUpdate: React.StatelessComponent<
+ ProductUpdateProps
+> = () => (
<Messages>
{pushMessage => {
return (
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index 6701fe3061..a28c5dbc41 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -37,7 +37,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
variables={{ id }}
fetchPolicy="network-only"
>
- {({ data, loading, error, fetchMore }) => {
+ {({ data, loading, error }) => {
if (error) {
return <ErrorMessageCard message="Something went wrong" />;
}
@@ -121,7 +121,8 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
createProductImage.loading ||
deleteProduct.loading ||
reorderProductImages.loading ||
- updateProduct.loading;
+ updateProduct.loading ||
+ loading;
const formSubmitState = disableFormSave
? "loading"
: "idle";
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
index 3b9ff4d0f7..c8f54e3dec 100644
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
@@ -12,7 +12,7 @@ const callbacks = {
onCustomerDelete: undefined,
onCustomerEdit: undefined,
onEmailClick: undefined,
- onOrderClick: (id: string) => undefined,
+ onOrderClick: () => undefined,
onShippingAddressEdit: undefined
};
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
index 7f9acb30b3..8b36c4063e 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
@@ -25,7 +25,7 @@ const orderWithoutPayment = orderFixture(placeholderImage, {
const callbacks = {
onBack: () => undefined,
onCreate: undefined,
- onCustomerEmailClick: id => undefined,
+ onCustomerEmailClick: () => undefined,
onOrderCancel: undefined,
onOrderLineChange: () => () => () => undefined,
onOrderLineRemove: () => () => undefined,
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherDetails/VoucherDetails.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherDetails/VoucherDetails.tsx
index 2365acaecf..65575fce90 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherDetails/VoucherDetails.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherDetails/VoucherDetails.tsx
@@ -51,7 +51,7 @@ const decorate = withStyles(theme => ({
}
}));
const VoucherDetails = decorate<VoucherDetailsProps>(
- ({ classes, currency, data, disabled, voucher, onChange }) => (
+ ({ classes, currency, data, disabled, onChange }) => (
<Card>
<CardContent>
<TextField
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx
index f3272304c4..1adeacf077 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherProperties/VoucherProperties.tsx
@@ -77,7 +77,6 @@ const VoucherProperties = decorate<VoucherPropertiesProps>(
classes,
data,
disabled,
- categorySearchResults,
fetchCategories,
fetchProducts,
fetchShipping,
diff --git a/tsconfig.json b/tsconfig.json
index 85ad0824b9..9f2ca39c88 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,7 +4,8 @@
"lib": ["es2017", "dom", "esnext"],
"sourceMap": true,
"target": "es5",
- "noUnusedLocals": true
+ "noUnusedLocals": true,
+ "noUnusedParameters": true
},
"include": ["webpack.d.ts"]
}