import React, { Component, Fragment } from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import { getHistory }            from '@woocommerce/navigation';
import Controller                from '../controller';
import DashboardMain             from '../dashboard-main';
import DashboardProducts from "../dashboard-products";
import DashboardSubscribers from "../dashboard-subscribers";

class Dashboard extends Component {
	render() {
		return <div className="yith-ywsbs-dashboard">
			<Router history={getHistory()}>
				<Switch>
					<Route
						key={'/'}
						path={'/'}
						exact
						render={props => <Controller container={DashboardMain} {...props}/>}
					/>
					<Route
						key={'/products-report'}
						path={'/products-report'}
						exact
						render={props => <Controller container={DashboardProducts} {...props}/>}
					/>
					<Route
						key={'/subscribers-report'}
						path={'/subscribers-report'}
						exact
						render={props => <Controller container={DashboardSubscribers} {...props}/>}
					/>

				</Switch>

			</Router>
		</div>
	}
}

export default Dashboard;