import React from 'react'
import ErrorMessage from './ErrorMessage'
import Header from './Header'
import BrowserStack from './BrowserStack'
import BrowserTabs from './BrowserTabs'
import CorpusStatusWatcher from '../CorpusStatusWatcher'

class Browser extends React.Component {
  render () {
    return (
      <CorpusStatusWatcher className="window browser-window">
        <Header />
        <BrowserStack />
        <BrowserTabs />
        <ErrorMessage />
      </CorpusStatusWatcher>
    )
  }
}

export default Browser

import React from 'react'
import { connect } from 'react-redux'
import ErrorMessage from './ErrorMessage'
import Header from './Header'
import BrowserStack from './BrowserStack'
import BrowserTabs from './BrowserTabs'
import CorpusStatusWatcher from '../CorpusStatusWatcher'
import Spinner from '../Spinner'

class Browser extends React.Component {
  render () {
    if (!this.props.corpus) {
      // Corpus not yet selected
      return <Spinner />
    }

    return (
      <CorpusStatusWatcher className="window browser-window">
        <Header />
        <BrowserStack />
        <BrowserTabs />
        <ErrorMessage />
      </CorpusStatusWatcher>
    )
  }
}

Browser.propTypes = {
  corpus: React.PropTypes.object
}

const mapStateToProps = ({ corpora }) => ({
  corpus: corpora.selected
})

const mapDispatchToProps = {
}

export default connect(mapStateToProps, mapDispatchToProps)(Browser)

Fix proptypes error when rendering too soon after corpus is selected
fix(browser): Fix proptypes error when rendering too soon after corpus is selected
