Skip to content

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

Fix linter errors, flatten components

Patryk Zawadzki7009e246c196
diff --git a/saleor/static/dashboard-next/js/AppRoot.tsx b/saleor/static/dashboard-next/js/AppRoot.tsx
index 85c948cf48..8967d3d832 100644
--- a/saleor/static/dashboard-next/js/AppRoot.tsx
+++ b/saleor/static/dashboard-next/js/AppRoot.tsx
@@ -1,16 +1,14 @@
-import ChevronLeftIcon from "material-ui-icons/ChevronLeft";
import MenuIcon from "material-ui-icons/Menu";
import AppBar from "material-ui/AppBar";
-import Divider from "material-ui/Divider";
import Drawer from "material-ui/Drawer";
import Hidden from "material-ui/Hidden";
import IconButton from "material-ui/IconButton";
-import List, { ListItem, ListItemProps, ListItemText } from "material-ui/List";
+import List, { ListItem, ListItemText } from "material-ui/List";
import { withStyles, WithStyles } from "material-ui/styles";
import Toolbar from "material-ui/Toolbar";
import Typography from "material-ui/Typography";
import * as React from "react";
-import { Link, LinkProps } from "react-router-dom";
+import { Link } from "react-router-dom";
import i18n from "./i18n";
diff --git a/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx b/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx
index 423d1fcc95..525cd1375f 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx
+++ b/saleor/static/dashboard-next/js/__tests__/components/CategoryList.test.tsx
@@ -2,8 +2,7 @@ import * as React from "react";
import { MemoryRouter } from "react-router-dom";
import * as renderer from "react-test-renderer";
-import CategoryList from "../../category/components/CategoryList";
-import categoryFixture from "./fixtures/category";
+import CategoryList from "../../components/CategoryList";
import categoryListFixture from "./fixtures/categoryList";
describe("<CategoryList />", () => {
diff --git a/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx b/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx
index 4878e7ea00..b0b02f055b 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx
+++ b/saleor/static/dashboard-next/js/__tests__/components/CategoryProperties.test.tsx
@@ -4,7 +4,6 @@ import * as renderer from "react-test-renderer";
import CategoryProperties from "../../category/components/CategoryProperties";
import categoryFixture from "./fixtures/category";
-import categoryListFixture from "./fixtures/categoryList";
describe("<CategoryProperties />", () => {
it("renders while data is loading", () => {
diff --git a/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx b/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx
index ef8c12bde2..85dd677f80 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx
+++ b/saleor/static/dashboard-next/js/__tests__/components/ErrorMessageCard.test.tsx
@@ -1,11 +1,10 @@
import * as React from "react";
-import { MemoryRouter } from "react-router-dom";
import * as renderer from "react-test-renderer";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
+import ErrorMessageCard from "../../components/ErrorMessageCard";
import errorMessageFixture from "./fixtures/errorMessage";
-describe("<ProductChildElement />", () => {
+describe("<ErrorMessageCard />", () => {
it("renders properly", () => {
const component = renderer.create(
<ErrorMessageCard message={errorMessageFixture} />
diff --git a/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx b/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx
index bafe5d11ca..7d5d58cd95 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx
+++ b/saleor/static/dashboard-next/js/__tests__/components/FilterCard.test.tsx
@@ -1,10 +1,9 @@
import * as React from "react";
-import { MemoryRouter } from "react-router-dom";
import * as renderer from "react-test-renderer";
-import FilterCard from "../../components/cards/FilterCard";
+import FilterCard from "../../components/FilterCard";
-describe("<CategoryDetails />", () => {
+describe("<FilterCard />", () => {
it("renders properly", () => {
const component = renderer.create(<FilterCard handleClear={jest.fn()} />);
expect(component).toMatchSnapshot();
diff --git a/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx b/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx
index 25173d4b07..2dd3df7650 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx
+++ b/saleor/static/dashboard-next/js/__tests__/components/ProductList.test.tsx
@@ -2,7 +2,7 @@ import * as React from "react";
import { MemoryRouter } from "react-router-dom";
import * as renderer from "react-test-renderer";
-import ProductList from "../../category/components/ProductList";
+import ProductList from "../../components/ProductList";
import productListFixture from "./fixtures/productList";
describe("<ProductList />", () => {
diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap b/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap
index 2a76c973e6..2c12ca9a67 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap
+++ b/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/ErrorMessageCard.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`<ProductChildElement /> renders properly 1`] = `
+exports[`<ErrorMessageCard /> renders properly 1`] = `
<div
className="MuiPaper-root-1 MuiPaper-elevation2-5 MuiPaper-rounded-2"
>
diff --git a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snap b/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snap
index 7a1eca4ecc..cfb0118f10 100644
--- a/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snap
+++ b/saleor/static/dashboard-next/js/__tests__/components/__snapshots__/FilterCard.test.tsx.snap
@@ -1,27 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`<CategoryDetails /> renders properly 1`] = `
+exports[`<FilterCard /> renders properly 1`] = `
<div
- className="MuiPaper-root-2 MuiPaper-elevation2-6 MuiPaper-rounded-3"
+ className="MuiPaper-root-1 MuiPaper-elevation2-5 MuiPaper-rounded-2"
>
<form>
<div
- className="MuiCardHeader-root-29"
+ className="MuiCardHeader-root-28"
>
<div
- className="MuiCardHeader-content-32"
+ className="MuiCardHeader-content-31"
>
<span
- className="MuiTypography-root-35 MuiTypography-headline-40 MuiCardHeader-title-33"
+ className="MuiTypography-root-34 MuiTypography-headline-39 MuiCardHeader-title-32"
>
Filters
</span>
</div>
<div
- className="MuiCardHeader-action-31"
+ className="MuiCardHeader-action-30"
>
<button
- className="MuiButtonBase-root-65 MuiIconButton-root-59"
+ className="MuiButtonBase-root-64 MuiIconButton-root-58"
disabled={false}
onBlur={[Function]}
onClick={[MockFunction]}
@@ -38,11 +38,11 @@ exports[`<CategoryDetails /> renders properly 1`] = `
type="button"
>
<span
- className="MuiIconButton-label-64"
+ className="MuiIconButton-label-63"
>
<svg
aria-hidden="true"
- className="MuiSvgIcon-root-68"
+ className="MuiSvgIcon-root-67"
color={undefined}
focusable="false"
viewBox="0 0 24 24"
@@ -53,13 +53,13 @@ exports[`<CategoryDetails /> renders properly 1`] = `
</svg>
</span>
<span
- className="MuiTouchRipple-root-74"
+ className="MuiTouchRipple-root-73"
/>
</button>
</div>
</div>
<div
- className="MuiCardContent-root-81"
+ className="MuiCardContent-root-80"
/>
</form>
</div>
diff --git a/saleor/static/dashboard-next/js/category/components/BaseForm.tsx b/saleor/static/dashboard-next/js/category/components/BaseForm.tsx
index 7d19ba181a..33f6e0e638 100644
--- a/saleor/static/dashboard-next/js/category/components/BaseForm.tsx
+++ b/saleor/static/dashboard-next/js/category/components/BaseForm.tsx
@@ -1,8 +1,7 @@
import Button from "material-ui/Button";
-import Card, { CardActions, CardContent } from "material-ui/Card";
+import { CardContent } from "material-ui/Card";
import { withStyles, WithStyles } from "material-ui/styles";
import Toolbar from "material-ui/Toolbar";
-import Typography from "material-ui/Typography";
import * as React from "react";
import TextField from "material-ui/TextField";
diff --git a/saleor/static/dashboard-next/js/category/components/CategoryDeleteDialog.tsx b/saleor/static/dashboard-next/js/category/components/CategoryDeleteDialog.tsx
index df93b1d9cc..b7e5c61983 100644
--- a/saleor/static/dashboard-next/js/category/components/CategoryDeleteDialog.tsx
+++ b/saleor/static/dashboard-next/js/category/components/CategoryDeleteDialog.tsx
@@ -6,7 +6,6 @@ import Dialog, {
DialogTitle
} from "material-ui/Dialog";
import { withStyles } from "material-ui/styles";
-import Typography from "material-ui/Typography";
import * as React from "react";
import i18n from "../../i18n";
diff --git a/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx b/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx
index c8ee068042..68b1656b30 100644
--- a/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx
+++ b/saleor/static/dashboard-next/js/category/components/CategoryProducts.tsx
@@ -6,9 +6,9 @@ import IconButton from "material-ui/IconButton";
import * as React from "react";
import PageHeader from "../../components/PageHeader";
+import ProductList from "../../components/ProductList";
+import { CategoryPropertiesQuery } from "../../gql-types";
import i18n from "../../i18n";
-import ProductList from "../components/ProductList";
-import { CategoryPropertiesQuery } from "../gql-types";
interface CategoryProductsProps {
data: CategoryPropertiesQuery;
diff --git a/saleor/static/dashboard-next/js/category/components/CategoryProperties.tsx b/saleor/static/dashboard-next/js/category/components/CategoryProperties.tsx
index 3bbd441593..5932c6250b 100644
--- a/saleor/static/dashboard-next/js/category/components/CategoryProperties.tsx
+++ b/saleor/static/dashboard-next/js/category/components/CategoryProperties.tsx
@@ -1,15 +1,12 @@
import DeleteIcon from "material-ui-icons/Delete";
import ModeEditIcon from "material-ui-icons/ModeEdit";
-import Button from "material-ui/Button";
-import Card, { CardActions, CardContent, CardHeader } from "material-ui/Card";
+import Card, { CardContent } from "material-ui/Card";
import IconButton from "material-ui/IconButton";
import Typography from "material-ui/Typography";
import * as React from "react";
-import { Link } from "react-router-dom";
import PageHeader from "../../components/PageHeader";
import Skeleton from "../../components/Skeleton";
-import i18n from "../../i18n";
interface CategoryPropertiesProps {
description?: string;
diff --git a/saleor/static/dashboard-next/js/category/components/CategorySubcategories.tsx b/saleor/static/dashboard-next/js/category/components/CategorySubcategories.tsx
index 29359fddf9..470487153b 100644
--- a/saleor/static/dashboard-next/js/category/components/CategorySubcategories.tsx
+++ b/saleor/static/dashboard-next/js/category/components/CategorySubcategories.tsx
@@ -3,10 +3,10 @@ import Card from "material-ui/Card";
import IconButton from "material-ui/IconButton";
import * as React from "react";
+import CategoryList from "../../components/CategoryList";
import PageHeader from "../../components/PageHeader";
+import { CategoryPropertiesQuery } from "../../gql-types";
import i18n from "../../i18n";
-import CategoryList from "../components/CategoryList";
-import { CategoryPropertiesQuery } from "../gql-types";
interface CategorySubcategoriesProps {
data: CategoryPropertiesQuery;
diff --git a/saleor/static/dashboard-next/js/category/components/ProductFilters.tsx b/saleor/static/dashboard-next/js/category/components/ProductFilters.tsx
index 2cd96317da..2dd99c76e2 100644
--- a/saleor/static/dashboard-next/js/category/components/ProductFilters.tsx
+++ b/saleor/static/dashboard-next/js/category/components/ProductFilters.tsx
@@ -1,7 +1,7 @@
import TextField from "material-ui/TextField";
import * as React from "react";
-import FilterCard from "../../components/cards/FilterCard";
+import FilterCard from "../../components/FilterCard";
import FormSpacer from "../../components/FormSpacer";
import MultiSelectField from "../../components/MultiSelectField";
import PriceField from "../../components/PriceField";
@@ -47,7 +47,7 @@ export class ProductFilters extends Component<
}
render() {
- const { handleSubmit, productTypes, handleClear, formState } = this.props;
+ const { handleSubmit, productTypes, handleClear } = this.props;
const publishingStatuses = [
{
label: i18n.t("Published", { context: "Product publishing status" }),
diff --git a/saleor/static/dashboard-next/js/category/components/RootCategoryList.tsx b/saleor/static/dashboard-next/js/category/components/RootCategoryList.tsx
index 3461de2e3c..fa010b5754 100644
--- a/saleor/static/dashboard-next/js/category/components/RootCategoryList.tsx
+++ b/saleor/static/dashboard-next/js/category/components/RootCategoryList.tsx
@@ -3,10 +3,10 @@ import Card from "material-ui/Card";
import IconButton from "material-ui/IconButton";
import * as React from "react";
+import CategoryList from "../../components/CategoryList";
import PageHeader from "../../components/PageHeader";
+import { RootCategoryChildrenQuery } from "../../gql-types";
import i18n from "../../i18n";
-import { RootCategoryChildrenQuery } from "../gql-types";
-import CategoryList from "./CategoryList";
interface RootCategoryListProps {
data: RootCategoryChildrenQuery;
diff --git a/saleor/static/dashboard-next/js/category/gql-types.ts b/saleor/static/dashboard-next/js/category/gql-types.ts
deleted file mode 100644
index 8981c9a071..0000000000
--- a/saleor/static/dashboard-next/js/category/gql-types.ts
+++ /dev/null
@@ -1,156 +0,0 @@
-/* tslint:disable */
-// This file was automatically generated and should not be edited.
-
-export interface CategoryDeleteMutationVariables {
- id: string,
-};
-
-export interface CategoryDeleteMutation {
- categoryDelete: {
- errors: Array< {
- field: string | null,
- message: string | null,
- } | null > | null,
- } | null,
-};
-
-export interface CategoryCreateMutationVariables {
- name: string,
- description?: string | null,
- parentId?: string | null,
-};
-
-export interface CategoryCreateMutation {
- categoryCreate: {
- errors: Array< {
- field: string | null,
- message: string | null,
- } | null > | null,
- category: {
- // The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
- // The ID of the object.
- id: string,
- } | null,
- } | null,
- } | null,
-};
-
-export interface CategoryUpdateMutationVariables {
- id: string,
- name: string,
- description: string,
-};
-
-export interface CategoryUpdateMutation {
- categoryUpdate: {
- errors: Array< {
- field: string | null,
- message: string | null,
- } | null > | null,
- category: {
- // The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
- // The ID of the object.
- id: string,
- } | null,
- } | null,
- } | null,
-};
-
-export interface CategoryDetailsQueryVariables {
- id: string,
-};
-
-export interface CategoryDetailsQuery {
- category: {
- // The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
- // The ID of the object.
- id: string,
- } | null,
- } | null,
-};
-
-export interface RootCategoryChildrenQuery {
- categories: {
- edges: Array< {
- // A cursor for use in pagination
- cursor: string,
- // The item at the end of the edge
- node: {
- // The ID of the object.
- id: string,
- name: string,
- } | null,
- } | null >,
- } | null,
-};
-
-export interface CategoryPropertiesQueryVariables {
- id: string,
- first?: number | null,
- after?: string | null,
- last?: number | null,
- before?: string | null,
-};
-
-export interface CategoryPropertiesQuery {
- category: {
- // The ID of the object.
- id: string,
- name: string,
- description: string,
- parent: {
- // The ID of the object.
- id: string,
- } | null,
- children: {
- edges: Array< {
- // The item at the end of the edge
- node: {
- // The ID of the object.
- id: string,
- name: string,
- } | null,
- } | null >,
- } | null,
- products: {
- totalCount: number | null,
- pageInfo: {
- // When paginating forwards, the cursor to continue.
- endCursor: string | null,
- // When paginating forwards, are there more items?
- hasNextPage: boolean,
- // When paginating backwards, are there more items?
- hasPreviousPage: boolean,
- // When paginating backwards, the cursor to continue.
- startCursor: string | null,
- },
- edges: Array< {
- // A cursor for use in pagination
- cursor: string,
- // The item at the end of the edge
- node: {
- // The ID of the object.
- id: string,
- name: string,
- thumbnailUrl: string | null,
- productType: {
- id: string,
- name: string,
- } | null,
- } | null,
- } | null >,
- } | null,
- } | null,
-};
diff --git a/saleor/static/dashboard-next/js/category/views/CategoryCreateForm.tsx b/saleor/static/dashboard-next/js/category/views/CategoryCreateForm.tsx
index e606c9ab91..4eafe5d1b0 100644
--- a/saleor/static/dashboard-next/js/category/views/CategoryCreateForm.tsx
+++ b/saleor/static/dashboard-next/js/category/views/CategoryCreateForm.tsx
@@ -1,9 +1,7 @@
import Card from "material-ui/Card";
-import Grid from "material-ui/Grid";
import * as React from "react";
import { Redirect } from "react-router-dom";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
import { NavigatorLink } from "../../components/Navigator";
import PageHeader from "../../components/PageHeader";
import i18n from "../../i18n";
diff --git a/saleor/static/dashboard-next/js/category/views/CategoryUpdateForm.tsx b/saleor/static/dashboard-next/js/category/views/CategoryUpdateForm.tsx
index a30704e65d..025d0723e6 100644
--- a/saleor/static/dashboard-next/js/category/views/CategoryUpdateForm.tsx
+++ b/saleor/static/dashboard-next/js/category/views/CategoryUpdateForm.tsx
@@ -1,10 +1,9 @@
import Card from "material-ui/Card";
-import Grid from "material-ui/Grid";
import { CircularProgress } from "material-ui/Progress";
import * as React from "react";
import { Redirect } from "react-router-dom";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
+import ErrorMessageCard from "../../components/ErrorMessageCard";
import { NavigatorLink } from "../../components/Navigator";
import PageHeader from "../../components/PageHeader";
import i18n from "../../i18n";
diff --git a/saleor/static/dashboard-next/js/category/views/details.tsx b/saleor/static/dashboard-next/js/category/views/details.tsx
index a58d1c9725..72c2941335 100644
--- a/saleor/static/dashboard-next/js/category/views/details.tsx
+++ b/saleor/static/dashboard-next/js/category/views/details.tsx
@@ -1,32 +1,21 @@
-import AddIcon from "material-ui-icons/Add";
-import FilterListIcon from "material-ui-icons/FilterList";
-import Card from "material-ui/Card";
import Drawer from "material-ui/Drawer";
import Grid from "material-ui/Grid";
import Hidden from "material-ui/Hidden";
-import IconButton from "material-ui/IconButton";
-import { withStyles, WithStyles } from "material-ui/styles";
+import { withStyles } from "material-ui/styles";
import { stringify as stringifyQs } from "qs";
import * as React from "react";
-import { MutationOptions } from "react-apollo";
-import { Link, Redirect } from "react-router-dom";
+import { Redirect } from "react-router-dom";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
+import ErrorMessageCard from "../../components/ErrorMessageCard";
import Navigator, { NavigatorLink } from "../../components/Navigator";
-import PageHeader from "../../components/PageHeader";
import Toggle from "../../components/Toggle";
-import i18n from "../../i18n";
+import { CategoryPropertiesQuery } from "../../gql-types";
import CategoryDeleteDialog from "../components/CategoryDeleteDialog";
import CategoryProducts from "../components/CategoryProducts";
import CategoryProperties from "../components/CategoryProperties";
import CategorySubcategories from "../components/CategorySubcategories";
import ProductFilters from "../components/ProductFilters";
import RootCategoryList from "../components/RootCategoryList";
-import {
- CategoryDeleteMutation,
- CategoryDeleteMutationVariables,
- CategoryPropertiesQuery
-} from "../gql-types";
import { categoryAddUrl, categoryEditUrl, categoryShowUrl } from "../index";
import {
categoryDeleteMutation,
@@ -39,8 +28,6 @@ import {
TypedRootCategoryChildrenQuery
} from "../queries";
-const { Component } = React;
-
const decorate = withStyles(theme => ({
root: {
display: "grid",
diff --git a/saleor/static/dashboard-next/js/category/components/CategoryList.tsx b/saleor/static/dashboard-next/js/components/CategoryList.tsx
similarity index 79%
rename from saleor/static/dashboard-next/js/category/components/CategoryList.tsx
rename to saleor/static/dashboard-next/js/components/CategoryList.tsx
index 3f2196b5fd..9c8db12148 100644
--- a/saleor/static/dashboard-next/js/category/components/CategoryList.tsx
+++ b/saleor/static/dashboard-next/js/components/CategoryList.tsx
@@ -1,19 +1,15 @@
import Folder from "material-ui-icons/Folder";
-import Button from "material-ui/Button";
-import Grid from "material-ui/Grid";
import List, {
ListItem,
ListItemIcon,
ListItemText,
ListSubheader
} from "material-ui/List";
-import Typography from "material-ui/Typography";
import * as React from "react";
-import { Link } from "react-router-dom";
-import Skeleton from "../../components/Skeleton";
-import { CategoryPropertiesQuery } from "../../gql-types";
-import i18n from "../../i18n";
+import { CategoryPropertiesQuery } from "../gql-types";
+import i18n from "../i18n";
+import Skeleton from "./Skeleton";
interface CategoryListProps {
categories?: CategoryPropertiesQuery["category"]["children"]["edges"];
diff --git a/saleor/static/dashboard-next/js/components/ControlledCheckbox.tsx b/saleor/static/dashboard-next/js/components/ControlledCheckbox.tsx
index 754adcf42a..c083e320ea 100644
--- a/saleor/static/dashboard-next/js/components/ControlledCheckbox.tsx
+++ b/saleor/static/dashboard-next/js/components/ControlledCheckbox.tsx
@@ -1,6 +1,6 @@
-import * as React from "react";
-import { FormControl, FormControlLabel } from "material-ui/Form";
import Checkbox from "material-ui/Checkbox";
+import { FormControlLabel } from "material-ui/Form";
+import * as React from "react";
interface ControlledCheckboxProps {
name: string;
diff --git a/saleor/static/dashboard-next/js/components/cards/ErrorMessageCard.tsx b/saleor/static/dashboard-next/js/components/ErrorMessageCard.tsx
similarity index 94%
rename from saleor/static/dashboard-next/js/components/cards/ErrorMessageCard.tsx
rename to saleor/static/dashboard-next/js/components/ErrorMessageCard.tsx
index 15d628935c..303db7827f 100644
--- a/saleor/static/dashboard-next/js/components/cards/ErrorMessageCard.tsx
+++ b/saleor/static/dashboard-next/js/components/ErrorMessageCard.tsx
@@ -2,7 +2,7 @@ import Card, { CardContent } from "material-ui/Card";
import Typography from "material-ui/Typography";
import * as React from "react";
-import i18n from "../../i18n";
+import i18n from "../i18n";
interface ErrorMessageCardProps {
message: string;
diff --git a/saleor/static/dashboard-next/js/components/FilterCard.tsx b/saleor/static/dashboard-next/js/components/FilterCard.tsx
new file mode 100644
index 0000000000..28d359a92e
--- /dev/null
+++ b/saleor/static/dashboard-next/js/components/FilterCard.tsx
@@ -0,0 +1,31 @@
+import RefreshIcon from "material-ui-icons/Refresh";
+import Card, { CardContent, CardHeader } from "material-ui/Card";
+import IconButton from "material-ui/IconButton";
+import * as React from "react";
+
+import i18n from "../i18n";
+
+export interface FilterCardProps {
+ handleClear();
+}
+
+const FilterCard: React.StatelessComponent<FilterCardProps> = ({
+ children,
+ handleClear
+}) => (
+ <Card>
+ <form>
+ <CardHeader
+ action={
+ <IconButton onClick={handleClear}>
+ <RefreshIcon />
+ </IconButton>
+ }
+ title={i18n.t("Filters")}
+ />
+ <CardContent>{children}</CardContent>
+ </form>
+ </Card>
+);
+
+export default FilterCard;
diff --git a/saleor/static/dashboard-next/js/components/PageHeader.tsx b/saleor/static/dashboard-next/js/components/PageHeader.tsx
index 583c29dbc8..2b5a75f10e 100644
--- a/saleor/static/dashboard-next/js/components/PageHeader.tsx
+++ b/saleor/static/dashboard-next/js/components/PageHeader.tsx
@@ -1,11 +1,9 @@
import ArrowBackIcon from "material-ui-icons/ArrowBack";
import CloseIcon from "material-ui-icons/Close";
-import Divider from "material-ui/Divider";
import IconButton from "material-ui/IconButton";
import { withStyles } from "material-ui/styles";
import Typography from "material-ui/Typography";
import * as React from "react";
-import { Link } from "react-router-dom";
import Skeleton from "./Skeleton";
const decorate = withStyles(theme => ({
diff --git a/saleor/static/dashboard-next/js/components/PriceField.tsx b/saleor/static/dashboard-next/js/components/PriceField.tsx
index 232ce00bfb..f61f1f78f3 100644
--- a/saleor/static/dashboard-next/js/components/PriceField.tsx
+++ b/saleor/static/dashboard-next/js/components/PriceField.tsx
@@ -1,7 +1,6 @@
import { FormControl, FormHelperText } from "material-ui/Form";
import Input, { InputAdornment, InputLabel } from "material-ui/Input";
import { withStyles } from "material-ui/styles";
-import Typography from "material-ui/Typography";
import * as React from "react";
interface PriceFieldProps {
diff --git a/saleor/static/dashboard-next/js/category/components/ProductList.tsx b/saleor/static/dashboard-next/js/components/ProductList.tsx
similarity index 84%
rename from saleor/static/dashboard-next/js/category/components/ProductList.tsx
rename to saleor/static/dashboard-next/js/components/ProductList.tsx
index 4cb7675fbb..49b8ede890 100644
--- a/saleor/static/dashboard-next/js/category/components/ProductList.tsx
+++ b/saleor/static/dashboard-next/js/components/ProductList.tsx
@@ -1,13 +1,5 @@
import Cached from "material-ui-icons/Cached";
-import MoreVert from "material-ui-icons/MoreVert";
import Avatar from "material-ui/Avatar";
-import Button from "material-ui/Button";
-import List, {
- ListItem,
- ListItemAvatar,
- ListItemText,
- ListSubheader
-} from "material-ui/List";
import { withStyles } from "material-ui/styles";
import Table, {
TableBody,
@@ -16,15 +8,12 @@ import Table, {
TableHead,
TableRow
} from "material-ui/Table";
-import Typography from "material-ui/Typography";
import * as React from "react";
-import { Link } from "react-router-dom";
-import { categoryAddUrl } from "../";
-import Skeleton from "../../components/Skeleton";
-import TablePagination from "../../components/TablePagination";
-import i18n from "../../i18n";
import { CategoryPropertiesQuery } from "../gql-types";
+import i18n from "../i18n";
+import Skeleton from "./Skeleton";
+import TablePagination from "./TablePagination";
const decorate = withStyles(theme => ({
avatarCell: {
diff --git a/saleor/static/dashboard-next/js/components/RichTextEditor.tsx b/saleor/static/dashboard-next/js/components/RichTextEditor.tsx
index 4f2b74eae2..3d7d4dc78a 100644
--- a/saleor/static/dashboard-next/js/components/RichTextEditor.tsx
+++ b/saleor/static/dashboard-next/js/components/RichTextEditor.tsx
@@ -1,6 +1,5 @@
import { FormControl, FormHelperText } from "material-ui/Form";
import Input, { InputLabel } from "material-ui/Input";
-import { withStyles } from "material-ui/styles";
import * as React from "react";
interface RichTextEditorProps {
diff --git a/saleor/static/dashboard-next/js/components/SingleSelectField.tsx b/saleor/static/dashboard-next/js/components/SingleSelectField.tsx
index 2592783c35..7095bc32dd 100644
--- a/saleor/static/dashboard-next/js/components/SingleSelectField.tsx
+++ b/saleor/static/dashboard-next/js/components/SingleSelectField.tsx
@@ -1,4 +1,3 @@
-import Chip from "material-ui/Chip";
import { FormControl, FormHelperText } from "material-ui/Form";
import { InputLabel } from "material-ui/Input";
import { MenuItem } from "material-ui/Menu";
diff --git a/saleor/static/dashboard-next/js/components/TablePagination.tsx b/saleor/static/dashboard-next/js/components/TablePagination.tsx
index 66175ec0b9..e87c83edeb 100644
--- a/saleor/static/dashboard-next/js/components/TablePagination.tsx
+++ b/saleor/static/dashboard-next/js/components/TablePagination.tsx
@@ -3,8 +3,6 @@
import { withStyles } from "material-ui/styles";
import { TableCell } from "material-ui/Table";
import Toolbar from "material-ui/Toolbar";
-import Typography from "material-ui/Typography";
-import PropTypes from "prop-types";
import * as React from "react";
import TablePaginationActions from "./TablePaginationActions";
diff --git a/saleor/static/dashboard-next/js/components/TablePaginationActions.tsx b/saleor/static/dashboard-next/js/components/TablePaginationActions.tsx
index 3e49852ea8..03b692a764 100644
--- a/saleor/static/dashboard-next/js/components/TablePaginationActions.tsx
+++ b/saleor/static/dashboard-next/js/components/TablePaginationActions.tsx
@@ -2,11 +2,8 @@ import IconButton from "material-ui/IconButton";
import KeyboardArrowLeft from "material-ui/internal/svg-icons/KeyboardArrowLeft";
import KeyboardArrowRight from "material-ui/internal/svg-icons/KeyboardArrowRight";
import { withStyles } from "material-ui/styles";
-import PropTypes from "prop-types";
import * as React from "react";
-import theme from "../theme";
-
const decorate = withStyles(
theme => ({
root: {
diff --git a/saleor/static/dashboard-next/js/components/cards/FilterCard.tsx b/saleor/static/dashboard-next/js/components/cards/FilterCard.tsx
deleted file mode 100644
index 15e107cc0e..0000000000
--- a/saleor/static/dashboard-next/js/components/cards/FilterCard.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import RefreshIcon from "material-ui-icons/Refresh";
-import Button from "material-ui/Button";
-import Card, { CardActions, CardContent, CardHeader } from "material-ui/Card";
-import IconButton from "material-ui/IconButton";
-import { withStyles } from "material-ui/styles";
-import * as React from "react";
-
-import i18n from "../../i18n";
-
-const decorate = withStyles(theme => ({
- filterCardActions: {
- flexDirection: "row-reverse" as "row-reverse"
- }
-}));
-
-export interface FilterCardProps {
- handleClear();
-}
-
-const FilterCard = decorate<FilterCardProps>(props => {
- const { children, classes, handleClear } = props;
- return (
- <Card>
- <form>
- <CardHeader
- action={
- <IconButton onClick={handleClear}>
- <RefreshIcon />
- </IconButton>
- }
- title={i18n.t("Filters")}
- />
- <CardContent>{children}</CardContent>
- </form>
- </Card>
- );
-});
-
-export default FilterCard;
diff --git a/saleor/static/dashboard-next/js/index.tsx b/saleor/static/dashboard-next/js/index.tsx
index 2aac73f5d8..a4fd1f475b 100644
--- a/saleor/static/dashboard-next/js/index.tsx
+++ b/saleor/static/dashboard-next/js/index.tsx
@@ -13,8 +13,8 @@ import * as Cookies from "universal-cookie";
import AppRoot from "./AppRoot";
import CategorySection from "./category";
-import PageSection from "./page";
import "./i18n";
+import PageSection from "./page";
import theme from "./theme";
const cookies = new Cookies();
diff --git a/saleor/static/dashboard-next/js/page/components/PageBaseForm.tsx b/saleor/static/dashboard-next/js/page/components/PageBaseForm.tsx
index f6dafec060..52d1e7e4ce 100644
--- a/saleor/static/dashboard-next/js/page/components/PageBaseForm.tsx
+++ b/saleor/static/dashboard-next/js/page/components/PageBaseForm.tsx
@@ -1,6 +1,5 @@
import Button from "material-ui/Button";
import { CardContent } from "material-ui/Card";
-import CheckBox from "material-ui/Checkbox";
import Grid from "material-ui/Grid";
import { withStyles, WithStyles } from "material-ui/styles";
import TextField from "material-ui/TextField";
@@ -12,7 +11,6 @@ import ControlledCheckbox from "../../components/ControlledCheckbox";
import FormSpacer from "../../components/FormSpacer";
import RichTextEditor from "../../components/RichTextEditor";
import i18n from "../../i18n";
-import { pageDetailsQuery, TypedPageDetailsQuery } from "../queries";
interface PageUpdateFormComponentState {
availableOn: string;
@@ -74,13 +72,7 @@ export const PageUpdateFormComponent = decorate(
};
render() {
- const {
- classes,
- created,
- errors,
- formInitialValues,
- handleSubmit
- } = this.props;
+ const { classes, created, errors, handleSubmit } = this.props;
const combinedErrors = errors
? (errors.reduce((prev, curr) => {
prev[curr.field] = curr.message;
diff --git a/saleor/static/dashboard-next/js/page/components/PageDeleteDialog.tsx b/saleor/static/dashboard-next/js/page/components/PageDeleteDialog.tsx
index c8ee31cab1..60cfeb7aa3 100644
--- a/saleor/static/dashboard-next/js/page/components/PageDeleteDialog.tsx
+++ b/saleor/static/dashboard-next/js/page/components/PageDeleteDialog.tsx
@@ -5,7 +5,6 @@ import Dialog, {
DialogTitle
} from "material-ui/Dialog";
import { withStyles } from "material-ui/styles";
-import Typography from "material-ui/Typography";
import * as React from "react";
import i18n from "../../i18n";
diff --git a/saleor/static/dashboard-next/js/page/components/PageFilters.tsx b/saleor/static/dashboard-next/js/page/components/PageFilters.tsx
index 38ccbe386e..0f0ba84abb 100644
--- a/saleor/static/dashboard-next/js/page/components/PageFilters.tsx
+++ b/saleor/static/dashboard-next/js/page/components/PageFilters.tsx
@@ -1,7 +1,7 @@
import TextField from "material-ui/TextField";
import * as React from "react";
-import FilterCard from "../../components/cards/FilterCard";
+import FilterCard from "../../components/FilterCard";
import FormSpacer from "../../components/FormSpacer";
import i18n from "../../i18n";
@@ -32,7 +32,7 @@ export class PageFilters extends React.Component<
}
render() {
- const { handleClear, handleSubmit, formState } = this.props;
+ const { handleClear, handleSubmit } = this.props;
const handleInputChange = event => {
const { name, value } = event.target;
const debounceTimeout = setTimeout(() => {
diff --git a/saleor/static/dashboard-next/js/page/views/PageCreateForm.tsx b/saleor/static/dashboard-next/js/page/views/PageCreateForm.tsx
index 141ed5206c..fb0bbbf19a 100644
--- a/saleor/static/dashboard-next/js/page/views/PageCreateForm.tsx
+++ b/saleor/static/dashboard-next/js/page/views/PageCreateForm.tsx
@@ -1,25 +1,12 @@
-import DeleteForeverIcon from "material-ui-icons/DeleteForever";
import Card from "material-ui/Card";
-import Grid from "material-ui/Grid";
-import IconButton from "material-ui/IconButton";
-import { CircularProgress } from "material-ui/Progress";
-import TextField from "material-ui/TextField";
import * as React from "react";
import { Redirect } from "react-router";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
import { NavigatorLink } from "../../components/Navigator";
import PageHeader from "../../components/PageHeader";
-import RichTextEditor from "../../components/RichTextEditor";
import i18n from "../../i18n";
import PageBaseForm from "../components/PageBaseForm";
-import {
- pageCreateMutation,
- pageDeleteMutation,
- TypedPageCreateMutation,
- TypedPageDeleteMutation
-} from "../mutations";
-import { pageDetailsQuery, TypedPageDetailsQuery } from "../queries";
+import { pageCreateMutation, TypedPageCreateMutation } from "../mutations";
interface PageCreateFormProps {
id: string;
diff --git a/saleor/static/dashboard-next/js/page/views/PageList.tsx b/saleor/static/dashboard-next/js/page/views/PageList.tsx
index e932179958..ec80405301 100644
--- a/saleor/static/dashboard-next/js/page/views/PageList.tsx
+++ b/saleor/static/dashboard-next/js/page/views/PageList.tsx
@@ -9,7 +9,7 @@ import { stringify as stringifyQs } from "qs";
import * as React from "react";
import { Link } from "react-router-dom";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
+import ErrorMessageCard from "../../components/ErrorMessageCard";
import Navigator from "../../components/Navigator";
import PageHeader from "../../components/PageHeader";
import i18n from "../../i18n";
diff --git a/saleor/static/dashboard-next/js/page/views/PageUpdateForm.tsx b/saleor/static/dashboard-next/js/page/views/PageUpdateForm.tsx
index 87a1377288..554cfb406b 100644
--- a/saleor/static/dashboard-next/js/page/views/PageUpdateForm.tsx
+++ b/saleor/static/dashboard-next/js/page/views/PageUpdateForm.tsx
@@ -3,15 +3,13 @@ import Card from "material-ui/Card";
import Grid from "material-ui/Grid";
import IconButton from "material-ui/IconButton";
import { CircularProgress } from "material-ui/Progress";
-import TextField from "material-ui/TextField";
import * as React from "react";
import { Redirect } from "react-router";
import { DialogContentText } from "material-ui/Dialog";
-import ErrorMessageCard from "../../components/cards/ErrorMessageCard";
+import ErrorMessageCard from "../../components/ErrorMessageCard";
import { NavigatorLink } from "../../components/Navigator";
import PageHeader from "../../components/PageHeader";
-import RichTextEditor from "../../components/RichTextEditor";
import i18n from "../../i18n";
import PageBaseForm from "../components/PageBaseForm";
import PageDeleteDialog from "../components/PageDeleteDialog";
diff --git a/saleor/static/dashboard-next/js/theme.ts b/saleor/static/dashboard-next/js/theme.ts
index 249e458076..fcd48879f0 100644
--- a/saleor/static/dashboard-next/js/theme.ts
+++ b/saleor/static/dashboard-next/js/theme.ts
@@ -1,4 +1,3 @@
-import grey from "material-ui/colors/grey";
import { createMuiTheme } from "material-ui/styles";
import { darken } from "material-ui/styles/colorManipulator";
@@ -12,7 +11,6 @@ const createShadow = (pv, pb, ps, uv, ub, us, av, ab, as) =>
const primary = "#2bb673";
const secondary = "#03a9f4";
-const transition = "200ms";
export default createMuiTheme({
overrides: {
MuiButton: {
diff --git a/tsconfig.json b/tsconfig.json
index 02bee6d022..d7534b7bf0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -5,6 +5,6 @@
"target": "es5"
},
"include": [
- "saleor/static/dashboard-next/**/*"
+ "saleor/static/dashboard-next/js/index.tsx"
]
}
diff --git a/tslint.json b/tslint.json
index 1d9e42fbd4..5d643084a1 100644
--- a/tslint.json
+++ b/tslint.json
@@ -7,6 +7,7 @@
"interface-name": false,
"member-access": [true, "no-public"],
"no-console": [true, "log"],
+ "no-implicit-dependencies": [true, "dev"],
"no-shadowed-variable": false,
"no-submodule-imports": [true, "material-ui", "material-ui-icons"],
"no-unused-variable": true