import approx from 'approximate-number' import classNames from 'classnames' import React from 'react' import { convertSecondsToFormattedTime } from '../../../../util/date-time' const TaskComponent = ({ task, flopsLeft }) => { let icon let progressBarContent let percent let infoTitle if (flopsLeft === task.totalFlopCount) { icon = 'hourglass-half' progressBarContent = '' percent = 0 infoTitle = 'Not submitted yet' } else if (flopsLeft > 0) { icon = 'refresh' progressBarContent = approx(task.totalFlopCount - flopsLeft) + ' FLOP' percent = 100 * (task.totalFlopCount - flopsLeft) / task.totalFlopCount infoTitle = progressBarContent + ' (' + Math.round(percent * 10) / 10 + '%)' } else { icon = 'check' progressBarContent = 'Completed' percent = 100 infoTitle = 'Completed' } return (