Bring *BarProps creation functions close together
This commit is contained in:
parent
df4a90338e
commit
bb8b2d3d2e
|
|
@ -11,12 +11,6 @@ import {
|
|||
} from "zwiftout";
|
||||
import { BarProps, Bar, RangeBar, RangeBarProps } from "./Bar";
|
||||
|
||||
const toBarProps = (interval: Interval, workoutDuration: Duration, maxIntensity: Intensity): BarProps => ({
|
||||
zone: interval.intensity.zone,
|
||||
durationPercentage: (interval.duration.seconds / workoutDuration.seconds) * 100,
|
||||
intensityPercentage: (interval.intensity.value / maxIntensity.value) * 100,
|
||||
});
|
||||
|
||||
const Plot = styled.div`
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
|
@ -26,6 +20,12 @@ const Plot = styled.div`
|
|||
margin: 10px 0;
|
||||
`;
|
||||
|
||||
const toBarProps = (interval: Interval, workoutDuration: Duration, maxIntensity: Intensity): BarProps => ({
|
||||
zone: interval.intensity.zone,
|
||||
durationPercentage: (interval.duration.seconds / workoutDuration.seconds) * 100,
|
||||
intensityPercentage: (interval.intensity.value / maxIntensity.value) * 100,
|
||||
});
|
||||
|
||||
const toRangeBarProps = (interval: Interval, workoutDuration: Duration, maxIntensity: Intensity): RangeBarProps => {
|
||||
const minIntensityPercentage =
|
||||
(Math.min(interval.intensity.start, interval.intensity.end) / maxIntensity.value) * 100;
|
||||
|
|
|
|||
Loading…
Reference in New Issue