/** @format */ /** * External dependencies */ import { __, sprintf } from '@wordpress/i18n'; import { Component } from '@wordpress/element'; import { TabPanel } from '@wordpress/components'; /** * Internal dependencies */ import Count from 'components/count'; import { H, Section } from 'layout/section'; import OrdersList from './orders'; class ActivityPanel extends Component { constructor() { super( ...arguments ); this.togglePanel = this.togglePanel.bind( this ); this.state = { isOpen: false, currentTab: '', }; } togglePanel( tabName ) { const { currentTab } = this.state; if ( tabName === this.state.currentTab || '' === currentTab ) { this.setState( state => ( { isOpen: ! state.isOpen, currentTab: state.isOpen ? '' : tabName, } ) ); return; } this.setState( { currentTab: tabName } ); } getTabs() { return [ { name: 'orders', title: ( { __( 'Orders', 'woo-dash' ) }{' '} ), className: 'woocommerce-layout__activity-panel-tab', }, { name: 'reviews', title: ( { __( 'Reviews', 'woo-dash' ) } ), className: 'woocommerce-layout__activity-panel-tab', }, { name: 'stock', title: { __( 'Stock', 'woo-dash' ) }, className: 'woocommerce-layout__activity-panel-tab', }, ]; } renderPanel( tab ) { switch ( tab ) { case 'orders': return ; default: return

Coming soon…

; } } render() { const { isOpen } = this.state; const tabs = this.getTabs(); return ( { selectedTabName => { if ( ! isOpen ) { return null; } return (
Section: { selectedTabName } { this.renderPanel( selectedTabName ) }
); } }
); } } export default ActivityPanel;