"use strict";

exports.__esModule = true;
exports["default"] = void 0;

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

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

var _main = require("../../store/rehab/main");

require("./style.css");

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

var ResultRecordScreen = function ResultRecordScreen(props) {
  var dispatch = (0, _reactRedux.useDispatch)();

  var _useSelector = (0, _reactRedux.useSelector)(function (state) {
    return state.rehab.main;
  }),
      users = _useSelector.users;

  var handleReturnAdmin = function handleReturnAdmin(e) {
    dispatch((0, _main.shouldRedirectTo)());
  };

  var handleRecordNew = function handleRecordNew(e) {
    dispatch((0, _main.initSequence)());
  };

  var handleStartSession = function handleStartSession() {
    dispatch((0, _main.startAsUser)());
    dispatch((0, _main.fetchExercises)(users[0]));
  };

  var validateStartSession = function validateStartSession() {
    return users.length === 1 ? true : false;
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "result-record"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "container"
  }, /*#__PURE__*/_react["default"].createElement("h2", {
    className: "splash-subtitle"
  }, "What would you like to do?"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "splash-actions"
  }, /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: handleReturnAdmin
  }, "Return to Admin Console"), /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: handleRecordNew
  }, "Record Another Exercise")), /*#__PURE__*/_react["default"].createElement("div", null, validateStartSession() && /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: handleStartSession
  }, "Start Session"))));
};

var _default = ResultRecordScreen;
exports["default"] = _default;
module.exports = exports.default;