Add tags field to Workout interface

This commit is contained in:
Rene Saarsoo 2020-10-06 16:29:53 +03:00
parent 62ce66ddfa
commit 77661ca6d7
4 changed files with 9 additions and 1 deletions

View File

@ -49,6 +49,7 @@ Write a workout description like:
```
Name: Sample workout
Author: John Doe
Tags: Recovery, Intervals, FTP
Description: Try changing it, and see what happens below.
Warmup: 10:00 30%..75%
@ -114,7 +115,6 @@ console.log(stats(workout));
- Repeats (and nested repeats)
- Unsupported params: message duration & y-position
- More restricted syntax for text (with quotes)
- Support for tags
[zwift]: https://zwift.com/
[zwofactory]: https://zwofactory.com/

View File

@ -6,6 +6,7 @@ export type Workout = {
name: string;
author: string;
description: string;
tags: string[];
intervals: Interval[];
};

View File

@ -8,6 +8,7 @@ describe("Parser", () => {
"description": "",
"intervals": Array [],
"name": "Untitled",
"tags": Array [],
}
`);
@ -17,6 +18,7 @@ describe("Parser", () => {
"description": "",
"intervals": Array [],
"name": "Untitled",
"tags": Array [],
}
`);
});
@ -28,6 +30,7 @@ describe("Parser", () => {
"description": "",
"intervals": Array [],
"name": "My Workout",
"tags": Array [],
}
`);
});
@ -52,6 +55,7 @@ Description:
it'll cause lots of pain.",
"intervals": Array [],
"name": "My Workout",
"tags": Array [],
}
`);
});
@ -175,6 +179,7 @@ Interval: 5:00 50%
},
],
"name": "My Workout",
"tags": Array [],
}
`);
});
@ -477,6 +482,7 @@ Rest: 5:00 50%
},
],
"name": "My Workout",
"tags": Array [],
}
`);
});

View File

@ -138,6 +138,7 @@ export const parseTokens = (tokens: Token[]): Workout => {
name: header.name || "Untitled",
author: header.author || "",
description: header.description || "",
tags: [],
intervals: parseIntervals(intervalTokens),
};
};