just-paja/improtresk-web

View on GitHub
src/containers/AppContainer.js

Summary

Maintainability
A
0 mins
Test Coverage
import { connect } from 'react-redux'
import { getTranslate } from 'react-localize-redux'

import App from '../components/App'

import { countAppRequests, getAppProgress } from '../selectors/app'
import { getHost, getLang } from '../selectors'
import { getParticipantDetail } from '../participants/selectors'
import { logout } from '../participants/actions'
import { yearCurrent, yearsNotCurrent } from '../years/selectors'

import * as actions from '../constants'

const mapStateToProps = state => ({
  activeRequests: countAppRequests(state),
  currentYear: yearCurrent(state),
  entryPath: state.server.entryPath,
  host: getHost(state),
  lang: getLang(state),
  participant: getParticipantDetail(state),
  progress: getAppProgress(state),
  translate: getTranslate(state.locale),
  years: yearsNotCurrent(state)
})

const mapDispatchToProps = {
  onMount: () => ({ type: actions.APP_MOUNTED }),
  onLogout: logout
}

export const AppContainer = connect(mapStateToProps, mapDispatchToProps)(App)