Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add customer details view
dominik-zeglenb10d68acf213
diff --git a/saleor/static/dashboard-next/customers/index.tsx b/saleor/static/dashboard-next/customers/index.tsxindex 7e03a8c805..23a17641ac 100644--- a/saleor/static/dashboard-next/customers/index.tsx+++ b/saleor/static/dashboard-next/customers/index.tsx@@ -2,7 +2,8 @@ import { parse as parseQs } from "qs";import * as React from "react";import { Route, RouteComponentProps, Switch } from "react-router-dom";-import { customerListUrl } from "./urls";+import { customerListUrl, customerUrl } from "./urls";+import CustomerDetailsViewComponent from "./views/CustomerDetails";import CustomerListViewComponent from "./views/CustomerList";const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({@@ -16,8 +17,18 @@ const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({return <CustomerListViewComponent params={params} />;};+interface CustomerDetailsRouteParams {+ id: string;+}+const CustomerDetailsView: React.StatelessComponent<+ RouteComponentProps<CustomerDetailsRouteParams>+> = ({ match }) => (+ <CustomerDetailsViewComponent id={decodeURIComponent(match.params.id)} />+);+export const CustomerSection: React.StatelessComponent<{}> = () => (<Switch>- <Route path={customerListUrl} component={CustomerListView} />+ <Route exact path={customerListUrl} component={CustomerListView} />+ <Route path={customerUrl(":id")} component={CustomerDetailsView} /></Switch>);diff --git a/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsxnew file mode 100644index 0000000000..0e74d85615--- /dev/null+++ b/saleor/static/dashboard-next/customers/views/CustomerDetails.tsx@@ -0,0 +1,35 @@+import * as React from "react";++import Navigator from "../../components/Navigator";+import CustomerDetailsPage from "../components/CustomerDetailsPage/CustomerDetailsPage";+import { TypedCustomerDetailsQuery } from "../queries";+import { customerListUrl, customerUrl } from "../urls";++interface CustomerDetailsViewProps {+ id: string;+}++export const CustomerDetailsView: React.StatelessComponent<+ CustomerDetailsViewProps+> = ({ id }) => (+ <Navigator>+ {navigate => (+ <TypedCustomerDetailsQuery variables={{ id }}>+ {customerDetails => (+ <CustomerDetailsPage+ customer={customerDetails.data.user}+ disabled={customerDetails.loading}+ onAddressManageClick={() => undefined} // TODO: add address management+ onBack={() => navigate(customerListUrl)}+ onDelete={() => undefined} // TODO: add delete modal+ onRowClick={id => () =>+ navigate(customerUrl(encodeURIComponent(id)))}+ onSubmit={() => undefined} // TODO: add mutations+ onViewAllOrdersClick={() => undefined} // TODO: add filters to order+ />+ )}+ </TypedCustomerDetailsQuery>+ )}+ </Navigator>+);+export default CustomerDetailsView;