import React from 'react'; import * as Text from 'app/shared/components/text/text'; import { Dot } from 'app/shared/components/dot/dot'; import { TceMoneyTrend } from './tceMoneyTrend'; import { useSelector } from 'react-redux'; import { selectCurrentTcePeriod, selectPreviousTceMonths, selectTceKeyValues } from '../store/earnings.selectors'; import moneyPipe from 'app/shared/pipes/money.pipe'; import { selectBenchmarkMode, selectIsBenchmarkAvailable } from '../store/benchmark.selectors'; import { BENCHMARK_MODE_YEAR } from '../store/earnings.constants'; const TceKeyValues = () => { const tceKeyValues = useSelector(selectTceKeyValues); const tceMonth = useSelector(selectCurrentTcePeriod); const months = useSelector(selectPreviousTceMonths); const isGlobalSpotOrYearTcAvailable = useSelector(selectIsBenchmarkAvailable); const benchmarkMode = useSelector(selectBenchmarkMode); const isModeYearSelected = benchmarkMode === BENCHMARK_MODE_YEAR; const isComparisionAvailable = [ tceKeyValues.versusPreviousAggregationPeriod, tceKeyValues.versusSamePeriodLastYear, tceKeyValues.versusGlobalSpot, tceKeyValues.versusOneYearTc, ].some(value => value); return (
Pay out | {tceMonth?.toUpperCase()}
Pay out
{ isGlobalSpotOrYearTcAvailable &&
{isModeYearSelected ? '1 Year TC' : 'GLOBAL SPOT'}
}

{moneyPipe.format(tceKeyValues.current, 'USD', 0)}

/day
Earnings { isComparisionAvailable && <>
COMPARISON
{ tceKeyValues.versusPreviousAggregationPeriod &&
} { tceKeyValues.versusSamePeriodLastYear && months.previousYearLabel &&
}
{ tceKeyValues.versusGlobalSpot &&
} { tceKeyValues.versusOneYearTc &&
}
}
); }; export default TceKeyValues;