just-paja/improtresk-web

View on GitHub
src/containers/LanguagePicker.jsx

Summary

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

import { getLang } from '../selectors/locales'
import { getUrlName } from '../routeTable'

import * as locales from '../locales'

import LanguagePicker from '../components/LanguagePicker'

const mapStateToProps = (state) => ({
  pathName: (typeof window === 'undefined' || !window
    ? getUrlName(getLang(state), state.server.entryPath)
    : getUrlName(getLang(state), window.location.pathname)) || 'home',
  availableLangs: Object.keys(locales),
  selectedLang: getLang(state)
})

export default connect(mapStateToProps)(LanguagePicker)