import React, { memo } from 'react';
import Table from "../Table";
import "./style.css";
import SimpleReactLightbox, { SRLWrapper } from 'simple-react-lightbox';
var optionsLightBox = {
  buttons: {
    showAutoplayButton: false,
    showFullscreenButton: false,
    showThumbnailsButton: false
  }
};

var computedData = function computedData(currentExercise) {
  return currentExercise.map(function (exercise, index) {
    var _exercise$label, _exerciseResult;

    var colScreenshot = /*#__PURE__*/React.createElement(SimpleReactLightbox, {
      key: "exercise-lightbox-" + index
    }, /*#__PURE__*/React.createElement(SRLWrapper, {
      options: optionsLightBox
    }, /*#__PURE__*/React.createElement("a", {
      href: exercise.printscreen
    }, /*#__PURE__*/React.createElement("img", {
      src: exercise.printscreen,
      width: 53,
      height: 30
    }))));
    console.log('Exercise', exercise);
    var exerciseResult = exercise === null || exercise === void 0 ? void 0 : exercise.result;
    if (typeof exerciseResult === 'string') exerciseResult = parseFloat(exerciseResult);
    return {
      // screenshot: colScreenshot,
      exercise: "" + (exercise === null || exercise === void 0 ? void 0 : (_exercise$label = exercise.label) === null || _exercise$label === void 0 ? void 0 : _exercise$label.toUpperCase()),
      result: ((_exerciseResult = exerciseResult) === null || _exerciseResult === void 0 ? void 0 : _exerciseResult.toFixed()) + "\xBA",
      norm: (exercise === null || exercise === void 0 ? void 0 : exercise.acceptableAngle) + "\xBA"
    };
  });
};

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

export default memo(Results);