'use strict';

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

var _redux = require('redux');

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

var _modal = require('../../../../actions/modal');

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

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

var _presenter2 = _interopRequireDefault(_presenter);

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

var mapStateToProps = function mapStateToProps(state, props) {
  var dndPosition = state.getIn(['dragAndDrop', 'position']);
  var draggingAboveHalf = state.getIn(['dragAndDrop', 'aboveHalf'], false);
  var dropIntoEmptyStimulus = state.getIn(['dragAndDrop', 'intoEmptyStimulus']);
  var draggingOver = props.draggingOnBuild && dndPosition === props.quizEntry.position;
  return {
    childEntries: props.quizEntry.getNestedEntries(),
    dropIntoEmptyStimulus: draggingOver && dropIntoEmptyStimulus,
    draggingOver: draggingOver,
    draggingAboveHalf: draggingOver && draggingAboveHalf
  };
};

var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    openDeleteStimulusModal: (0, _redux.bindActionCreators)(_modal.openDeleteStimulusModal, dispatch),
    setUi: (0, _redux.bindActionCreators)(_ui.set, dispatch)
  };
};

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