It will be nice for the user to be told what the next exercise is during the short rest period after each exercise. This will help in preparing for the next exercise. So let's add it.
To implement this feature, we would simply output the title of the exercise from the first element in the workoutPlan.exercises
array in a label during the rest stage. This is possible because transitioning to the next exercise involves removing the exercise
object from the workoutPlan.exercises
array and returning it. Therefore, the array is shrinking after each exercise and the first element in the array always points to the exercise that is due. With this basic understanding in place, let's start the implementation.
We will show the next exercise next to the Time Remaining countdown section. Change the workout div (class="workout-display-div"
) to include the highlighted content.
<div class="workout-display-div"> <!-- Exiting html --> <div class...