{"size": 878, "ext": "js", "max_stars_repo_path": "src/ui/pages/model-details/ModelDetailsContainer.js", "max_stars_repo_name": "kan-gongzhi/car-catalog", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/ui/pages/model-details/ModelDetailsContainer.js", "max_issues_repo_name": "kan-gongzhi/car-catalog", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ui/pages/model-details/ModelDetailsContainer.js", "max_forks_repo_name": "kan-gongzhi/car-catalog", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.3571428571, "max_line_length": 79, "alphanum_fraction": 0.6161731207}
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import ModelDetails from './ModelDetails';
import { getModelById } from '../../../selectors/models';
import { getMakeById } from '../../../selectors/makes';

export const ModelDetailsContainer = ({ car }) => <ModelDetails car={car} />;

// connect to store
/*************************************************************/
export const mapStateToProps = (
  { models, makes },
  { match: { params: { id } } }
) => {
  const model = getModelById(id)({ models }) || {};
  const make = getMakeById(model.makeId)({ makes }) || {};
  return {
    car: { ...model, make: make.name }
  };
};

export const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch);

export default connect(mapStateToProps, mapDispatchToProps)(
  ModelDetailsContainer
);
