import React, { memo } from 'react';
import "./style.css";
import Timer from "../TransistionTimer";

var SingleResult = function SingleResult(props) {
  var _props$exercise, _props$exercise$label, _props$resultsExercis, _props$exercise2, _props$exercise2$labe;

  var resultExercise = props.resultsExercises.find(function (exer) {
    return exer._id === props.exercise._id;
  });
  return (resultExercise === null || resultExercise === void 0 ? void 0 : resultExercise.result) >= (resultExercise === null || resultExercise === void 0 ? void 0 : resultExercise.minAcceptableAngle) && (resultExercise === null || resultExercise === void 0 ? void 0 : resultExercise.result) <= (resultExercise === null || resultExercise === void 0 ? void 0 : resultExercise.acceptableAngle) ? /*#__PURE__*/React.createElement("div", {
    className: "single-result"
  }, /*#__PURE__*/React.createElement("div", {
    className: "single-result-container"
  }, /*#__PURE__*/React.createElement("h2", {
    className: "result-subtitle"
  }, (_props$exercise = props.exercise) === null || _props$exercise === void 0 ? void 0 : (_props$exercise$label = _props$exercise.label) === null || _props$exercise$label === void 0 ? void 0 : _props$exercise$label.toUpperCase()), /*#__PURE__*/React.createElement("h1", {
    className: "result-title"
  }, "COMPLETED"), /*#__PURE__*/React.createElement("h2", {
    className: "result-number"
  }, (_props$resultsExercis = props.resultsExercises.find(function (exer) {
    return exer._id === props.exercise._id;
  })) === null || _props$resultsExercis === void 0 ? void 0 : _props$resultsExercis.result)), /*#__PURE__*/React.createElement(Timer, {
    isPaused: props.isPaused,
    onTimerCountDownFinish: props.onNextTransition
  })) : /*#__PURE__*/React.createElement("div", {
    className: "single-result"
  }, /*#__PURE__*/React.createElement("div", {
    className: "single-result-container"
  }, /*#__PURE__*/React.createElement("h2", {
    className: "result-subtitle"
  }, (_props$exercise2 = props.exercise) === null || _props$exercise2 === void 0 ? void 0 : (_props$exercise2$labe = _props$exercise2.label) === null || _props$exercise2$labe === void 0 ? void 0 : _props$exercise2$labe.toUpperCase()), /*#__PURE__*/React.createElement("h1", {
    className: "result-title invalid"
  }, "INVALID"), /*#__PURE__*/React.createElement("h2", {
    className: "result-number invalid"
  }, resultExercise === null || resultExercise === void 0 ? void 0 : resultExercise.result), /*#__PURE__*/React.createElement("p", {
    className: "result-text"
  }, "The captured angle value is outside the acceptable values. Please re-measure this exercise.")), /*#__PURE__*/React.createElement(Timer, {
    isPaused: props.isPaused,
    onTimerCountDownFinish: props.onRepeatExercise
  }));
};

export default memo(SingleResult);