"use strict";

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

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

var _Table = _interopRequireDefault(require("../Table"));

require("./style.css");

var _simpleReactLightbox = _interopRequireWildcard(require("simple-react-lightbox"));

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var optionsLightBox = {
  buttons: {
    showAutoplayButton: false,
    showFullscreenButton: false,
    showThumbnailsButton: false
  }
};

var computedData = function computedData(currentExercise) {
  return currentExercise.map(function (exercise, index) {
    var colScreenshot = /*#__PURE__*/_react["default"].createElement(_simpleReactLightbox["default"], {
      key: "exercise-lightbox-" + index
    }, /*#__PURE__*/_react["default"].createElement(_simpleReactLightbox.SRLWrapper, {
      options: optionsLightBox
    }, /*#__PURE__*/_react["default"].createElement("a", {
      href: exercise.printscreen
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: exercise.printscreen,
      width: 53,
      height: 30
    }))));

    return {
      screenshot: colScreenshot,
      exercise: "" + exercise.label.toUpperCase(),
      result: exercise.result.toFixed(2) + "\xBA",
      norm: exercise.acceptableAngle + "\xBA"
    };
  });
};

var Results = function Results(props) {
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "results"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "results-container"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    id: "table_container"
  }, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
    tableData: computedData(props.resultsExercises),
    headingColumns: ['', 'EXERCISE', 'RESULT', 'NORM'],
    title: "",
    breakOn: "none"
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "result-actions"
  }, /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: props.onResetResultExercises
  }, "Start Over"), /*#__PURE__*/_react["default"].createElement("button", {
    className: "btn-outline",
    onClick: props.onWeeklyAssessment
  }, "Weekly Assessment"))));
};

var _default = (0, _react.memo)(Results);

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