import React, { memo } from "react";
import Table from "../Table/Table";
import "./Results.css";
import { MdOutlineImage } from "react-icons/md";
import SimpleReactLightbox, { SRLWrapper, useLightbox } from "simple-react-lightbox";
import { useDispatch } from "react-redux";
import { goToWeeklyAssessment } from "../../store/coach";
var optionsLightBox = {
  buttons: {
    showAutoplayButton: false,
    showFullscreenButton: false,
    showThumbnailsButton: false
  }
};

var computedData = function computedData(currentExercise) {
  return currentExercise.map(function (exercise) {
    var colScreenshot = /*#__PURE__*/React.createElement(SimpleReactLightbox, null, /*#__PURE__*/React.createElement(SRLWrapper, {
      options: optionsLightBox
    }, /*#__PURE__*/React.createElement("a", {
      href: exercise.printscreen
    }, /*#__PURE__*/React.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) {
  var dispatch = useDispatch();

  var onWeeklyAssessment = function onWeeklyAssessment() {
    dispatch(goToWeeklyAssessment());
  };

  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"), /*#__PURE__*/React.createElement("button", {
    className: "btn-outline",
    onClick: onWeeklyAssessment
  }, "Weekly Assessment"))));
};

export default memo(Results);