/** * External dependencies */ import { Component } from '@wordpress/element'; import PropTypes from 'prop-types'; import { __, sprintf } from '@wordpress/i18n'; /** * WooCommerce dependencies */ import { Card } from '@woocommerce/components'; import { getHistory, getNewPath, getPersistedQuery, } from '@woocommerce/navigation'; import { getAdminLink } from '@woocommerce/wc-admin-settings'; /** * Internal dependencies */ import ReportChart from 'analytics/components/report-chart'; import './block.scss'; class ChartBlock extends Component { handleChartClick = () => { const { selectedChart } = this.props; getHistory().push( this.getChartPath( selectedChart ) ); }; getChartPath( chart ) { return getNewPath( { chart: chart.key }, '/analytics/' + chart.endpoint, getPersistedQuery() ); } render() { const { charts, endpoint, path, query, selectedChart, filters, } = this.props; if ( ! selectedChart ) { return null; } return (
); } } ChartBlock.propTypes = { charts: PropTypes.array, endpoint: PropTypes.string.isRequired, path: PropTypes.string.isRequired, query: PropTypes.object.isRequired, selectedChart: PropTypes.object.isRequired, }; export default ChartBlock;