"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _redux = require("redux");

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

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

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

var _presenter = _interopRequireDefault(require("./presenter"));

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)
  };
};

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.default);

exports.default = _default;