'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mapStateToProps = mapStateToProps;

var _immutable = require('immutable');

var _reactRedux = require('../../../react-redux');

var _presenter = require('./presenter');

var _presenter2 = _interopRequireDefault(_presenter);

var _ui = require('../../../actions/ui');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function mapStateToProps(state, props) {
  var pageData = state.getIn(['ui', props.stateKey], (0, _immutable.Map)());
  var totalPages = pageData.get('total', 0);
  var currentPage = pageData.get('current', 1);
  var contents = pageData.get('contents', (0, _immutable.Map)());
  return {
    totalPages: totalPages,
    currentPage: currentPage,
    contents: contents
  };
}

exports.default = (0, _reactRedux.connect)(mapStateToProps, { merge: _ui.merge })(_presenter2.default);