import React, { ReactNode } from 'react'
import { connect } from 'react-redux'
import { t } from 'ttag'
import UnitButton from './UnitButton'
type RunConfigurationProps = {
job: any
children?: ReactNode
}
const RunConfiguration = ({ job, children = null }: RunConfigurationProps) => {
let overlay = null
if (job.isRunning) {
let label =
{t`Calculating scores...`}
if (job.queued) {
label = (
{t`Waiting for other jobs to finish...`}
{t`Another job is currently running. Your job is queued and will run as soon as other jobs are finished.`}
)
}
overlay = (
)
}
return (
{overlay}
{t`Units:`}
{t`Metric`}
{t`Imperial`}
{children}
)
}
RunConfiguration.defaultProps = {
children: null,
}
export default connect((state: any) => {
const { job } = state
return {
job,
}
})(RunConfiguration)