From bf7708f658cc6299a3b775afe24459b5a808c54d Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 22 Sep 2017 21:20:54 +0200 Subject: Restructure component and container directories --- .../app/sidebars/simulation/TaskComponent.js | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/components/app/sidebars/simulation/TaskComponent.js (limited to 'src/components/app/sidebars/simulation/TaskComponent.js') diff --git a/src/components/app/sidebars/simulation/TaskComponent.js b/src/components/app/sidebars/simulation/TaskComponent.js new file mode 100644 index 00000000..f7f65817 --- /dev/null +++ b/src/components/app/sidebars/simulation/TaskComponent.js @@ -0,0 +1,42 @@ +import approx from "approximate-number"; +import React from "react"; +import {convertSecondsToFormattedTime} from "../../../../util/date-time"; + +const TaskComponent = ({task, flopsLeft}) => { + let stateInfo; + + if (flopsLeft === task.totalFlopCount) { + stateInfo = ( +
+ + Waiting +
+ ); + } else if (flopsLeft > 0) { + stateInfo = ( +
+ + Running ({approx(task.totalFlopCount - flopsLeft)} / {approx(task.totalFlopCount)} FLOPS) +
+ ); + } else { + stateInfo = ( +
+ + Completed +
+ ); + } + + return ( +
  • +
    +
    {approx(task.totalFlopCount)} FLOPS
    + Starts at {convertSecondsToFormattedTime(task.startTick)} +
    + {stateInfo} +
  • + ); +}; + +export default TaskComponent; -- cgit v1.2.3