Add tags field to Workout interface
This commit is contained in:
parent
62ce66ddfa
commit
77661ca6d7
|
|
@ -49,6 +49,7 @@ Write a workout description like:
|
||||||
```
|
```
|
||||||
Name: Sample workout
|
Name: Sample workout
|
||||||
Author: John Doe
|
Author: John Doe
|
||||||
|
Tags: Recovery, Intervals, FTP
|
||||||
Description: Try changing it, and see what happens below.
|
Description: Try changing it, and see what happens below.
|
||||||
|
|
||||||
Warmup: 10:00 30%..75%
|
Warmup: 10:00 30%..75%
|
||||||
|
|
@ -114,7 +115,6 @@ console.log(stats(workout));
|
||||||
- Repeats (and nested repeats)
|
- Repeats (and nested repeats)
|
||||||
- Unsupported params: message duration & y-position
|
- Unsupported params: message duration & y-position
|
||||||
- More restricted syntax for text (with quotes)
|
- More restricted syntax for text (with quotes)
|
||||||
- Support for tags
|
|
||||||
|
|
||||||
[zwift]: https://zwift.com/
|
[zwift]: https://zwift.com/
|
||||||
[zwofactory]: https://zwofactory.com/
|
[zwofactory]: https://zwofactory.com/
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export type Workout = {
|
||||||
name: string;
|
name: string;
|
||||||
author: string;
|
author: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
tags: string[];
|
||||||
intervals: Interval[];
|
intervals: Interval[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ describe("Parser", () => {
|
||||||
"description": "",
|
"description": "",
|
||||||
"intervals": Array [],
|
"intervals": Array [],
|
||||||
"name": "Untitled",
|
"name": "Untitled",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
@ -17,6 +18,7 @@ describe("Parser", () => {
|
||||||
"description": "",
|
"description": "",
|
||||||
"intervals": Array [],
|
"intervals": Array [],
|
||||||
"name": "Untitled",
|
"name": "Untitled",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -28,6 +30,7 @@ describe("Parser", () => {
|
||||||
"description": "",
|
"description": "",
|
||||||
"intervals": Array [],
|
"intervals": Array [],
|
||||||
"name": "My Workout",
|
"name": "My Workout",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -52,6 +55,7 @@ Description:
|
||||||
it'll cause lots of pain.",
|
it'll cause lots of pain.",
|
||||||
"intervals": Array [],
|
"intervals": Array [],
|
||||||
"name": "My Workout",
|
"name": "My Workout",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -175,6 +179,7 @@ Interval: 5:00 50%
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"name": "My Workout",
|
"name": "My Workout",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -477,6 +482,7 @@ Rest: 5:00 50%
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"name": "My Workout",
|
"name": "My Workout",
|
||||||
|
"tags": Array [],
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ export const parseTokens = (tokens: Token[]): Workout => {
|
||||||
name: header.name || "Untitled",
|
name: header.name || "Untitled",
|
||||||
author: header.author || "",
|
author: header.author || "",
|
||||||
description: header.description || "",
|
description: header.description || "",
|
||||||
|
tags: [],
|
||||||
intervals: parseIntervals(intervalTokens),
|
intervals: parseIntervals(intervalTokens),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue