Skip to content

As an instructor I want to photograph a gym whiteboard and have it create a gruppetime template so I don't have to enter exercises manually #203

@ChristopherRotnes

Description

@ChristopherRotnes

Summary

Instructors currently photograph a whiteboard to log a session, but the OCR flow lands in the MuscleMap confirm step and does not offer to save the result as a reusable gruppetime template. A separate camera entry point in the Sett-sammen tab should let instructors capture a whiteboard, review the parsed exercise list, and save it directly as a named template in the library — without logging an actual session.

Priority

Medium

UI spec (Carbon g100)

  • Entry point: «Knips tavla» featured card in SetSammen landing (below the two existing ActionCards), using the Camera Carbon icon; same two-color treatment as the existing cards
  • Flow:
    1. Camera/file picker opens (same <input type="file" accept="image/*" capture="environment"> pattern as MuscleMap)
    2. Image compressed via existing compressImage util — same 5 MB base64 limit
    3. Synchronous Claude Vision call via /api/claude (same proxy, no jobId, no polling)
    4. Result lands in a review step: editable exercise list (same ExerciseRow pattern), template name TextInput at the top, live BodyPanel coverage preview
    5. «Lagre som mal» Button kind="primary" saves via replaceTemplateExercises + saveTemplate; navigates to GruppetimePicker on success
    6. «Avbryt» discards and returns to SetSammen landing
  • Error states: InlineNotification for compression failure, Claude error, or save failure — same patterns as MuscleMap upload step
  • No session is created — this flow is template-only

Data model

No schema changes. Uses existing session_templates + session_template_exercises tables and existing replaceTemplateExercises / saveTemplate db.js functions.

The analyze prompt (ANALYZE_PROMPT in prompts.js) is reused as-is — output shape is identical to the session log flow.

Acceptance criteria

  • «Knips tavla» entry point visible on SetSammen landing
  • Camera/file picker opens on tap; image compressed to within Anthropic 5 MB base64 limit
  • Claude Vision call is synchronous — no polling, no jobId
  • Parsed exercises shown in editable review step with live body map
  • Template name field required before save is enabled
  • Saved template appears in GruppetimePicker immediately after save
  • No session row is created in sessions table
  • Error states handled with InlineNotification (compression, Claude, save)
  • Flow works on iPhone Safari (HEIF image, iOS canvas quirks — see known pitfall fix: surface API errors, compress HEIF images, fix sessions vanished, fix slow load #173)

Out of scope

  • Multi-image capture in one template
  • Editing the template after creation (use GruppetimeEditor for that)
  • Session logging from this flow

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