feat(02-02): wire deleteLog through App.jsx and WorkoutPage to ExerciseCard
- Added deleteLog function in App.jsx: calls DELETE /api/logs and removes entry from local logs state
- Passed onDeleteSet={deleteLog} to WorkoutPage in workout view render
- Updated WorkoutPage function signature to accept onDeleteSet prop
- Passed onDeleteSet through to each ExerciseCard (ExerciseCard already calls it in handleDeleteSet)
- Non-logged sets (404 from backend) silently ignored via catch block
This commit is contained in:
@@ -47,7 +47,7 @@ function getMuscleGroups(exercises) {
|
||||
return Array.from(groups)
|
||||
}
|
||||
|
||||
function WorkoutPage({ day, week, logs, onLogSet, onBack, fetchProgression }) {
|
||||
function WorkoutPage({ day, week, logs, onLogSet, onDeleteSet, onBack, fetchProgression }) {
|
||||
const [progressions, setProgressions] = useState({})
|
||||
const [expandedExercise, setExpandedExercise] = useState(null)
|
||||
const [warmupDone, setWarmupDone] = useState(false)
|
||||
@@ -239,6 +239,7 @@ function WorkoutPage({ day, week, logs, onLogSet, onBack, fetchProgression }) {
|
||||
expandedExercise === exercise.id ? null : exercise.id
|
||||
)}
|
||||
onLogSet={onLogSet}
|
||||
onDeleteSet={onDeleteSet}
|
||||
/>
|
||||
))}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user