"use strict";

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

var _react = _interopRequireDefault(require("react"));

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

var _fieldTripDetails = _interopRequireDefault(require("./field-trip-details"));

var _fieldTripList = _interopRequireDefault(require("./field-trip-list"));

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

const WINDOW_WIDTH = 450;
const MARGIN = 15;
/**
 * Collects the various draggable windows for the Field Trip module.
 */

const FieldTripWindows = ({
  callTaker
}) => {
  const {
    fieldTrip
  } = callTaker; // Do not render details or list if visible is false.

  if (!fieldTrip.visible) return null;
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_fieldTripDetails.default, {
    style: {
      bottom: `${MARGIN}px`,
      right: `${MARGIN * 2 + WINDOW_WIDTH}px`,
      width: `${WINDOW_WIDTH}px`,
      // Ensure this window stays above the list.
      zIndex: 9999999 + 1
    }
  }), /*#__PURE__*/_react.default.createElement(_fieldTripList.default, {
    draggableProps: {
      positionOffset: {
        x: '-40%'
      }
    },
    style: {
      bottom: `${MARGIN}px`,
      right: `${MARGIN}px`,
      width: `${WINDOW_WIDTH}px`
    }
  }));
};

const mapStateToProps = (state, ownProps) => {
  return {
    callTaker: state.callTaker
  };
};

var _default = (0, _reactRedux.connect)(mapStateToProps)(FieldTripWindows);

exports.default = _default;
module.exports = exports.default;

//# sourceMappingURL=field-trip-windows.js