Skip to content

Edit court names mid-session #39

@javaisbetterthanpython

Description

@javaisbetterthanpython

Summary

Court names/labels can be customized at game setup on /new, but mid-session there is no way to rename courts. The in-game Edit courts modal (CourtsModal) only changes court countstate.courtNames is never updated after new-game, and rounds always display the current global names (state.courtNames[index] || index + 1).

Organizers often need to relabel courts when rotating groups, when a court becomes unavailable, or when physical court numbers do not match the default 1-based sequence.

Current behavior

  • Setup (/new): "Customize court names" toggle, per-court inputs, quick-set presets (1,2,3… / evens / odds), validation for empty/duplicate names.
  • In-game (/rounds): Court button opens CourtsModal with count only; labels are read-only.
  • Display: All rounds (including historical) use the current state.courtNames; there is no per-round court-name snapshot (unlike player names in Edit player names (in-game + setup) #31).
  • Count changes: editCourts updates courts but does not resize or reconcile courtNames.

UX

  • Where: Extend the existing Edit courts modal on /rounds (and optionally keep /new in sync when returning to setup — already loads state.courtNames).
  • Control: When customizing, show the same per-court name inputs and quick-set presets as /new.
  • Toggle: "Customize court names" switch — when off, display defaults (1, 2, 3… by court index).
  • Save paths:
    • Rename only (count unchanged): apply immediately — no round regeneration required.
    • Count changed: existing Redo round / New round flows unchanged; reconcile courtNames length (truncate extras, default-fill new slots).
  • Validation: Same as setup — non-empty when customizing, no duplicate trimmed names.

Historical rounds

  • Default: Renaming courts updates labels on all rounds (past and current), since court index → label is a display concern, not match data.
  • Optional stretch: Per-round court-name snapshot if we later need "Court A was called Court 3 in round 1" — out of scope unless requested.

Acceptance criteria

  • Court names editable mid-session from the courts modal on /rounds
  • Customize toggle + per-court inputs + quick-set presets (parity with /new)
  • Name-only edits apply without regenerating the current round
  • Count change reconciles courtNames array length and preserves existing names where possible
  • Empty/duplicate name validation matches setup behavior
  • Updated names persist in session cache (localStorage)
  • All rounds display updated court labels immediately
  • yarn test:ci and yarn build pass

Files likely touched

  • src/CourtsModal.tsx — add name editing UI
  • src/useShuffler.tsx — new action (e.g. edit-court-names) and editCourts reconciliation for courtNames
  • pages/rounds.tsx — wire modal submit for name-only vs count changes
  • pages/new.tsx — optional: extract shared court-name inputs component to avoid duplication

Dependencies

none

Related

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