Skip to content

Allow creating new exercises while configuring mesocycle#85

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/allow-creating-new-exercises
Draft

Allow creating new exercises while configuring mesocycle#85
Copilot wants to merge 3 commits intomainfrom
copilot/allow-creating-new-exercises

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Users had to leave the mesocycle configuration flow to create exercises not yet in their library. This adds inline exercise creation directly from the exercise selector.

Changes

  • ExerciseSelector: Added optional onCreateExercise prop. When provided, renders a "Create New Exercise" button at the top of the exercise list. ExerciseForm is rendered via createPortal to document.body to avoid nested <form> elements inside MesocycleForm.
  • SplitDayEditor: Wires createExercise from db/service into ExerciseSelector. Relaxed handleAddExercise guard to handle exercises not yet propagated through useLiveQuery.
  • ExerciseForm: Added e.stopPropagation() on submit — React portal events bubble through the React component tree (not DOM tree), which was triggering the parent MesocycleForm submission.
  • ExerciseSelector.css: Styling for the create button and a .exercise-form-portal class (z-index 1200, above ExerciseSelector's 1100).

Flow

  1. User clicks "+ Add Exercise" → ExerciseSelector opens
  2. User clicks "Create New Exercise" → ExerciseForm opens (portal)
  3. User fills form, clicks "Create" → exercise saved to IndexedDB, auto-added to split day with defaults (3 sets, 8–12 reps, 90s rest)
  4. Both modals close; exercise appears in split day config

The onCreateExercise prop is optional, so existing ExerciseSelector usage (e.g. workout logging) is unaffected.

Exercise selector with Create New Exercise button

Copilot AI linked an issue Apr 7, 2026 that may be closed by this pull request
5 tasks
Copilot AI and others added 2 commits April 7, 2026 10:36
- Add onCreateExercise prop to ExerciseSelector for inline exercise creation
- Show "Create New Exercise" button at top of exercise list in selector
- Render ExerciseForm via portal to avoid nested form issues
- Add stopPropagation to ExerciseForm submit to prevent portal event bubbling
- Update SplitDayEditor to wire createExercise from db/service
- Handle newly created exercises that haven't propagated via useLiveQuery
- Add CSS styling for the create exercise button

Agent-Logs-Url: https://github.com/wulfland/Repstack/sessions/5e8d8917-f175-485e-afd4-d1a6431ea934

Co-authored-by: wulfland <5276337+wulfland@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to create new exercises during mesocycle configuration Allow creating new exercises while configuring mesocycle Apr 7, 2026
Copilot AI requested a review from wulfland April 7, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow creating new exercises while configuring mesocycle

2 participants