Move maximumIntensity to lib
This commit is contained in:
parent
856f561d2d
commit
4011026e52
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { Interval, Intensity, ConstantIntensity, Duration, totalDuration, ZoneIndex, intensityToZoneIndex } from "make-workout";
|
import { Interval, Intensity, Duration, totalDuration, ZoneIndex, intensityToZoneIndex, maximumIntensity } from "make-workout";
|
||||||
|
|
||||||
type BarProps = {
|
type BarProps = {
|
||||||
width: string;
|
width: string;
|
||||||
|
|
@ -45,9 +45,6 @@ const Plot = styled.div`
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const maximumIntensity = (intervals: Interval[]): ConstantIntensity =>
|
|
||||||
new ConstantIntensity(Math.max(...intervals.map(interval => Math.max(interval.intensity.start, interval.intensity.end))));
|
|
||||||
|
|
||||||
export const WorkoutPlot: React.FC<{ intervals: Interval[] }> = ({ intervals }) => {
|
export const WorkoutPlot: React.FC<{ intervals: Interval[] }> = ({ intervals }) => {
|
||||||
const workoutDuration = totalDuration(intervals);
|
const workoutDuration = totalDuration(intervals);
|
||||||
const maxIntensity = maximumIntensity(intervals);
|
const maxIntensity = maximumIntensity(intervals);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue