diff --git a/src/components/WorkoutPlot.tsx b/src/components/WorkoutPlot.tsx index de8c3b1..2e5575d 100644 --- a/src/components/WorkoutPlot.tsx +++ b/src/components/WorkoutPlot.tsx @@ -1,6 +1,6 @@ import React from "react"; import styled from "styled-components"; -import { Interval, Intensity, IntensityRange, FreeIntensity, Duration } from "make-workout"; +import { Interval, Intensity, IntensityRange, FreeIntensity, Duration, totalDuration } from "make-workout"; type BarProps = { width: string; @@ -37,9 +37,6 @@ const zoneColor = (intensity: Intensity | IntensityRange | FreeIntensity): strin return "#7f7f7f"; } -export const totalDuration = (intervals: Interval[]): Duration => - intervals.reduce((total, interval) => total.add(interval.duration), new Duration(0)); - const toBarProps = (interval: Interval, workoutDuration: Duration): BarProps => ({ background: zoneColor(interval.intensity), width: `${interval.duration.seconds / workoutDuration.seconds * 100 - 0.1}%`,