Skip to content

Commit

Permalink
Update UserJoinedProgramsCard.component.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
sametaln committed Dec 16, 2024
1 parent 088b590 commit 0101536
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions frontend/src/components/UserJoinedProgramsCard.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,33 +198,27 @@ const UserJoinedProgramsCard = () => {
</Tr>
</Thead>
<Tbody>
{program.weeks.map((week) =>
week.workouts.map((workout) =>
workout.workoutExercises
.filter(exercise => !exercise.completedAt)
.map((exercise) => (
<Tr key={exercise.id}>
<Td>{exercise.exercise.name}</Td>
<Td>
<Button
onClick={() => {
if (shouldUserRest(program.interval, program.lastCompletedWorkoutDate)) {
setSelectedProgram(program);
setSelectedExerciseId(exercise.id);
onRestOpen();
} else {
handleStartSession(program, exercise.id);
}
}}
colorScheme="green"
size="sm"
>
Start Session
</Button>
</Td>
</Tr>
))
)
{firstUncompletedExercise && (
<Tr key={firstUncompletedExercise.exercise.id}>
<Td>{firstUncompletedExercise.exercise.exercise.name}</Td>
<Td>
<Button
onClick={() => {
if (shouldUserRest(program.interval, program.lastCompletedWorkoutDate)) {
setSelectedProgram(program);
setSelectedExerciseId(firstUncompletedExercise.exercise.id);
onRestOpen();
} else {
handleStartSession(program, firstUncompletedExercise.exercise.id);
}
}}
colorScheme="green"
size="sm"
>
Start Session
</Button>
</Td>
</Tr>
)}
</Tbody>
</Table>
Expand Down

0 comments on commit 0101536

Please sign in to comment.