{"size": 1693, "ext": "js", "max_stars_repo_path": "src/features/pages/containers/HomePage.js", "max_stars_repo_name": "alialfredji/fia", "max_stars_repo_stars_event_min_datetime": "2019-05-19T21:35:50.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-26T00:45:54.000Z", "max_issues_repo_path": "src/features/pages/containers/HomePage.js", "max_issues_repo_name": "alialfredji/fia", "max_issues_repo_issues_event_min_datetime": "2019-05-21T12:24:40.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-21T12:24:40.000Z", "max_forks_repo_path": "src/features/pages/containers/HomePage.js", "max_forks_repo_name": "alialfredji/fia", "max_forks_repo_forks_event_min_datetime": "2019-05-22T15:32:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-22T15:32:05.000Z"}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 27.3064516129, "max_line_length": 68, "alphanum_fraction": 0.5953927939}
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { injectIntl, intlShape } from 'react-intl'
import MetaTags from 'containers/MetaTags'
import HomePageUI from '../components/HomePageUI'
import { loadPage } from '../pages.service'
import { messages } from '../locale'

const mapState = ({ pages }, { match }) => ({
    content: pages.map['en/home'],
})

const mapProps = (dispatch) => ({
    loadPage: () => dispatch(loadPage('en', 'home')),
})

class HomePage extends React.Component {
    constructor (props) {
        super(props)
        const { content, loadPage } = this.props
        !content && loadPage()
    }

    render () {
        const { intl, content } = this.props

        return (
            <>
                {content ? <MetaTags {...content} /> : null}
                <HomePageUI
                    content={content}
                    messages={{
                        langIt: intl.formatMessage(messages.langIt),
                        langEn: intl.formatMessage(messages.langEn),
                    }}
                />
            </>
        )
    }
}

HomePage.propTypes = {
    loadPage: PropTypes.func.isRequired,
    intl: intlShape.isRequired,
    content: PropTypes.shape({
        title: PropTypes.string.isRequired,
        description: PropTypes.string.isRequired,
        keywords: PropTypes.arrayOf(PropTypes.string).isRequired,
    }),
}

HomePage.defaultProps = {
    content: null,
}

export default injectIntl(connect(mapState, mapProps)(HomePage))

// Preload the next probable application chunk
require('../index').PagesList.preload()
require('components/Markdown').default.preload()
