Skip to content

As a user I want to save a recommended exercise to my library directly from the report page so I can build my programme without leaving my analysis #113

@ChristopherRotnes

Description

@ChristopherRotnes

Summary

The report page shows recommended exercises with a + button. Currently the button navigates to Bibliotek, which closes the analysis and forces the user to re-upload photos to get recommendations again. The + button should instead save the exercise directly to the exercise library in the background, with inline confirmation, so the user never leaves the report page.

Priority

Medium

UI spec (Carbon g100)

  • Pressing + on a recommendation row calls the existing addLibraryExercise (or equivalent) Supabase insert in the background
  • On success: button changes to a checkmark icon (Checkmark from @carbon/icons-react), disabled, for ~2 s then stays as checkmark (grayed out) to signal already saved
  • On duplicate (exercise name already exists in library): show the checkmark immediately — treat as success, not error
  • On error: show a brief inline InlineNotification kind="error" at the top of the recommendation section; button returns to +
  • No navigation away from the report page
  • No modal or confirmation dialog — one-tap save

Data model

No schema changes. Uses the existing exercise_library table and addLibraryExercise function in db.js.
The saved exercise should use the recommended exercise name and its primary/secondary muscle arrays. default_sets and default_reps can be left null (user can fill in Bibliotek later).

Acceptance criteria

  • Tapping + on a recommendation row saves the exercise to exercise_library without navigating away
  • Button shows a checkmark and becomes disabled after a successful save
  • Pressing + on an already-saved exercise shows checkmark immediately (no duplicate insert, no error)
  • A save error shows an inline error notification; button remains pressable
  • Sticky CTA ("Disse bør du legge inn i programmet →") is kept but can be updated to say "Gå til biblioteket →" if desired — out of scope to decide here

Out of scope

  • Editing sets/reps inline before saving
  • Saving all recommendations at once
  • Navigating to Bibliotek after save

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions