'use strict';

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

var _redux = require('redux');

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

var _stateHelper = require('../../../../util/stateHelper');

var _stateHelper2 = _interopRequireDefault(_stateHelper);

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

var _presenter2 = _interopRequireDefault(_presenter);

var _alerts = require('../../../../actions/alerts');

var _taking = require('../../../../actions/taking');

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

var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    screenreaderNotification: (0, _redux.bindActionCreators)(_alerts.screenreaderNotification, dispatch),
    updateTimerMinimized: (0, _redux.bindActionCreators)(_taking.updateTimerMinimized, dispatch)
  };
};

var mapStateToProps = function mapStateToProps(state) {
  var timerData = _stateHelper2.default.getTimerData().toJS();
  var isTaking = _stateHelper2.default.getIsTaking();

  return {
    timerRunning: isTaking && timerData.timerRunning,
    timeLeftInSeconds: timerData.timeLeftInSeconds,
    timerMinimized: timerData.timerMinimized
  };
};

exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter2.default);