/** * External dependencies */ import { Chart } from 'react-google-charts'; import FileImport from './Import/FileImport.js'; import RemoteImport from './Import/RemoteImport.js'; import ChartImport from './Import/ChartImport.js'; import ManualData from './Import/ManualData.js'; import Sidebar from './Sidebar.js'; import ChartPermissions from './ChartPermissions.js'; import PanelButton from './PanelButton.js'; import merge from 'merge'; import { compact, formatDate, isValidJSON } from '../utils.js'; /** * WordPress dependencies */ const { startCase } = lodash; const { __ } = wp.i18n; const { Component, Fragment } = wp.element; const { InspectorControls } = wp.editor; class ChartSelect extends Component { constructor() { super( ...arguments ); this.state = { /** * Sidebar Route Status * * home - Initial screen. * showAdvanced - Show Advanced Options. */ route: 'home' }; } render() { let chart; let data = formatDate( JSON.parse( JSON.stringify( this.props.chart ) ) ); if ( 0 <= [ 'gauge', 'table', 'timeline' ].indexOf( this.props.chart['visualizer-chart-type']) ) { chart = startCase( this.props.chart['visualizer-chart-type']); } else { chart = `${ startCase( this.props.chart['visualizer-chart-type']) }Chart`; } return ( { 'home' === this.state.route && this.setState({ route: 'showAdvanced' }) } /> this.setState({ route: 'showPermissions' }) } /> } { ( 'showAdvanced' === this.state.route || 'showPermissions' === this.state.route ) && this.setState({ route: 'home' }) } isBack={ true } /> { 'showAdvanced' === this.state.route && } { 'showPermissions' === this.state.route && } }
{ ( null !== this.props.chart ) && }
); } } export default ChartSelect;