From 652fdd8be1e7c529282f76ceb8c474f21d6f6618 Mon Sep 17 00:00:00 2001 From: Timmy Crawford Date: Thu, 14 Jun 2018 13:15:11 -0700 Subject: [PATCH] Add support for different report components, and create revenue report component. --- .../client/analytics/report/example.js | 42 ++++++++++++++ .../client/analytics/report/index.js | 50 +++++++---------- .../client/analytics/report/revenue.js | 55 +++++++++++++++++++ plugins/woocommerce-admin/lib/admin.php | 9 +++ 4 files changed, 126 insertions(+), 30 deletions(-) create mode 100644 plugins/woocommerce-admin/client/analytics/report/example.js create mode 100644 plugins/woocommerce-admin/client/analytics/report/revenue.js diff --git a/plugins/woocommerce-admin/client/analytics/report/example.js b/plugins/woocommerce-admin/client/analytics/report/example.js new file mode 100644 index 00000000000..54e0a2f5568 --- /dev/null +++ b/plugins/woocommerce-admin/client/analytics/report/example.js @@ -0,0 +1,42 @@ +/** @format */ +/** + * External dependencies + */ +import { __ } from '@wordpress/i18n'; +import { Component, Fragment } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import Header from 'components/header'; +import { SummaryList, SummaryNumber } from 'components/summary'; + +export default class extends Component { + render() { + return ( + +
+ + + + + + + + ); + } +} diff --git a/plugins/woocommerce-admin/client/analytics/report/index.js b/plugins/woocommerce-admin/client/analytics/report/index.js index 54e0a2f5568..a9d8cd189a7 100644 --- a/plugins/woocommerce-admin/client/analytics/report/index.js +++ b/plugins/woocommerce-admin/client/analytics/report/index.js @@ -2,41 +2,31 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; -import { Component, Fragment } from '@wordpress/element'; +import { Component } from '@wordpress/element'; +import PropTypes from 'prop-types'; /** * Internal dependencies */ -import Header from 'components/header'; -import { SummaryList, SummaryNumber } from 'components/summary'; +import ExampleReport from './example'; +import RevenueReport from './revenue'; -export default class extends Component { +class Report extends Component { render() { - return ( - -
- - - - - - - - ); + const { params } = this.props; + switch ( params.report ) { + case 'revenue': + return ; + default: + return ; + } } } + +Report.propTypes = { + params: PropTypes.object.isRequired, + path: PropTypes.string.isRequired, + query: PropTypes.object.isRequired, +}; + +export default Report; diff --git a/plugins/woocommerce-admin/client/analytics/report/revenue.js b/plugins/woocommerce-admin/client/analytics/report/revenue.js new file mode 100644 index 00000000000..f1d30246d70 --- /dev/null +++ b/plugins/woocommerce-admin/client/analytics/report/revenue.js @@ -0,0 +1,55 @@ +/** @format */ +/** + * External dependencies + */ +import { __ } from '@wordpress/i18n'; +import { Component, Fragment } from '@wordpress/element'; +import PropTypes from 'prop-types'; + +/** + * Internal dependencies + */ +import DatePicker from 'components/date-picker'; +import Header from 'components/header'; +import { SummaryList, SummaryNumber } from 'components/summary'; + +class RevenueReport extends Component { + render() { + const { path, query } = this.props; + return ( + +
+ + + + + + + + + + ); + } +} + +RevenueReport.propTypes = { + params: PropTypes.object.isRequired, + path: PropTypes.string.isRequired, + query: PropTypes.object.isRequired, +}; + +export default RevenueReport; diff --git a/plugins/woocommerce-admin/lib/admin.php b/plugins/woocommerce-admin/lib/admin.php index c3971874d9f..52ce1dca3a5 100644 --- a/plugins/woocommerce-admin/lib/admin.php +++ b/plugins/woocommerce-admin/lib/admin.php @@ -48,6 +48,15 @@ function woo_dash_register_pages(){ 'woodash#/analytics/test', 'woo_dash_page' ); + + add_submenu_page( + 'woodash#/analytics', + __( 'Revenue', 'woo-dash' ), + __( 'Revenue', 'woo-dash' ), + 'manage_options', + 'woodash#/analytics/revenue', + 'woo_dash_page' + ); } add_action( 'admin_menu', 'woo_dash_register_pages' );