StudentMargaretP
Order15
CategoryBasic Function
Prompt TitleCreate custom workout option
Prompt

Add a "Create Custom Exercise" flow, accessible from the exercise library page (e.g., a button near the search bar).

Form fields:

  • name (required, text input)
  • exercise_type (required, select: strength / cardio / mobility / other)
  • measurement_type (required, select: reps_weight / time / distance / reps_only)
  • primary_muscle (optional, select dropdown — options limited to the existing ENUM: chest, back, shoulders, biceps, triceps, forearms, abs, quads, hamstrings, glutes, calves, full_body)
  • equipment (optional, free text input)

On submit:

  • Insert a new row into exercises with the form values, is_custom = true, and created_by set to the logged-in user's user_id.
  • Validate that name isn't empty and exercise_type/measurement_type are valid enum values before submitting.
  • After a successful save, close the form and return the user to the exercise library with the new exercise visible in the list, tagged with the existing "Custom" badge, without requiring a manual page refresh.

Edge cases to handle:

  • Prevent duplicate submissions if the user double-taps "Save."
  • Show a clear inline error if the insert fails (e.g., a network issue), without losing the user's entered form data.
  • Since primary_muscle is an ENUM column, make sure the dropdown can only submit valid values — no free text that could violate the constraint.

Keep styling consistent with the rest of the exercise library screens.

ProgressNot Started