import React, { Component } from 'react'
import { store, storeConnect } from './store'
import { actions } from './actions'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import injectTapEventPlugin from "react-tap-event-plugin"
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import { BrowserRouter as Router, Route } from 'react-router-dom'
import { Loading, Errors, Admin, Auth } from './components'
// Styles
import 'tachyons'
import './index.css'
injectTapEventPlugin();

// Render app
ReactDOM.render(
  <Provider store={store}>
    <MuiThemeProvider muiTheme={getMuiTheme()}>
      <div>
        <Router>
          <div>
            <Errors/>
            <Loading/>
            <Route exact path="/" component={() => <Auth><Admin/></Auth>} />
            <Route exact path="/:campaign" component={() => <Auth><Admin/></Auth>} />
            <Route exact path="/:campaign/:activity" component={() => <Auth><Admin/></Auth>} />
          </div>
        </Router>
      </div>
    </MuiThemeProvider>
  </Provider>,
  document.getElementById('root')
)
