Skip to content

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

Separate storybook from views

dominik-zeglen42565197da82
diff --git a/saleor/static/dashboard-next/auth/index.tsx b/saleor/static/dashboard-next/auth/index.tsx
index 64676a39b5..a38347d308 100644
--- a/saleor/static/dashboard-next/auth/index.tsx
+++ b/saleor/static/dashboard-next/auth/index.tsx
@@ -1,7 +1,6 @@
import * as React from "react";
import { User } from "./types/User";
-import Login from "./views/Login";
const TOKEN_STORAGE_KEY = "dashboardAuth";
@@ -29,5 +28,3 @@ export const removeAuthToken = () => {
localStorage.removeItem(TOKEN_STORAGE_KEY);
sessionStorage.removeItem(TOKEN_STORAGE_KEY);
};
-
-export default Login;
diff --git a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
index 7ebb002e78..c851cb06dc 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryCreatePage/CategoryCreatePage.tsx
@@ -1,13 +1,13 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../../";
import { CardSpacer } from "../../../components/CardSpacer";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
+import { UserError } from "../../../types";
import CategoryDetailsForm from "../../components/CategoryDetailsForm";
import SaveButtonBar, {
diff --git a/saleor/static/dashboard-next/categories/components/CategoryProductsCard/CategoryProductsCard.tsx b/saleor/static/dashboard-next/categories/components/CategoryProductsCard/CategoryProductsCard.tsx
index 84cced9f7e..2b827acc51 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryProductsCard/CategoryProductsCard.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryProductsCard/CategoryProductsCard.tsx
@@ -2,10 +2,10 @@ import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import * as React from "react";
-import { PageListProps } from "../../..";
import CardTitle from "../../../components/CardTitle";
import ProductList from "../../../components/ProductList";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import { CategoryDetails_category_products_edges_node } from "../../types/CategoryDetails";
interface CategoryProductsCardProps extends PageListProps {
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index e001e56283..ad9063bf1b 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -1,7 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../../";
import { CardSpacer } from "../../../components/CardSpacer";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
@@ -13,6 +12,7 @@ import SeoForm from "../../../components/SeoForm";
import Tabs, { Tab } from "../../../components/Tab";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
+import { UserError } from "../../../types";
import CategoryDetailsForm from "../../components/CategoryDetailsForm";
import CategoryList from "../../components/CategoryList";
import {
diff --git a/saleor/static/dashboard-next/categories/index.tsx b/saleor/static/dashboard-next/categories/index.tsx
index b0c0b60513..f11750f4da 100644
--- a/saleor/static/dashboard-next/categories/index.tsx
+++ b/saleor/static/dashboard-next/categories/index.tsx
@@ -1,71 +1,71 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import { CategoryCreateView } from "./views/CategoryCreate";
-import CategoryDetailsView, {
- CategoryDetailsQueryParams
-} from "./views/CategoryDetails";
-import CategoryList from "./views/CategoryList";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import { CategoryCreateView } from "./views/CategoryCreate";
+// import CategoryDetailsView, {
+// CategoryDetailsQueryParams
+// } from "./views/CategoryDetails";
+// import CategoryList from "./views/CategoryList";
-interface CategoryDetailsRouteParams {
- id: string;
-}
-const CategoryDetails: React.StatelessComponent<
- RouteComponentProps<CategoryDetailsRouteParams>
-> = ({ location, match }) => {
- const qs = parseQs(location.search.substr(1));
- const params: CategoryDetailsQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return (
- <CategoryDetailsView
- id={decodeURIComponent(match.params.id)}
- params={params}
- />
- );
-};
+// interface CategoryDetailsRouteParams {
+// id: string;
+// }
+// const CategoryDetails: React.StatelessComponent<
+// RouteComponentProps<CategoryDetailsRouteParams>
+// > = ({ location, match }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: CategoryDetailsQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return (
+// <CategoryDetailsView
+// id={decodeURIComponent(match.params.id)}
+// params={params}
+// />
+// );
+// };
-interface CategoryCreateRouteParams {
- id: string;
-}
-const CategoryCreate: React.StatelessComponent<
- RouteComponentProps<CategoryCreateRouteParams>
-> = ({ match }) => {
- return (
- <CategoryCreateView
- parentId={
- match.params.id ? decodeURIComponent(match.params.id) : undefined
- }
- />
- );
-};
+// interface CategoryCreateRouteParams {
+// id: string;
+// }
+// const CategoryCreate: React.StatelessComponent<
+// RouteComponentProps<CategoryCreateRouteParams>
+// > = ({ match }) => {
+// return (
+// <CategoryCreateView
+// parentId={
+// match.params.id ? decodeURIComponent(match.params.id) : undefined
+// }
+// />
+// );
+// };
-const Component = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Categories")} />
- <Switch>
- <Route exact path={match.url} component={CategoryList} />
- <Route exact path={`${match.url}/add/`} component={CategoryCreate} />
- <Route exact path={`${match.url}/:id/add/`} component={CategoryCreate} />
- <Route path={`${match.url}/:id/`} component={CategoryDetails} />
- </Switch>
- </>
-);
+// const Component = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Categories")} />
+// <Switch>
+// <Route exact path={match.url} component={CategoryList} />
+// <Route exact path={`${match.url}/add/`} component={CategoryCreate} />
+// <Route exact path={`${match.url}/:id/add/`} component={CategoryCreate} />
+// <Route path={`${match.url}/:id/`} component={CategoryDetails} />
+// </Switch>
+// </>
+// );
-export const categoryListUrl = "/categories/";
-export const categoryAddUrl = (parentId?: string) => {
- if (parentId) {
- return `/categories/${parentId}/add/`;
- }
- return `/categories/add/`;
-};
-export const categoryUrl = (id?: string) => {
- if (id) {
- return `/categories/${id}/`;
- }
- return "/categories/";
-};
-export default Component;
+// export const categoryListUrl = "/categories/";
+// export const categoryAddUrl = (parentId?: string) => {
+// if (parentId) {
+// return `/categories/${parentId}/add/`;
+// }
+// return `/categories/add/`;
+// };
+// export const categoryUrl = (id?: string) => {
+// if (id) {
+// return `/categories/${id}/`;
+// }
+// return "/categories/";
+// };
+// export default Component;
diff --git a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
index 5fe0dae47a..0ea56cafc9 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionCreatePage/CollectionCreatePage.tsx
@@ -3,7 +3,6 @@ import CardContent from "@material-ui/core/CardContent";
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../..";
import { CardSpacer } from "../../../components/CardSpacer";
import CardTitle from "../../../components/CardTitle";
import { Container } from "../../../components/Container";
@@ -13,6 +12,7 @@ import PageHeader from "../../../components/PageHeader";
import SaveButtonBar from "../../../components/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
+import { UserError } from "../../../types";
import CollectionDetails from "../CollectionDetails/CollectionDetails";
import { CollectionImage } from "../CollectionImage/CollectionImage";
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index f1bd5a1f99..c50f40ea50 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -1,7 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { PageListProps } from "../../..";
import { CardSpacer } from "../../../components/CardSpacer";
import { Container } from "../../../components/Container";
import Form from "../../../components/Form";
@@ -10,6 +9,7 @@ import SaveButtonBar from "../../../components/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
+import { PageListProps } from "../../../types";
import { CollectionDetails_collection } from "../../types/CollectionDetails";
import CollectionDetails from "../CollectionDetails/CollectionDetails";
import { CollectionImage } from "../CollectionImage/CollectionImage";
diff --git a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
index dfa268e98c..f75a0c8b24 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionList/CollectionList.tsx
@@ -8,12 +8,12 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
-import { ListProps } from "../../..";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
+import { ListProps } from "../../../types";
import { CollectionList_collections_edges_node } from "../../types/CollectionList";
interface CollectionListProps extends ListProps {
diff --git a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx
index 3b3e7f819e..77c4bd47d2 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionListPage/CollectionListPage.tsx
@@ -2,10 +2,10 @@ import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import { Container } from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import { CollectionList_collections_edges_node } from "../../types/CollectionList";
import CollectionList from "../CollectionList/CollectionList";
diff --git a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
index 88bd7605bf..2c06f5b4a6 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionProducts/CollectionProducts.tsx
@@ -11,7 +11,6 @@ import TableRow from "@material-ui/core/TableRow";
import DeleteIcon from "@material-ui/icons/Delete";
import * as React from "react";
-import { PageListProps } from "../../..";
import CardTitle from "../../../components/CardTitle";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
@@ -19,6 +18,7 @@ import TableCellAvatar from "../../../components/TableCellAvatar";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
+import { PageListProps } from "../../../types";
import { CollectionDetails_collection } from "../../types/CollectionDetails";
export interface CollectionProductsProps extends PageListProps {
diff --git a/saleor/static/dashboard-next/collections/index.tsx b/saleor/static/dashboard-next/collections/index.tsx
index a276f9f4fc..2d8e422152 100644
--- a/saleor/static/dashboard-next/collections/index.tsx
+++ b/saleor/static/dashboard-next/collections/index.tsx
@@ -1,56 +1,56 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import { collectionAddUrl, collectionListUrl, collectionUrl } from "./urls";
-import CollectionCreate from "./views/CollectionCreate";
-import CollectionDetailsView, {
- CollectionDetailsQueryParams
-} from "./views/CollectionDetails";
-import CollectionListView, {
- CollectionListQueryParams
-} from "./views/CollectionList";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import { collectionAddUrl, collectionListUrl, collectionUrl } from "./urls";
+// import CollectionCreate from "./views/CollectionCreate";
+// import CollectionDetailsView, {
+// CollectionDetailsQueryParams
+// } from "./views/CollectionDetails";
+// import CollectionListView, {
+// CollectionListQueryParams
+// } from "./views/CollectionList";
-const CollectionList: React.StatelessComponent<RouteComponentProps<{}>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: CollectionListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <CollectionListView params={params} />;
-};
+// const CollectionList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: CollectionListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <CollectionListView params={params} />;
+// };
-interface CollectionDetailsRouteProps {
- id: string;
-}
-const CollectionDetails: React.StatelessComponent<
- RouteComponentProps<CollectionDetailsRouteProps>
-> = ({ location, match }) => {
- const qs = parseQs(location.search.substr(1));
- const params: CollectionDetailsQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return (
- <CollectionDetailsView
- id={decodeURIComponent(match.params.id)}
- params={params}
- />
- );
-};
+// interface CollectionDetailsRouteProps {
+// id: string;
+// }
+// const CollectionDetails: React.StatelessComponent<
+// RouteComponentProps<CollectionDetailsRouteProps>
+// > = ({ location, match }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: CollectionDetailsQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return (
+// <CollectionDetailsView
+// id={decodeURIComponent(match.params.id)}
+// params={params}
+// />
+// );
+// };
-const Component = () => (
- <>
- <WindowTitle title={i18n.t("Collections")} />
- <Switch>
- <Route exact path={collectionListUrl} component={CollectionList} />
- <Route exact path={collectionAddUrl} component={CollectionCreate} />
- <Route path={collectionUrl(":id")} component={CollectionDetails} />
- </Switch>
- </>
-);
-export default Component;
+// const Component = () => (
+// <>
+// <WindowTitle title={i18n.t("Collections")} />
+// <Switch>
+// <Route exact path={collectionListUrl} component={CollectionList} />
+// <Route exact path={collectionAddUrl} component={CollectionCreate} />
+// <Route path={collectionUrl(":id")} component={CollectionDetails} />
+// </Switch>
+// </>
+// );
+// export default Component;
diff --git a/saleor/static/dashboard-next/components/Form/Form.tsx b/saleor/static/dashboard-next/components/Form/Form.tsx
index ae27a5dc81..626fd4b4c9 100644
--- a/saleor/static/dashboard-next/components/Form/Form.tsx
+++ b/saleor/static/dashboard-next/components/Form/Form.tsx
@@ -1,5 +1,5 @@
import * as React from "react";
-import { UserError } from "../../";
+import { UserError } from "../../types";
export interface FormProps<T extends {}> {
children:
diff --git a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
index 6b7ad008db..4b3bddaedf 100644
--- a/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
+++ b/saleor/static/dashboard-next/components/ProductList/ProductList.tsx
@@ -7,11 +7,11 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
-import { ListProps } from "../..";
import { CategoryDetails_category_products_edges_node } from "../../categories/types/CategoryDetails";
import TableCellAvatar from "../../components/TableCellAvatar";
import i18n from "../../i18n";
import { renderCollection } from "../../misc";
+import { ListProps } from "../../types";
import Money from "../Money";
import Skeleton from "../Skeleton";
import StatusLabel from "../StatusLabel";
diff --git a/saleor/static/dashboard-next/configuration/index.tsx b/saleor/static/dashboard-next/configuration/index.tsx
index 78434bf9a2..8502816b29 100644
--- a/saleor/static/dashboard-next/configuration/index.tsx
+++ b/saleor/static/dashboard-next/configuration/index.tsx
@@ -11,9 +11,9 @@ import Monetization from "../icons/Monetization";
import Navigation from "../icons/Navigation";
import Pages from "../icons/Pages";
import StoreMall from "../icons/StoreMall";
-import { productTypeListUrl } from "../productTypes";
-import { siteSettingsUrl } from "../siteSettings";
-import { staffListUrl } from "../staff";
+import { productTypeListUrl } from "../productTypes/urls";
+import { siteSettingsUrl } from "../siteSettings/urls";
+import { staffListUrl } from "../staff/urls";
import { PermissionEnum } from "../types/globalTypes";
import ConfigurationPage, { MenuItem } from "./ConfigurationPage";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
index 902733d19e..bad4e81cfc 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerCreatePage/CustomerCreatePage.tsx
@@ -1,7 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../..";
import { CardSpacer } from "../../../components/CardSpacer";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
@@ -10,6 +9,7 @@ import SaveButtonBar, {
SaveButtonBarState
} from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
+import { UserError } from "../../../types";
import { AddressTypeInput } from "../../types";
import { CustomerCreateData_shop_countries } from "../../types/CustomerCreateData";
import CustomerCreateAddress from "../CustomerCreateAddress/CustomerCreateAddress";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index 22752375af..6ffcd57410 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -1,7 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../..";
import { CardSpacer } from "../../../components/CardSpacer";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
@@ -10,6 +9,7 @@ import SaveButtonBar, {
SaveButtonBarState
} from "../../../components/SaveButtonBar";
import { maybe } from "../../../misc";
+import { UserError } from "../../../types";
import { CustomerDetails_user } from "../../types/CustomerDetails";
import CustomerAddresses from "../CustomerAddresses/CustomerAddresses";
import CustomerDetails from "../CustomerDetails/CustomerDetails";
diff --git a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
index d1855e1170..31da85da99 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerList/CustomerList.tsx
@@ -8,11 +8,11 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
-import { ListProps } from "../../..";
import Skeleton from "../../../components/Skeleton";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection } from "../../../misc";
+import { ListProps } from "../../../types";
import { ListCustomers_customers_edges_node } from "../../types/ListCustomers";
export interface CustomerListProps extends ListProps {
diff --git a/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx
index 80e82da129..45b734499c 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerListPage/CustomerListPage.tsx
@@ -2,10 +2,10 @@ import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import { ListCustomers_customers_edges_node } from "../../types/ListCustomers";
import CustomerList from "../CustomerList/CustomerList";
diff --git a/saleor/static/dashboard-next/customers/index.tsx b/saleor/static/dashboard-next/customers/index.tsx
index 530ee95ee4..5da076224a 100644
--- a/saleor/static/dashboard-next/customers/index.tsx
+++ b/saleor/static/dashboard-next/customers/index.tsx
@@ -1,43 +1,43 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import { customerAddUrl, customerListUrl, customerUrl } from "./urls";
-import CustomerCreateView from "./views/CustomerCreate";
-import CustomerDetailsViewComponent from "./views/CustomerDetails";
-import CustomerListViewComponent, {
- CustomerListQueryParams
-} from "./views/CustomerList";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import { customerAddUrl, customerListUrl, customerUrl } from "./urls";
+// import CustomerCreateView from "./views/CustomerCreate";
+// import CustomerDetailsViewComponent from "./views/CustomerDetails";
+// import CustomerListViewComponent, {
+// CustomerListQueryParams
+// } from "./views/CustomerList";
-const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: CustomerListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <CustomerListViewComponent params={params} />;
-};
+// const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: CustomerListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <CustomerListViewComponent params={params} />;
+// };
-interface CustomerDetailsRouteParams {
- id: string;
-}
-const CustomerDetailsView: React.StatelessComponent<
- RouteComponentProps<CustomerDetailsRouteParams>
-> = ({ match }) => (
- <CustomerDetailsViewComponent id={decodeURIComponent(match.params.id)} />
-);
+// interface CustomerDetailsRouteParams {
+// id: string;
+// }
+// const CustomerDetailsView: React.StatelessComponent<
+// RouteComponentProps<CustomerDetailsRouteParams>
+// > = ({ match }) => (
+// <CustomerDetailsViewComponent id={decodeURIComponent(match.params.id)} />
+// );
-export const CustomerSection: React.StatelessComponent<{}> = () => (
- <>
- <WindowTitle title={i18n.t("Customers")} />
- <Switch>
- <Route exact path={customerListUrl} component={CustomerListView} />
- <Route exact path={customerAddUrl} component={CustomerCreateView} />
- <Route path={customerUrl(":id")} component={CustomerDetailsView} />
- </Switch>
- </>
-);
+// export const CustomerSection: React.StatelessComponent<{}> = () => (
+// <>
+// <WindowTitle title={i18n.t("Customers")} />
+// <Switch>
+// <Route exact path={customerListUrl} component={CustomerListView} />
+// <Route exact path={customerAddUrl} component={CustomerCreateView} />
+// <Route path={customerUrl(":id")} component={CustomerDetailsView} />
+// </Switch>
+// </>
+// );
diff --git a/saleor/static/dashboard-next/fixtures.ts b/saleor/static/dashboard-next/fixtures.ts
index b2d68477cb..ef8ab6255c 100644
--- a/saleor/static/dashboard-next/fixtures.ts
+++ b/saleor/static/dashboard-next/fixtures.ts
@@ -1,4 +1,4 @@
-import { PageListProps } from ".";
+import { PageListProps } from "./types";
const pageInfo = {
hasNextPage: true,
diff --git a/saleor/static/dashboard-next/home/index.tsx b/saleor/static/dashboard-next/home/index.tsx
index e7520f23f5..c67a78a47c 100644
--- a/saleor/static/dashboard-next/home/index.tsx
+++ b/saleor/static/dashboard-next/home/index.tsx
@@ -1,7 +1,7 @@
-import * as React from "react";
+// import * as React from "react";
-import HomePage from "./views";
+// import HomePage from "./views";
-const Component = () => <HomePage />;
+// const Component = () => <HomePage />;
-export default Component;
+// export default Component;
diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsx
index 09727fe1c7..ccbd9afcf4 100644
--- a/saleor/static/dashboard-next/index.tsx
+++ b/saleor/static/dashboard-next/index.tsx
@@ -1,237 +1,237 @@
-import CssBaseline from "@material-ui/core/CssBaseline";
-import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";
-import { defaultDataIdFromObject, InMemoryCache } from "apollo-cache-inmemory";
-import { ApolloClient, ApolloError } from "apollo-client";
-import { setContext } from "apollo-link-context";
-import { ErrorResponse, onError } from "apollo-link-error";
-import { createUploadLink } from "apollo-upload-client";
-import * as React from "react";
-import { ApolloProvider, MutationFn } from "react-apollo";
-import { render } from "react-dom";
-import { BrowserRouter, Route, Switch } from "react-router-dom";
-import * as Cookies from "universal-cookie";
+// import CssBaseline from "@material-ui/core/CssBaseline";
+// import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";
+// import { defaultDataIdFromObject, InMemoryCache } from "apollo-cache-inmemory";
+// import { ApolloClient, ApolloError } from "apollo-client";
+// import { setContext } from "apollo-link-context";
+// import { ErrorResponse, onError } from "apollo-link-error";
+// import { createUploadLink } from "apollo-upload-client";
+// import * as React from "react";
+// import { ApolloProvider, MutationFn } from "react-apollo";
+// import { render } from "react-dom";
+// import { BrowserRouter, Route, Switch } from "react-router-dom";
+// import * as Cookies from "universal-cookie";
-import Auth, { getAuthToken, removeAuthToken } from "./auth";
-import AuthProvider from "./auth/AuthProvider";
-import LoginLoading from "./auth/components/LoginLoading/LoginLoading";
-import SectionRoute from "./auth/components/SectionRoute";
-import { hasPermission } from "./auth/misc";
-import CategorySection from "./categories";
-import CollectionSection from "./collections";
-import { DateProvider } from "./components/DateFormatter";
-import { LocaleProvider } from "./components/Locale";
-import { MessageManager } from "./components/messages";
-import { ShopProvider } from "./components/Shop";
-import { WindowTitle } from "./components/WindowTitle";
-import ConfigurationSection, { configurationMenu } from "./configuration";
-import { CustomerSection } from "./customers";
-import HomePage from "./home";
-import i18n from "./i18n";
-import { NotFound } from "./NotFound";
-import OrdersSection from "./orders";
-import PageSection from "./pages";
-import ProductSection from "./products";
-import ProductTypesSection from "./productTypes";
-import SiteSettingsSection from "./siteSettings";
-import StaffSection from "./staff";
-import theme from "./theme";
-import { PermissionEnum } from "./types/globalTypes";
+// import Auth, { getAuthToken, removeAuthToken } from "./auth";
+// import AuthProvider from "./auth/AuthProvider";
+// import LoginLoading from "./auth/components/LoginLoading/LoginLoading";
+// import SectionRoute from "./auth/components/SectionRoute";
+// import { hasPermission } from "./auth/misc";
+// import CategorySection from "./categories";
+// import CollectionSection from "./collections";
+// import { DateProvider } from "./components/DateFormatter";
+// import { LocaleProvider } from "./components/Locale";
+// import { MessageManager } from "./components/messages";
+// import { ShopProvider } from "./components/Shop";
+// import { WindowTitle } from "./components/WindowTitle";
+// import ConfigurationSection, { configurationMenu } from "./configuration";
+// import { CustomerSection } from "./customers";
+// import HomePage from "./home";
+// import i18n from "./i18n";
+// import { NotFound } from "./NotFound";
+// import OrdersSection from "./orders";
+// import PageSection from "./pages";
+// import ProductSection from "./products";
+// import ProductTypesSection from "./productTypes";
+// import SiteSettingsSection from "./siteSettings";
+// import StaffSection from "./staff";
+// import theme from "./theme";
+// import { PermissionEnum } from "./types/globalTypes";
-const cookies = new Cookies();
+// const cookies = new Cookies();
-interface ResponseError extends ErrorResponse {
- networkError?: Error & {
- statusCode?: number;
- bodyText?: string;
- };
-}
+// interface ResponseError extends ErrorResponse {
+// networkError?: Error & {
+// statusCode?: number;
+// bodyText?: string;
+// };
+// }
-const invalidTokenLink = onError((error: ResponseError) => {
- if (error.networkError && error.networkError.statusCode === 401) {
- removeAuthToken();
- }
-});
+// const invalidTokenLink = onError((error: ResponseError) => {
+// if (error.networkError && error.networkError.statusCode === 401) {
+// removeAuthToken();
+// }
+// });
-const authLink = setContext((_, context) => {
- const authToken = getAuthToken();
- return {
- ...context,
- headers: {
- ...context.headers,
- Authorization: authToken ? `JWT ${authToken}` : null
- }
- };
-});
+// const authLink = setContext((_, context) => {
+// const authToken = getAuthToken();
+// return {
+// ...context,
+// headers: {
+// ...context.headers,
+// Authorization: authToken ? `JWT ${authToken}` : null
+// }
+// };
+// });
-const uploadLink = createUploadLink({
- credentials: "same-origin",
- headers: {
- "X-CSRFToken": cookies.get("csrftoken")
- },
- uri: "/graphql/"
-});
+// const uploadLink = createUploadLink({
+// credentials: "same-origin",
+// headers: {
+// "X-CSRFToken": cookies.get("csrftoken")
+// },
+// uri: "/graphql/"
+// });
-const apolloClient = new ApolloClient({
- cache: new InMemoryCache({
- dataIdFromObject: (obj: any) => {
- // We need to set manually shop's ID, since it is singleton and
- // API does not return its ID
- if (obj.__typename === "Shop") {
- return "shop";
- }
- return defaultDataIdFromObject(obj);
- }
- }),
- link: invalidTokenLink.concat(authLink.concat(uploadLink))
-});
+// const apolloClient = new ApolloClient({
+// cache: new InMemoryCache({
+// dataIdFromObject: (obj: any) => {
+// // We need to set manually shop's ID, since it is singleton and
+// // API does not return its ID
+// if (obj.__typename === "Shop") {
+// return "shop";
+// }
+// return defaultDataIdFromObject(obj);
+// }
+// }),
+// link: invalidTokenLink.concat(authLink.concat(uploadLink))
+// });
-export const appMountPoint = "/dashboard/next/";
+// export const appMountPoint = "/dashboard/next/";
-render(
- <ApolloProvider client={apolloClient}>
- <BrowserRouter basename={appMountPoint}>
- <MuiThemeProvider theme={theme}>
- <DateProvider>
- <LocaleProvider>
- <MessageManager>
- <ShopProvider>
- <CssBaseline />
- <WindowTitle title={i18n.t("Dashboard")} />
- <AuthProvider>
- {({
- hasToken,
- isAuthenticated,
- tokenAuthLoading,
- tokenVerifyLoading,
- user
- }) => {
- return isAuthenticated &&
- !tokenAuthLoading &&
- !tokenVerifyLoading ? (
- <Switch>
- <SectionRoute exact path="/" component={HomePage} />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_PRODUCTS]}
- path="/categories"
- component={CategorySection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_PRODUCTS]}
- path="/collections"
- component={CollectionSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_USERS]}
- path="/customers"
- component={CustomerSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_PAGES]}
- path="/pages"
- component={PageSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_ORDERS]}
- path="/orders"
- component={OrdersSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_PRODUCTS]}
- path="/products"
- component={ProductSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_PRODUCTS]}
- path="/productTypes"
- component={ProductTypesSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_STAFF]}
- path="/staff"
- component={StaffSection}
- />
- <SectionRoute
- permissions={[PermissionEnum.MANAGE_SETTINGS]}
- path="/siteSettings"
- component={SiteSettingsSection}
- />
- {configurationMenu.filter(menuItem =>
- hasPermission(menuItem.permission, user)
- ).length > 0 && (
- <SectionRoute
- exact
- path="/configuration"
- component={ConfigurationSection}
- />
- )}
- <Route component={NotFound} />
- </Switch>
- ) : hasToken && tokenVerifyLoading ? (
- <LoginLoading />
- ) : (
- <Auth loading={tokenAuthLoading} />
- );
- }}
- </AuthProvider>
- </ShopProvider>
- </MessageManager>
- </LocaleProvider>
- </DateProvider>
- </MuiThemeProvider>
- </BrowserRouter>
- </ApolloProvider>,
- document.querySelector("#dashboard-app")
-);
+// render(
+// <ApolloProvider client={apolloClient}>
+// <BrowserRouter basename={appMountPoint}>
+// <MuiThemeProvider theme={theme}>
+// <DateProvider>
+// <LocaleProvider>
+// <MessageManager>
+// <ShopProvider>
+// <CssBaseline />
+// <WindowTitle title={i18n.t("Dashboard")} />
+// <AuthProvider>
+// {({
+// hasToken,
+// isAuthenticated,
+// tokenAuthLoading,
+// tokenVerifyLoading,
+// user
+// }) => {
+// return isAuthenticated &&
+// !tokenAuthLoading &&
+// !tokenVerifyLoading ? (
+// <Switch>
+// <SectionRoute exact path="/" component={HomePage} />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+// path="/categories"
+// component={CategorySection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+// path="/collections"
+// component={CollectionSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_USERS]}
+// path="/customers"
+// component={CustomerSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_PAGES]}
+// path="/pages"
+// component={PageSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_ORDERS]}
+// path="/orders"
+// component={OrdersSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+// path="/products"
+// component={ProductSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+// path="/productTypes"
+// component={ProductTypesSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_STAFF]}
+// path="/staff"
+// component={StaffSection}
+// />
+// <SectionRoute
+// permissions={[PermissionEnum.MANAGE_SETTINGS]}
+// path="/siteSettings"
+// component={SiteSettingsSection}
+// />
+// {configurationMenu.filter(menuItem =>
+// hasPermission(menuItem.permission, user)
+// ).length > 0 && (
+// <SectionRoute
+// exact
+// path="/configuration"
+// component={ConfigurationSection}
+// />
+// )}
+// <Route component={NotFound} />
+// </Switch>
+// ) : hasToken && tokenVerifyLoading ? (
+// <LoginLoading />
+// ) : (
+// <Auth loading={tokenAuthLoading} />
+// );
+// }}
+// </AuthProvider>
+// </ShopProvider>
+// </MessageManager>
+// </LocaleProvider>
+// </DateProvider>
+// </MuiThemeProvider>
+// </BrowserRouter>
+// </ApolloProvider>,
+// document.querySelector("#dashboard-app")
+// );
-export interface ListProps {
- disabled: boolean;
- pageInfo?: {
- hasNextPage: boolean;
- hasPreviousPage: boolean;
- };
- onNextPage: () => void;
- onPreviousPage: () => void;
- onRowClick: (id: string) => () => void;
-}
-export interface PageListProps extends ListProps {
- onAdd: () => void;
-}
+// export interface ListProps {
+// disabled: boolean;
+// pageInfo?: {
+// hasNextPage: boolean;
+// hasPreviousPage: boolean;
+// };
+// onNextPage: () => void;
+// onPreviousPage: () => void;
+// onRowClick: (id: string) => () => void;
+// }
+// export interface PageListProps extends ListProps {
+// onAdd: () => void;
+// }
-export interface UserError {
- field: string;
- message: string;
-}
+// export interface UserError {
+// field: string;
+// message: string;
+// }
-// These interfaces are used in atomic mutation providers, which then are
-// combined into one compound mutation provider
-export interface PartialMutationProviderProps<T extends {} = {}> {
- onSuccess?: (data: T) => void;
- onError?: (error: ApolloError) => void;
-}
-export interface PartialMutationProviderOutput<
- TData extends {} = {},
- TVariables extends {} = {}
-> {
- data: TData;
- loading: boolean;
- mutate: (variables: TVariables) => void;
-}
-export type PartialMutationProviderRenderProps<
- TData extends {} = {},
- TVariables extends {} = {}
-> = (
- props: {
- called?: boolean;
- data: TData;
- loading: boolean;
- error?: ApolloError;
- mutate: MutationFn<TData, TVariables>;
- }
-) => React.ReactElement<any>;
+// // These interfaces are used in atomic mutation providers, which then are
+// // combined into one compound mutation provider
+// export interface PartialMutationProviderProps<T extends {} = {}> {
+// onSuccess?: (data: T) => void;
+// onError?: (error: ApolloError) => void;
+// }
+// export interface PartialMutationProviderOutput<
+// TData extends {} = {},
+// TVariables extends {} = {}
+// > {
+// data: TData;
+// loading: boolean;
+// mutate: (variables: TVariables) => void;
+// }
+// export type PartialMutationProviderRenderProps<
+// TData extends {} = {},
+// TVariables extends {} = {}
+// > = (
+// props: {
+// called?: boolean;
+// data: TData;
+// loading: boolean;
+// error?: ApolloError;
+// mutate: MutationFn<TData, TVariables>;
+// }
+// ) => React.ReactElement<any>;
-export interface MutationProviderProps {
- onError?: (error: ApolloError) => void;
-}
-export type MutationProviderRenderProps<T> = (
- props: T & { errors?: UserError[] }
-) => React.ReactElement<any>;
+// export interface MutationProviderProps {
+// onError?: (error: ApolloError) => void;
+// }
+// export type MutationProviderRenderProps<T> = (
+// props: T & { errors?: UserError[] }
+// ) => React.ReactElement<any>;
diff --git a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
index 847f3c66ff..2a93b4a701 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDetailsPage/OrderDetailsPage.tsx
@@ -3,7 +3,6 @@ import { withStyles, WithStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { UserError } from "../../..";
import ActionDialog from "../../../components/ActionDialog";
import { CardMenu } from "../../../components/CardMenu/CardMenu";
import { CardSpacer } from "../../../components/CardSpacer";
@@ -16,6 +15,7 @@ import Toggle from "../../../components/Toggle";
import { AddressTypeInput } from "../../../customers/types";
import i18n from "../../../i18n";
import { maybe, renderCollection, transformAddressToForm } from "../../../misc";
+import { UserError } from "../../../types";
import { OrderStatus } from "../../../types/globalTypes";
import { OrderDetails_order } from "../../types/OrderDetails";
import OrderAddressEditDialog from "../OrderAddressEditDialog";
diff --git a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
index 95486f8f14..2423346dac 100644
--- a/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderDraftPage/OrderDraftPage.tsx
@@ -3,7 +3,6 @@ import { withStyles, WithStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { UserError } from "../../..";
import ActionDialog from "../../../components/ActionDialog";
import { CardMenu } from "../../../components/CardMenu/CardMenu";
import { Container } from "../../../components/Container";
@@ -15,6 +14,7 @@ import Skeleton from "../../../components/Skeleton";
import { AddressTypeInput } from "../../../customers/types";
import i18n from "../../../i18n";
import { maybe, transformAddressToForm } from "../../../misc";
+import { UserError } from "../../../types";
import { DraftOrderInput } from "../../../types/globalTypes";
import { OrderDetails_order } from "../../types/OrderDetails";
import { UserSearch_customers_edges_node } from "../../types/UserSearch";
diff --git a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
index 0956ba51d0..b301d945eb 100644
--- a/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderList/OrderList.tsx
@@ -8,7 +8,6 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
-import { ListProps } from "../../..";
import DateFormatter from "../../../components/DateFormatter";
import Money from "../../../components/Money";
import Skeleton from "../../../components/Skeleton";
@@ -21,6 +20,7 @@ import {
transformOrderStatus,
transformPaymentStatus
} from "../../../misc";
+import { ListProps } from "../../../types";
import { OrderList_orders_edges_node } from "../../types/OrderList";
interface OrderListProps extends ListProps {
diff --git a/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx b/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx
index 3493db2619..6f867cb7e8 100644
--- a/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderListPage/OrderListPage.tsx
@@ -2,10 +2,10 @@ import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import { OrderList_orders_edges_node } from "../../types/OrderList";
import OrderList from "../OrderList";
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsx
index 53b2d17811..f9aeee2467 100644
--- a/saleor/static/dashboard-next/orders/index.tsx
+++ b/saleor/static/dashboard-next/orders/index.tsx
@@ -1,107 +1,43 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
-
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import { maybe } from "../misc";
-import { OrderStatus, PaymentChargeStatusEnum } from "../types/globalTypes";
-import OrderDetailsComponent from "./views/OrderDetails";
-import OrderListComponent, { OrderListQueryParams } from "./views/OrderList";
-
-const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: OrderListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <OrderListComponent params={params} />;
-};
-
-const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;
-};
-
-const Component = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Orders")} />
- <Switch>
- <Route exact path={match.url} component={OrderList} />
- <Route exact path={`${match.url}/:id/`} component={OrderDetails} />
- </Switch>
- </>
-);
-
-export interface AddressType {
- city: string;
- cityArea: string;
- companyName: string;
- country: {
- code: string;
- country: string;
- };
- countryArea: string;
- firstName: string;
- id: string;
- lastName: string;
- phone: string;
- postalCode: string;
- streetAddress1: string;
- streetAddress2: string;
-}
-
-export const transformPaymentStatus = (status: string) => {
- switch (status) {
- case PaymentChargeStatusEnum.CHARGED:
- return { localized: i18n.t("Paid"), status: "success" };
- case PaymentChargeStatusEnum.FULLY_REFUNDED:
- return { localized: i18n.t("Refunded"), status: "success" };
- default:
- return { localized: i18n.t("Unpaid"), status: "error" };
- }
-};
-
-export const transformOrderStatus = (status: string) => {
- switch (status) {
- case OrderStatus.FULFILLED:
- return { localized: i18n.t("Fulfilled"), status: "success" };
- case OrderStatus.PARTIALLY_FULFILLED:
- return { localized: i18n.t("Partially fulfilled"), status: "neutral" };
- case OrderStatus.UNFULFILLED:
- return { localized: i18n.t("Unfulfilled"), status: "error" };
- case OrderStatus.CANCELED:
- return { localized: i18n.t("Cancelled"), status: "error" };
- case OrderStatus.DRAFT:
- return { localized: i18n.t("Draft"), status: "error" };
- }
- return {
- localized: status,
- status: "error"
- };
-};
-
-export const transformAddressToForm = (data: AddressType) => ({
- city: maybe(() => data.city, ""),
- cityArea: maybe(() => data.cityArea, ""),
- companyName: maybe(() => data.companyName, ""),
- country: maybe(() => data.country.code, ""),
- countryArea: maybe(() => data.countryArea, ""),
- firstName: maybe(() => data.firstName, ""),
- lastName: maybe(() => data.lastName, ""),
- phone: maybe(() => data.phone, ""),
- postalCode: maybe(() => data.postalCode, ""),
- streetAddress1: maybe(() => data.streetAddress1, ""),
- streetAddress2: maybe(() => data.streetAddress2, "")
-});
-
-export const orderListUrl = "/orders/";
-
-export const orderUrl = (id: string) => {
- return `/orders/${id}/`;
-};
-
-export default Component;
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import OrderDetailsComponent from "./views/OrderDetails";
+// import OrderListComponent, { OrderListQueryParams } from "./views/OrderList";
+
+// const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: OrderListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <OrderListComponent params={params} />;
+// };
+
+// const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
+// match
+// }) => {
+// return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;
+// };
+
+// const Component = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Orders")} />
+// <Switch>
+// <Route exact path={match.url} component={OrderList} />
+// <Route exact path={`${match.url}/:id/`} component={OrderDetails} />
+// </Switch>
+// </>
+// );
+
+// export const orderListUrl = "/orders/";
+
+// export const orderUrl = (id: string) => {
+// return `/orders/${id}/`;
+// };
+
+// export default Component;
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index b536df022e..a400028ee0 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -8,12 +8,12 @@ import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
-import { ListProps } from "../../..";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
+import { ListProps } from "../../../types";
interface PageListProps extends ListProps {
pages?: Array<{
diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
index 0e0e3c596b..3eee4cb17f 100644
--- a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx
@@ -2,10 +2,10 @@ import IconButton from "@material-ui/core/IconButton";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import PageList from "../../components/PageList";
interface PageListPageProps extends PageListProps {
diff --git a/saleor/static/dashboard-next/pages/index.tsx b/saleor/static/dashboard-next/pages/index.tsx
index b743fbc3d8..d3764c3986 100644
--- a/saleor/static/dashboard-next/pages/index.tsx
+++ b/saleor/static/dashboard-next/pages/index.tsx
@@ -1,49 +1,49 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import PageCreate from "./views/PageCreate";
-import PageDetailsComponent from "./views/PageDetails";
-import PageListComponent, { PageListQueryParams } from "./views/PageList";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import PageCreate from "./views/PageCreate";
+// import PageDetailsComponent from "./views/PageDetails";
+// import PageListComponent, { PageListQueryParams } from "./views/PageList";
-const PageList: React.StatelessComponent<RouteComponentProps<any>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: PageListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <PageListComponent params={params} />;
-};
-const PageDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return <PageDetailsComponent id={match.params.id} />;
-};
+// const PageList: React.StatelessComponent<RouteComponentProps<any>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: PageListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <PageListComponent params={params} />;
+// };
+// const PageDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
+// match
+// }) => {
+// return <PageDetailsComponent id={match.params.id} />;
+// };
-const Component = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Pages")} />
- <Switch>
- <Route exact path={match.url} component={PageList} />
- <Route exact path={`${match.url}/add/`} component={PageCreate} />
- <Route exact path={`${match.url}/:id/`} component={PageDetails} />
- </Switch>
- </>
-);
+// const Component = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Pages")} />
+// <Switch>
+// <Route exact path={match.url} component={PageList} />
+// <Route exact path={`${match.url}/add/`} component={PageCreate} />
+// <Route exact path={`${match.url}/:id/`} component={PageDetails} />
+// </Switch>
+// </>
+// );
-export function pageEditUrl(id: string) {
- return `/pages/${id}/`;
-}
+// export function pageEditUrl(id: string) {
+// return `/pages/${id}/`;
+// }
-export function pageStorefrontUrl(slug: string) {
- return `/page/${slug}/`;
-}
+// export function pageStorefrontUrl(slug: string) {
+// return `/page/${slug}/`;
+// }
-export const pageListUrl = "/pages/";
-export const pageAddUrl = "/pages/add/";
+// export const pageListUrl = "/pages/";
+// export const pageAddUrl = "/pages/add/";
-export default Component;
+// export default Component;
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
index c325fb97de..6f770ade0c 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeList/ProductTypeList.tsx
@@ -9,11 +9,11 @@ import TableRow from "@material-ui/core/TableRow";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { ListProps } from "../../..";
import Skeleton from "../../../components/Skeleton";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { maybe, renderCollection, translatedTaxRates } from "../../../misc";
+import { ListProps } from "../../../types";
import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList";
interface ProductTypeListProps extends ListProps {
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx
index fe916badd9..ed7c32d1db 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx
@@ -2,10 +2,10 @@ import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList";
import ProductTypeList from "../ProductTypeList";
diff --git a/saleor/static/dashboard-next/productTypes/index.tsx b/saleor/static/dashboard-next/productTypes/index.tsx
index b261549927..817a72b409 100644
--- a/saleor/static/dashboard-next/productTypes/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/index.tsx
@@ -1,50 +1,46 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import ProductTypeCreate from "./views/ProductTypeCreate";
-import ProductTypeListComponent, {
- ProductTypeListQueryParams
-} from "./views/ProductTypeList";
-import ProductTypeUpdateComponent from "./views/ProductTypeUpdate";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import ProductTypeCreate from "./views/ProductTypeCreate";
+// import ProductTypeListComponent, {
+// ProductTypeListQueryParams
+// } from "./views/ProductTypeList";
+// import ProductTypeUpdateComponent from "./views/ProductTypeUpdate";
-export const productTypeAddUrl = "/productTypes/add/";
-export const productTypeDetailsUrl = (id: string) => `/productTypes/${id}/`;
-export const productTypeListUrl = "/productTypes";
+// const ProductTypeList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: ProductTypeListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <ProductTypeListComponent params={params} />;
+// };
-const ProductTypeList: React.StatelessComponent<RouteComponentProps<{}>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: ProductTypeListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <ProductTypeListComponent params={params} />;
-};
+// interface ProductTypeUpdateRouteParams {
+// id: string;
+// }
+// const ProductTypeUpdate: React.StatelessComponent<
+// RouteComponentProps<ProductTypeUpdateRouteParams>
+// > = ({ match }) => (
+// <ProductTypeUpdateComponent id={decodeURIComponent(match.params.id)} />
+// );
-interface ProductTypeUpdateRouteParams {
- id: string;
-}
-const ProductTypeUpdate: React.StatelessComponent<
- RouteComponentProps<ProductTypeUpdateRouteParams>
-> = ({ match }) => (
- <ProductTypeUpdateComponent id={decodeURIComponent(match.params.id)} />
-);
-
-export const ProductTypeRouter: React.StatelessComponent<
- RouteComponentProps<any>
-> = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Product types")} />
- <Switch>
- <Route exact path={match.url} component={ProductTypeList} />
- <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
- <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
- </Switch>
- </>
-);
-ProductTypeRouter.displayName = "ProductTypeRouter";
-export default ProductTypeRouter;
+// export const ProductTypeRouter: React.StatelessComponent<
+// RouteComponentProps<any>
+// > = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Product types")} />
+// <Switch>
+// <Route exact path={match.url} component={ProductTypeList} />
+// <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
+// <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
+// </Switch>
+// </>
+// );
+// ProductTypeRouter.displayName = "ProductTypeRouter";
+// export default ProductTypeRouter;
diff --git a/saleor/static/dashboard-next/productTypes/urls.ts b/saleor/static/dashboard-next/productTypes/urls.ts
new file mode 100644
index 0000000000..fba9f40c59
--- /dev/null
+++ b/saleor/static/dashboard-next/productTypes/urls.ts
@@ -0,0 +1,3 @@
+export const productTypeAddUrl = "/productTypes/add/";
+export const productTypeDetailsUrl = (id: string) => `/productTypes/${id}/`;
+export const productTypeListUrl = "/productTypes";
diff --git a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
index 10cd3eb266..88bb3ff41f 100644
--- a/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductCreatePage/ProductCreatePage.tsx
@@ -1,8 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { AttributeType } from "../../";
-import { UserError } from "../../../";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -11,6 +9,8 @@ import SaveButtonBar, {
} from "../../../components/SaveButtonBar/SaveButtonBar";
import SeoForm from "../../../components/SeoForm";
import i18n from "../../../i18n";
+import { UserError } from "../../../types";
+import { ProductCreateData_productTypes_edges_node_productAttributes } from "../../types/ProductCreateData";
import ProductAvailabilityForm from "../ProductAvailabilityForm";
import ProductDetailsForm from "../ProductDetailsForm";
import ProductOrganization from "../ProductOrganization";
@@ -35,7 +35,7 @@ interface FormData {
hasVariants: boolean;
id: string;
name: string;
- productAttributes: AttributeType[];
+ productAttributes: ProductCreateData_productTypes_edges_node_productAttributes[];
};
};
seoDescription: string;
@@ -59,7 +59,7 @@ interface ProductCreatePageProps {
id: string;
name: string;
hasVariants: boolean;
- productAttributes: AttributeType[];
+ productAttributes: ProductCreateData_productTypes_edges_node_productAttributes[];
}>;
header: string;
saveButtonBarState?: SaveButtonBarState;
@@ -118,7 +118,7 @@ export const ProductCreatePage = decorate<ProductCreatePageProps>(
hasVariants: false,
id: "",
name: "",
- productAttributes: [] as AttributeType[]
+ productAttributes: [] as ProductCreateData_productTypes_edges_node_productAttributes[]
}
},
seoDescription: "",
diff --git a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
index 12675c34f3..96eae555f9 100644
--- a/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductListCard/ProductListCard.tsx
@@ -3,12 +3,12 @@ import Card from "@material-ui/core/Card";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { PageListProps } from "../../..";
import { CategoryDetails_category_products_edges_node } from "../../../categories/types/CategoryDetails";
import Container from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import ProductList from "../../../components/ProductList";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
interface ProductListCardProps extends PageListProps {
products: CategoryDetails_category_products_edges_node[];
diff --git a/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx b/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx
index 2cc474bda0..d02f082c67 100644
--- a/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductOrganization/ProductOrganization.tsx
@@ -4,7 +4,6 @@ import { withStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { AttributeType } from "../..";
import CardTitle from "../../../components/CardTitle";
import { FormSpacer } from "../../../components/FormSpacer";
import MultiSelectField from "../../../components/MultiSelectField";
@@ -13,12 +12,13 @@ import SingleSelectField from "../../../components/SingleSelectField";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
+import { ProductCreateData_productTypes_edges_node_productAttributes } from "../../types/ProductCreateData";
interface ProductType {
hasVariants: boolean;
id: string;
name: string;
- productAttributes: AttributeType[];
+ productAttributes: ProductCreateData_productTypes_edges_node_productAttributes[];
}
interface ProductOrganizationProps {
categories?: Array<{ value: string; label: string }>;
@@ -36,7 +36,7 @@ interface ProductOrganizationProps {
hasVariants: boolean;
id: string;
name: string;
- productAttributes: AttributeType[];
+ productAttributes: ProductCreateData_productTypes_edges_node_productAttributes[];
};
};
};
@@ -142,11 +142,10 @@ const ProductOrganization = decorate<ProductOrganizationProps>(
target: {
...event.target,
name: "attributes",
- value: data.attributes.map(
- a =>
- a.slug === event.target.name
- ? { slug: a.slug, value: event.target.value.value }
- : a
+ value: data.attributes.map(a =>
+ a.slug === event.target.name
+ ? { slug: a.slug, value: event.target.value.value }
+ : a
)
}
});
@@ -165,8 +164,8 @@ const ProductOrganization = decorate<ProductOrganizationProps>(
product.productType.name !== undefined
? [{ label: product.productType.name, value: "1" }]
: productTypes
- ? productTypes.map(pt => ({ label: pt.name, value: pt }))
- : []
+ ? productTypes.map(pt => ({ label: pt.name, value: pt }))
+ : []
}
value={data.productType}
onChange={handleProductTypeSelect}
@@ -186,8 +185,8 @@ const ProductOrganization = decorate<ProductOrganizationProps>(
product.productType.hasVariants !== undefined
? product.productType.hasVariants + ""
: data.productType
- ? data.productType.value.hasVariants + ""
- : false + ""
+ ? data.productType.value.hasVariants + ""
+ : false + ""
}
onChange={onChange}
/>
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index c31be989e1..ce162a111e 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -2,8 +2,6 @@ import DialogContentText from "@material-ui/core/DialogContentText";
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { AttributeType, AttributeValueType, MoneyType } from "../../";
-import { UserError } from "../../../";
import ActionDialog from "../../../components/ActionDialog";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
@@ -14,7 +12,12 @@ import SaveButtonBar, {
import SeoForm from "../../../components/SeoForm";
import Toggle from "../../../components/Toggle";
import i18n from "../../../i18n";
-import { ProductDetails_product_images_edges_node } from "../../types/ProductDetails";
+import { UserError } from "../../../types";
+import {
+ ProductDetails_product,
+ ProductDetails_product_images_edges_node,
+ ProductDetails_product_variants_edges_node_priceOverride
+} from "../../types/ProductDetails";
import ProductAvailabilityForm from "../ProductAvailabilityForm";
import ProductDetailsForm from "../ProductDetailsForm";
import ProductImages from "../ProductImages";
@@ -43,48 +46,12 @@ interface ProductUpdateProps {
id: string;
sku: string;
name: string;
- priceOverride?: MoneyType;
+ priceOverride?: ProductDetails_product_variants_edges_node_priceOverride;
stockQuantity: number;
margin: number;
}>;
images?: ProductDetails_product_images_edges_node[];
- product?: {
- id: string;
- name: string;
- description: string;
- seoTitle?: string;
- seoDescription?: string;
- isFeatured?: boolean;
- chargeTaxes?: boolean;
- productType: {
- id: string;
- name: string;
- hasVariants: boolean;
- };
- category: {
- id: string;
- name: string;
- };
- price: MoneyType;
- availableOn?: string;
- isPublished: boolean;
- attributes: Array<{
- attribute: AttributeType;
- value: AttributeValueType;
- }>;
- availability: {
- available: boolean;
- };
- purchaseCost: {
- start: MoneyType;
- stop: MoneyType;
- };
- margin: {
- start: number;
- stop: number;
- };
- url: string;
- };
+ product?: ProductDetails_product;
header: string;
saveButtonBarState?: SaveButtonBarState;
onVariantShow: (id: string) => () => void;
@@ -169,7 +136,6 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
? productCollections.map(node => node.id)
: [],
description: product.description,
- featured: product.isFeatured,
name: product.name,
price: product.price ? product.price.amount.toString() : undefined,
productType:
@@ -190,14 +156,14 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
product.productType && product.productType.hasVariants
? undefined
: variants && variants[0]
- ? variants[0].sku
- : undefined,
+ ? variants[0].sku
+ : undefined,
stockQuantity:
product.productType && product.productType.hasVariants
? undefined
: variants && variants[0]
- ? variants[0].stockQuantity
- : undefined
+ ? variants[0].stockQuantity
+ : undefined
}
: {
availableOn: "",
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
index 6637c650fd..9077ba80e4 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
@@ -3,15 +3,15 @@ import CardContent from "@material-ui/core/CardContent";
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { AttributeType } from "../..";
import CardTitle from "../../../components/CardTitle";
import { FormSpacer } from "../../../components/FormSpacer";
import SingleAutocompleteSelectField from "../../../components/SingleAutocompleteSelectField";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
+import { ProductVariant_attributes_attribute } from "../../types/ProductVariant";
interface ProductVariantAttributesProps {
- attributes?: AttributeType[];
+ attributes?: ProductVariant_attributes_attribute[];
data: {
attributes?: Array<{
slug: string;
@@ -94,11 +94,10 @@ const ProductVariantAttributes = decorate<ProductVariantAttributesProps>(
target: {
...event.target,
name: "attributes",
- value: data.attributes.map(
- a =>
- a.slug === event.target.name
- ? { slug: a.slug, value: event.target.value.value }
- : a
+ value: data.attributes.map(a =>
+ a.slug === event.target.name
+ ? { slug: a.slug, value: event.target.value.value }
+ : a
)
}
});
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index 5bc622ab40..b870f54c9c 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -1,7 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import { UserError } from "../../..";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -10,6 +9,7 @@ import SaveButtonBar, {
} from "../../../components/SaveButtonBar";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
+import { UserError } from "../../../types";
import { ProductVariantCreateData_product } from "../../types/ProductVariantCreateData";
import ProductVariantAttributes from "../ProductVariantAttributes";
import ProductVariantNavigation from "../ProductVariantNavigation";
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx b/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx
index ac17c0d913..58a9692ff5 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx
@@ -7,8 +7,8 @@ import { withStyles } from "@material-ui/core/styles";
import * as classNames from "classnames";
import * as React from "react";
-import { ProductImageType } from "../..";
import i18n from "../../../i18n";
+import { ProductImage } from "../../types/ProductImage";
const decorate = withStyles(theme => ({
image: {
@@ -45,7 +45,7 @@ const decorate = withStyles(theme => ({
}));
interface ProductVariantImageSelectDialogProps {
- images?: ProductImageType[];
+ images?: ProductImage[];
selectedImages?: string[];
open: boolean;
onClose();
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
index e29364b3cd..8e76038c4a 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx
@@ -5,13 +5,13 @@ import { withStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { ProductImageType } from "../..";
import CardTitle from "../../../components/CardTitle";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
+import { ProductImage } from "../../types/ProductImage";
interface ProductVariantImagesProps {
- images?: ProductImageType[];
+ images?: ProductImage[];
placeholderImage?: string;
disabled: boolean;
onImageAdd();
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
index 2fe3ab308a..1a38c48298 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantPage/ProductVariantPage.tsx
@@ -1,13 +1,6 @@
import { withStyles } from "@material-ui/core/styles";
import * as React from "react";
-import {
- AttributeType,
- AttributeValueType,
- MoneyType,
- ProductImageType
-} from "../../";
-import { UserError } from "../../..";
import Container from "../../../components/Container";
import Form from "../../../components/Form";
import PageHeader from "../../../components/PageHeader";
@@ -15,6 +8,8 @@ import SaveButtonBar, {
SaveButtonBarState
} from "../../../components/SaveButtonBar";
import Toggle from "../../../components/Toggle";
+import { UserError } from "../../../types";
+import { ProductVariant } from "../../types/ProductVariant";
import ProductVariantAttributes from "../ProductVariantAttributes";
import ProductVariantDeleteDialog from "../ProductVariantDeleteDialog";
import ProductVariantImages from "../ProductVariantImages";
@@ -24,46 +19,7 @@ import ProductVariantPrice from "../ProductVariantPrice";
import ProductVariantStock from "../ProductVariantStock";
interface ProductVariantPageProps {
- variant?: {
- id: string;
- attributes: Array<{
- attribute: AttributeType;
- value: AttributeValueType;
- }>;
- costPrice?: MoneyType;
- images: {
- edges: Array<{
- node: {
- id: string;
- };
- }>;
- };
- name: string;
- priceOverride?: MoneyType;
- product: {
- id: string;
- images: {
- edges: Array<{
- node: ProductImageType;
- }>;
- };
- name: string;
- thumbnailUrl: string;
- variants: {
- edges: Array<{
- node: {
- id: string;
- name: string;
- sku: string;
- };
- }>;
- totalCount: number;
- };
- };
- sku: string;
- quantity: number;
- quantityAllocated: number;
- };
+ variant?: ProductVariant;
errors: UserError[];
saveButtonBarState?: SaveButtonBarState;
loading?: boolean;
diff --git a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
index 705a8d082c..bb09f9d724 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariants/ProductVariants.tsx
@@ -12,13 +12,13 @@ import Typography from "@material-ui/core/Typography";
import * as classNames from "classnames";
import * as React from "react";
-import { MoneyType } from "../..";
import CardTitle from "../../../components/CardTitle";
import Money from "../../../components/Money";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
+import { ProductVariant_costPrice } from "../../types/ProductVariant";
interface ProductVariantsProps {
disabled?: boolean;
@@ -26,11 +26,11 @@ interface ProductVariantsProps {
id: string;
sku: string;
name: string;
- priceOverride?: MoneyType;
+ priceOverride?: ProductVariant_costPrice;
stockQuantity: number;
margin: number;
}>;
- fallbackPrice?: MoneyType;
+ fallbackPrice?: ProductVariant_costPrice;
onAttributesEdit: () => void;
onRowClick: (id: string) => () => void;
onVariantAdd?();
diff --git a/saleor/static/dashboard-next/products/fixtures.ts b/saleor/static/dashboard-next/products/fixtures.ts
index f6100bec54..0fdfb56434 100644
--- a/saleor/static/dashboard-next/products/fixtures.ts
+++ b/saleor/static/dashboard-next/products/fixtures.ts
@@ -1,4 +1,5 @@
import { ProductDetails_product } from "./types/ProductDetails";
+import { ProductVariant } from "./types/ProductVariant";
import { ProductVariantCreateData_product } from "./types/ProductVariantCreateData";
export const product: (
@@ -2233,72 +2234,114 @@ export const products = (placeholderImage: string) => [
}
}
];
-export const variant = (placeholderImage: string) => ({
+export const variant = (placeholderImage: string): ProductVariant => ({
+ __typename: "ProductVariant",
attributes: [
{
+ __typename: "SelectedAttribute",
attribute: {
+ __typename: "Attribute",
id: "pta18161",
name: "Borders",
slug: "Borders",
- sortNumber: 0,
values: [
- { id: "ptav47282", sortNumber: 0, name: "portals", slug: "portals" },
- { id: "ptav17253", sortNumber: 1, name: "Baht", slug: "Baht" }
+ {
+ __typename: "AttributeValue",
+ id: "ptav47282",
+ name: "portals",
+ slug: "portals"
+ },
+ {
+ __typename: "AttributeValue",
+ id: "ptav17253",
+ name: "Baht",
+ slug: "Baht"
+ }
]
},
value: {
+ __typename: "AttributeValue",
id: "ptav47282",
name: "portals",
- slug: "portals",
- sortNumber: 0
+ slug: "portals"
}
},
{
+ __typename: "SelectedAttribute",
attribute: {
+ __typename: "Attribute",
id: "pta22785",
name: "Legacy",
slug: "Legacy",
- sortNumber: 1,
values: [
- { id: "ptav31282", sortNumber: 0, name: "payment", slug: "payment" },
{
+ __typename: "AttributeValue",
+ id: "ptav31282",
+ name: "payment",
+ slug: "payment"
+ },
+ {
+ __typename: "AttributeValue",
id: "ptav14907",
name: "Auto Loan Account",
- slug: "Auto-Loan-Account",
- sortNumber: 1
+ slug: "Auto-Loan-Account"
},
- { id: "ptav27366", sortNumber: 2, name: "Garden", slug: "Garden" },
- { id: "ptav11873", sortNumber: 3, name: "override", slug: "override" }
+ {
+ __typename: "AttributeValue",
+ id: "ptav27366",
+ name: "Garden",
+ slug: "Garden"
+ },
+ {
+ __typename: "AttributeValue",
+ id: "ptav11873",
+ name: "override",
+ slug: "override"
+ }
]
},
value: {
+ __typename: "AttributeValue",
id: "ptav14907",
name: "Auto Loan Account",
- slug: "Auto-Loan-Account",
- sortNumber: 1
+ slug: "Auto-Loan-Account"
}
}
],
+ costPrice:{
+ __typename:"Money",
+ amount: 12,
+ currency: "USD",
+ },
id: "var1",
images: {
+ __typename: "ProductImageCountableConnection",
edges: [
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
id: "img1"
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
id: "img2"
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
id: "img7"
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
id: "img8"
}
}
@@ -2306,16 +2349,20 @@ export const variant = (placeholderImage: string) => ({
},
name: "Extended Hard",
priceOverride: {
+ __typename: "Money",
amount: 100,
- currency: "USD",
- localized: "100 USD"
+ currency: "USD"
},
product: {
+ __typename: "Product",
id: "prod1",
images: {
+ __typename: "ProductImageCountableConnection",
edges: [
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Front",
id: "img1",
sortOrder: 1,
@@ -2323,7 +2370,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Back",
id: "img2",
sortOrder: 4,
@@ -2331,7 +2380,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Right side",
id: "img3",
sortOrder: 2,
@@ -2339,7 +2390,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Left side",
id: "img4",
sortOrder: 3,
@@ -2347,7 +2400,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Paper",
id: "img5",
sortOrder: 0,
@@ -2355,7 +2410,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Hard cover",
id: "img6",
sortOrder: 1,
@@ -2363,7 +2420,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Extended version",
id: "img7",
sortOrder: 0,
@@ -2371,7 +2430,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Cut version",
id: "img8",
sortOrder: 2,
@@ -2379,7 +2440,9 @@ export const variant = (placeholderImage: string) => ({
}
},
{
+ __typename: "ProductImageCountableEdge",
node: {
+ __typename: "ProductImage",
alt: "Soft cover",
id: "img9",
sortOrder: 2,
@@ -2391,31 +2454,92 @@ export const variant = (placeholderImage: string) => ({
name: "Our Awesome Book",
thumbnailUrl: placeholderImage,
variants: {
+ __typename: "ProductVariantCountableConnection",
edges: [
{
+ __typename: "ProductVariantCountableEdge",
node: {
+ __typename: "ProductVariant",
id: "var1",
+ image: {
+ __typename: "ProductImageCountableConnection",
+ edges: [
+ {
+ __typename: "ProductImageCountableEdge",
+ node: {
+ __typename: "ProductImage",
+ id: "23123",
+ url: placeholderImage
+ }
+ }
+ ]
+ },
name: "Extended Hard",
sku: "13-1337"
}
},
{
+ __typename: "ProductVariantCountableEdge",
node: {
+ __typename: "ProductVariant",
id: "var2",
+ image: {
+ __typename: "ProductImageCountableConnection",
+ edges: [
+ {
+ __typename: "ProductImageCountableEdge",
+ node: {
+ __typename: "ProductImage",
+ id: "23123",
+ url: placeholderImage
+ }
+ }
+ ]
+ },
name: "Extended Soft",
sku: "13-1338"
}
},
{
+ __typename: "ProductVariantCountableEdge",
node: {
+ __typename: "ProductVariant",
id: "var3",
+ image: {
+ __typename: "ProductImageCountableConnection",
+ edges: [
+ {
+ __typename: "ProductImageCountableEdge",
+ node: {
+ __typename: "ProductImage",
+ id: "23123",
+ url: placeholderImage
+ }
+ }
+ ]
+ },
name: "Normal Hard",
sku: "13-1339"
}
},
{
+ __typename: "ProductVariantCountableEdge",
node: {
+ __typename: "ProductVariant",
id: "var4",
+ image: {
+ __typename: "ProductImageCountableConnection",
+ edges: [
+ {
+ __typename: "ProductImageCountableEdge",
+ node: {
+ __typename: "ProductImage",
+ id: "23123",
+ url: placeholderImage
+ }
+ }
+ ]
+ },
name: "Normal Soft",
sku: "13-1340"
}
@@ -2427,9 +2551,7 @@ export const variant = (placeholderImage: string) => ({
quantity: 19,
quantityAllocated: 12,
sku: "1230959124123",
- stock: 49,
- stockAllocated: 12,
- stockQuantity: 1
+
});
export const variantImages = (placeholderImage: string) =>
variant(placeholderImage).images.edges.map(edge => edge.node);
diff --git a/saleor/static/dashboard-next/products/index.tsx b/saleor/static/dashboard-next/products/index.tsx
index 6e1b2d8d06..7e21baef1e 100644
--- a/saleor/static/dashboard-next/products/index.tsx
+++ b/saleor/static/dashboard-next/products/index.tsx
@@ -1,135 +1,135 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
-
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import ProductCreate from "./views/ProductCreate";
-import ProductImageComponent from "./views/ProductImage";
-import ProductListComponent, {
- ProductListQueryParams
-} from "./views/ProductList";
-import ProductUpdateComponent from "./views/ProductUpdate";
-import ProductVariantComponent from "./views/ProductVariant";
-import ProductVariantCreateComponent from "./views/ProductVariantCreate";
-
-const ProductList: React.StatelessComponent<RouteComponentProps<any>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: ProductListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <ProductListComponent params={params} />;
-};
-
-const ProductUpdate: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return <ProductUpdateComponent id={decodeURIComponent(match.params.id)} />;
-};
-
-const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return (
- <ProductVariantComponent
- variantId={decodeURIComponent(match.params.variantId)}
- productId={decodeURIComponent(match.params.productId)}
- />
- );
-};
-
-const ProductImage: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return (
- <ProductImageComponent
- imageId={decodeURIComponent(match.params.imageId)}
- productId={decodeURIComponent(match.params.productId)}
- />
- );
-};
-
-const ProductVariantCreate: React.StatelessComponent<
- RouteComponentProps<any>
-> = ({ match }) => {
- return (
- <ProductVariantCreateComponent
- productId={decodeURIComponent(match.params.id)}
- />
- );
-};
-
-const Component = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Products")} />
- <Switch>
- <Route exact path={match.url} component={ProductList} />
- <Route exact path={`${match.url}/add/`} component={ProductCreate} />
- <Route exact path={`${match.url}/:id/`} component={ProductUpdate} />
- <Route
- exact
- path={`${match.url}/:id/variant/add/`}
- component={ProductVariantCreate}
- />
- <Route
- exact
- path={`${match.url}/:productId/variant/:variantId/`}
- component={ProductVariant}
- />
- <Route
- exact
- path={`${match.url}/:productId/image/:imageId/`}
- component={ProductImage}
- />
- </Switch>
- </>
-);
-
-export const productUrl = (id: string) => {
- return `/products/${id}/`;
-};
-
-export const productVariantAddUrl = (productId: string) => {
- return `/products/${productId}/variant/add/`;
-};
-
-export const productVariantEditUrl = (productId: string, variantId: string) => {
- return `/products/${productId}/variant/${variantId}/`;
-};
-
-export const productImageUrl = (productId: string, imageId: string) =>
- `/products/${productId}/image/${imageId}/`;
-
-export const productListUrl = "/products/";
-export const productAddUrl = "/products/add/";
-
-export interface AttributeType {
- id: string;
- name: string;
- slug: string;
- values?: Array<{
- name: string;
- slug: string;
- }>;
-}
-
-export interface AttributeValueType {
- name: string;
- slug: string;
-}
-
-export interface MoneyType {
- amount: number;
- currency: string;
-}
-
-export interface ProductImageType {
- id: string;
- sortOrder: number;
- url: string;
-}
-
-export default Component;
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import ProductCreate from "./views/ProductCreate";
+// import ProductImageComponent from "./views/ProductImage";
+// import ProductListComponent, {
+// ProductListQueryParams
+// } from "./views/ProductList";
+// import ProductUpdateComponent from "./views/ProductUpdate";
+// import ProductVariantComponent from "./views/ProductVariant";
+// import ProductVariantCreateComponent from "./views/ProductVariantCreate";
+
+// const ProductList: React.StatelessComponent<RouteComponentProps<any>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: ProductListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <ProductListComponent params={params} />;
+// };
+
+// const ProductUpdate: React.StatelessComponent<RouteComponentProps<any>> = ({
+// match
+// }) => {
+// return <ProductUpdateComponent id={decodeURIComponent(match.params.id)} />;
+// };
+
+// const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({
+// match
+// }) => {
+// return (
+// <ProductVariantComponent
+// variantId={decodeURIComponent(match.params.variantId)}
+// productId={decodeURIComponent(match.params.productId)}
+// />
+// );
+// };
+
+// const ProductImage: React.StatelessComponent<RouteComponentProps<any>> = ({
+// match
+// }) => {
+// return (
+// <ProductImageComponent
+// imageId={decodeURIComponent(match.params.imageId)}
+// productId={decodeURIComponent(match.params.productId)}
+// />
+// );
+// };
+
+// const ProductVariantCreate: React.StatelessComponent<
+// RouteComponentProps<any>
+// > = ({ match }) => {
+// return (
+// <ProductVariantCreateComponent
+// productId={decodeURIComponent(match.params.id)}
+// />
+// );
+// };
+
+// const Component = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Products")} />
+// <Switch>
+// <Route exact path={match.url} component={ProductList} />
+// <Route exact path={`${match.url}/add/`} component={ProductCreate} />
+// <Route exact path={`${match.url}/:id/`} component={ProductUpdate} />
+// <Route
+// exact
+// path={`${match.url}/:id/variant/add/`}
+// component={ProductVariantCreate}
+// />
+// <Route
+// exact
+// path={`${match.url}/:productId/variant/:variantId/`}
+// component={ProductVariant}
+// />
+// <Route
+// exact
+// path={`${match.url}/:productId/image/:imageId/`}
+// component={ProductImage}
+// />
+// </Switch>
+// </>
+// );
+
+// export const productUrl = (id: string) => {
+// return `/products/${id}/`;
+// };
+
+// export const productVariantAddUrl = (productId: string) => {
+// return `/products/${productId}/variant/add/`;
+// };
+
+// export const productVariantEditUrl = (productId: string, variantId: string) => {
+// return `/products/${productId}/variant/${variantId}/`;
+// };
+
+// export const productImageUrl = (productId: string, imageId: string) =>
+// `/products/${productId}/image/${imageId}/`;
+
+// export const productListUrl = "/products/";
+// export const productAddUrl = "/products/add/";
+
+// export interface AttributeType {
+// id: string;
+// name: string;
+// slug: string;
+// values?: Array<{
+// name: string;
+// slug: string;
+// }>;
+// }
+
+// export interface AttributeValueType {
+// name: string;
+// slug: string;
+// }
+
+// export interface MoneyType {
+// amount: number;
+// currency: string;
+// }
+
+// export interface ProductImageType {
+// id: string;
+// sortOrder: number;
+// url: string;
+// }
+
+// export default Component;
diff --git a/saleor/static/dashboard-next/siteSettings/index.tsx b/saleor/static/dashboard-next/siteSettings/index.tsx
index d3b45f90f2..0b551ef343 100644
--- a/saleor/static/dashboard-next/siteSettings/index.tsx
+++ b/saleor/static/dashboard-next/siteSettings/index.tsx
@@ -1,11 +1,9 @@
-import * as React from "react";
-import { Route, RouteComponentProps } from "react-router-dom";
+// import * as React from "react";
+// import { Route, RouteComponentProps } from "react-router-dom";
-import SiteSettings from "./views/";
+// import SiteSettings from "./views/";
-export const siteSettingsUrl = "/siteSettings";
-
-export const SiteSettingsSection: React.StatelessComponent<
- RouteComponentProps<{}>
-> = ({ match }) => <Route path={match.url} component={SiteSettings} />;
-export default SiteSettingsSection;
+// export const SiteSettingsSection: React.StatelessComponent<
+// RouteComponentProps<{}>
+// > = ({ match }) => <Route path={match.url} component={SiteSettings} />;
+// export default SiteSettingsSection;
diff --git a/saleor/static/dashboard-next/siteSettings/urls.ts b/saleor/static/dashboard-next/siteSettings/urls.ts
new file mode 100644
index 0000000000..a3bee06967
--- /dev/null
+++ b/saleor/static/dashboard-next/siteSettings/urls.ts
@@ -0,0 +1 @@
+export const siteSettingsUrl = "/siteSettings";
diff --git a/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx b/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx
index 91b29b86c4..2de9a88d6d 100644
--- a/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffAddMemberDialog/StaffAddMemberDialog.tsx
@@ -8,10 +8,10 @@ import TextField from "@material-ui/core/TextField";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import { UserError } from "../../..";
import { ControlledCheckbox } from "../../../components/ControlledCheckbox";
import Form from "../../../components/Form";
import i18n from "../../../i18n";
+import { UserError } from "../../../types";
export interface FormData {
email: string;
diff --git a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
index 1f6c1e7014..1b8a83e1e5 100644
--- a/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffList/StaffList.tsx
@@ -9,12 +9,12 @@ import TableRow from "@material-ui/core/TableRow";
import * as classNames from "classnames";
import * as React from "react";
-import { ListProps } from "../../..";
import Skeleton from "../../../components/Skeleton";
import StatusLabel from "../../../components/StatusLabel";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
+import { ListProps } from "../../../types";
import { StaffList_staffUsers_edges_node } from "../../types/StaffList";
interface StaffListProps extends ListProps {
diff --git a/saleor/static/dashboard-next/staff/components/StaffListPage/StaffListPage.tsx b/saleor/static/dashboard-next/staff/components/StaffListPage/StaffListPage.tsx
index d9f781106c..1e958c2cb8 100644
--- a/saleor/static/dashboard-next/staff/components/StaffListPage/StaffListPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffListPage/StaffListPage.tsx
@@ -2,11 +2,11 @@ import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
-import { ListProps, UserError } from "../../..";
import { Container } from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import Toggle from "../../../components/Toggle";
import i18n from "../../../i18n";
+import { ListProps, UserError } from "../../../types";
import { StaffList_staffUsers_edges_node } from "../../types/StaffList";
import StaffAddMemberDialog, {
FormData as AddStaffMemberForm
diff --git a/saleor/static/dashboard-next/staff/index.tsx b/saleor/static/dashboard-next/staff/index.tsx
index b84e65c2eb..5abd150bed 100644
--- a/saleor/static/dashboard-next/staff/index.tsx
+++ b/saleor/static/dashboard-next/staff/index.tsx
@@ -1,45 +1,40 @@
-import { parse as parseQs } from "qs";
-import * as React from "react";
-import { Route, RouteComponentProps, Switch } from "react-router-dom";
+// import { parse as parseQs } from "qs";
+// import * as React from "react";
+// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-import { WindowTitle } from "../components/WindowTitle";
-import i18n from "../i18n";
-import StaffDetailsComponent from "./views/StaffDetails";
-import StaffListComponent, { StaffListQueryParams } from "./views/StaffList";
+// import { WindowTitle } from "../components/WindowTitle";
+// import i18n from "../i18n";
+// import StaffDetailsComponent from "./views/StaffDetails";
+// import StaffListComponent, { StaffListQueryParams } from "./views/StaffList";
-const StaffList: React.StatelessComponent<RouteComponentProps<{}>> = ({
- location
-}) => {
- const qs = parseQs(location.search.substr(1));
- const params: StaffListQueryParams = {
- after: qs.after,
- before: qs.before
- };
- return <StaffListComponent params={params} />;
-};
+// const StaffList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+// location
+// }) => {
+// const qs = parseQs(location.search.substr(1));
+// const params: StaffListQueryParams = {
+// after: qs.after,
+// before: qs.before
+// };
+// return <StaffListComponent params={params} />;
+// };
-interface StaffDetailsRouteProps {
- id: string;
-}
-const StaffDetails: React.StatelessComponent<
- RouteComponentProps<StaffDetailsRouteProps>
-> = ({ match }) => (
- <StaffDetailsComponent id={decodeURIComponent(match.params.id)} />
-);
+// interface StaffDetailsRouteProps {
+// id: string;
+// }
+// const StaffDetails: React.StatelessComponent<
+// RouteComponentProps<StaffDetailsRouteProps>
+// > = ({ match }) => (
+// <StaffDetailsComponent id={decodeURIComponent(match.params.id)} />
+// );
-const Component = ({ match }) => (
- <>
- <WindowTitle title={i18n.t("Staff")} />
- <Switch>
- <Route exact path={match.url} component={StaffList} />
- <Route exact path={`${match.url}/:id/`} component={StaffDetails} />
- </Switch>
- </>
-);
+// const Component = ({ match }) => (
+// <>
+// <WindowTitle title={i18n.t("Staff")} />
+// <Switch>
+// <Route exact path={match.url} component={StaffList} />
+// <Route exact path={`${match.url}/:id/`} component={StaffDetails} />
+// </Switch>
+// </>
+// );
-export const staffListUrl = "/staff/";
-export const staffMemberDetailsUrl = (id: string) => {
- return `/staff/${id}/`;
-};
-
-export default Component;
+// export default Component;
diff --git a/saleor/static/dashboard-next/staff/urls.ts b/saleor/static/dashboard-next/staff/urls.ts
new file mode 100644
index 0000000000..ac921d7565
--- /dev/null
+++ b/saleor/static/dashboard-next/staff/urls.ts
@@ -0,0 +1,4 @@
+export const staffListUrl = "/staff/";
+export const staffMemberDetailsUrl = (id: string) => {
+ return `/staff/${id}/`;
+};
diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
index 17353885e3..5a33449d1d 100644
--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
@@ -45162,20 +45162,12 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiTableCell-root-id MuiTableCell-body-id Component-root-id Component-tabActive-id"
>
<div
- class="MuiAvatar-root-id MuiAvatar-colorDefault-id Component-avatar-id"
+ class="MuiAvatar-root-id Component-avatar-id"
>
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id"
- focusable="false"
- viewBox="0 0 24 24"
- >
- <g>
- <path
- d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"
- />
- </g>
- </svg>
+ <img
+ class="MuiAvatar-img-id"
+ src="placeholder60x60.png"
+ />
</div>
</td>
<td
@@ -45191,20 +45183,12 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiTableCell-root-id MuiTableCell-body-id Component-root-id"
>
<div
- class="MuiAvatar-root-id MuiAvatar-colorDefault-id Component-avatar-id"
+ class="MuiAvatar-root-id Component-avatar-id"
>
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id"
- focusable="false"
- viewBox="0 0 24 24"
- >
- <g>
- <path
- d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"
- />
- </g>
- </svg>
+ <img
+ class="MuiAvatar-img-id"
+ src="placeholder60x60.png"
+ />
</div>
</td>
<td
@@ -45220,20 +45204,12 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiTableCell-root-id MuiTableCell-body-id Component-root-id"
>
<div
- class="MuiAvatar-root-id MuiAvatar-colorDefault-id Component-avatar-id"
+ class="MuiAvatar-root-id Component-avatar-id"
>
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id"
- focusable="false"
- viewBox="0 0 24 24"
- >
- <g>
- <path
- d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"
- />
- </g>
- </svg>
+ <img
+ class="MuiAvatar-img-id"
+ src="placeholder60x60.png"
+ />
</div>
</td>
<td
@@ -45249,20 +45225,12 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiTableCell-root-id MuiTableCell-body-id Component-root-id"
>
<div
- class="MuiAvatar-root-id MuiAvatar-colorDefault-id Component-avatar-id"
+ class="MuiAvatar-root-id Component-avatar-id"
>
- <svg
- aria-hidden="true"
- class="MuiSvgIcon-root-id"
- focusable="false"
- viewBox="0 0 24 24"
- >
- <g>
- <path
- d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"
- />
- </g>
- </svg>
+ <img
+ class="MuiAvatar-img-id"
+ src="placeholder60x60.png"
+ />
</div>
</td>
<td
@@ -45541,8 +45509,8 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiFormControl-root-id MuiFormControl-fullWidth-id"
>
<label
- class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id"
- data-shrink="false"
+ class="MuiFormLabel-root-id MuiFormLabel-filled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id"
+ data-shrink="true"
for="costPrice"
>
Cost price override
@@ -45555,7 +45523,7 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
class="MuiInput-input-id MuiInput-inputType-id"
name="costPrice"
type="number"
- value=""
+ value="12"
/>
<div
class="MuiInputAdornment-root-id MuiInputAdornment-positionEnd-id Component-currencySymbol-id"
@@ -45568,7 +45536,7 @@ exports[`Storyshots Views / Products / Product variant details when loaded data
</div>
</div>
<p
- class="MuiFormHelperText-root-id"
+ class="MuiFormHelperText-root-id MuiFormHelperText-filled-id"
>
Optional
</p>
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
index 6de8c0eea0..0f7f98aedd 100644
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
@@ -9,5 +9,7 @@ import { Decorator } from "../../Decorator";
storiesOf("Views / Pages / Page list", module)
.addDecorator(Decorator)
.add("default", () => <PageList pages={pages} {...pageListProps.default} />)
- .add("loading", () => <PageList {...pageListProps.loading} />)
+ .add("loading", () => (
+ <PageList pages={undefined} {...pageListProps.loading} />
+ ))
.add("no data", () => <PageList pages={[]} {...pageListProps.default} />);
diff --git a/saleor/static/dashboard-next/types.ts b/saleor/static/dashboard-next/types.ts
new file mode 100644
index 0000000000..3334a0cdf2
--- /dev/null
+++ b/saleor/static/dashboard-next/types.ts
@@ -0,0 +1,55 @@
+import { ApolloError } from "apollo-client";
+import { MutationFn } from "react-apollo";
+
+export interface UserError {
+ field: string;
+ message: string;
+}
+
+export interface ListProps {
+ disabled: boolean;
+ pageInfo?: {
+ hasNextPage: boolean;
+ hasPreviousPage: boolean;
+ };
+ onNextPage: () => void;
+ onPreviousPage: () => void;
+ onRowClick: (id: string) => () => void;
+}
+export interface PageListProps extends ListProps {
+ onAdd: () => void;
+}
+
+// These interfaces are used in atomic mutation providers, which then are
+// combined into one compound mutation provider
+export interface PartialMutationProviderProps<T extends {} = {}> {
+ onSuccess?: (data: T) => void;
+ onError?: (error: ApolloError) => void;
+}
+export interface PartialMutationProviderOutput<
+ TData extends {} = {},
+ TVariables extends {} = {}
+> {
+ data: TData;
+ loading: boolean;
+ mutate: (variables: TVariables) => void;
+}
+export type PartialMutationProviderRenderProps<
+ TData extends {} = {},
+ TVariables extends {} = {}
+> = (
+ props: {
+ called?: boolean;
+ data: TData;
+ loading: boolean;
+ error?: ApolloError;
+ mutate: MutationFn<TData, TVariables>;
+ }
+) => React.ReactElement<any>;
+
+export interface MutationProviderProps {
+ onError?: (error: ApolloError) => void;
+}
+export type MutationProviderRenderProps<T> = (
+ props: T & { errors?: UserError[] }
+) => React.ReactElement<any>;
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherList/VoucherList.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherList/VoucherList.tsx
index 20873e80a4..76ff391009 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherList/VoucherList.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherList/VoucherList.tsx
@@ -9,7 +9,6 @@ import TableRow from "@material-ui/core/TableRow";
import * as React from "react";
import { createVoucherName, VoucherType } from "../..";
-import { ListProps } from "../../..";
import DateFormatter from "../../../components/DateFormatter";
import Money from "../../../components/Money";
import Percent from "../../../components/Percent";
@@ -17,6 +16,7 @@ import Skeleton from "../../../components/Skeleton";
import TablePagination from "../../../components/TablePagination";
import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
+import { ListProps } from "../../../types";
interface VoucherListProps extends ListProps {
currency?: string;
diff --git a/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx b/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx
index 9b5d10ae35..b20b9c7dc0 100644
--- a/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx
+++ b/saleor/static/dashboard-next/vouchers/components/VoucherListPage/VoucherListPage.tsx
@@ -3,10 +3,10 @@ import AddIcon from "@material-ui/icons/Add";
import * as React from "react";
import { VoucherType } from "../..";
-import { PageListProps } from "../../..";
import { Container } from "../../../components/Container";
import PageHeader from "../../../components/PageHeader";
import i18n from "../../../i18n";
+import { PageListProps } from "../../../types";
import VoucherList from "../VoucherList/VoucherList";
interface VoucherListPageProps extends PageListProps {