Skip to content

feat: edit a finished match (names, commanders, partners)#65

Open
Jshewmaker wants to merge 13 commits into
mainfrom
feat/edit-match-details
Open

feat: edit a finished match (names, commanders, partners)#65
Jshewmaker wants to merge 13 commits into
mainfrom
feat/edit-match-details

Conversation

@Jshewmaker

Copy link
Copy Markdown
Owner

What & why

Adds inline editing of a finished match from the Match Details screen. After a game is over, a user can correct what was recorded for each player:

  • Player name
  • Commander (primary)
  • Partner commander

A pencil action in the app bar flips the screen into edit mode (app bar shows Save ✓ / Cancel ✕); tapping a commander opens a full-screen Scryfall search picker. Saving persists changes to the current user's saved copy of the match via the existing updateGameStats, and the change reflects back automatically through the live MatchHistoryBloc stream.

Spec: docs/superpowers/specs/2026-06-18-edit-match-details-design.md
Plan: docs/superpowers/plans/2026-06-18-edit-match-details.md

How it works

  • MatchEditCubit — owns a draft List<Player> during the edit session; save() builds game.copyWith(players: draft) and calls updateGameStats(game:, playerId: currentUserId). Save-error keeps the draft; cancel restores.
  • CommanderPickerCubit + CommanderPickerView — a lightweight, isolated full-screen picker that searches Scryfall and returns a Commander (primary or partner).
  • Shared magicCardToCommander helper — extracted from the live-game flow so both flows use one mapping (removes duplication).
  • EditablePlayerTile / MatchEditPlayersList / MatchDetailsAppBarActions — small, independently-tested widgets wired into both the phone and tablet views.

While editing, the Winner/Metadata cards are hidden and a single editable players list is shown — a deliberate refinement that avoids two competing editable controls for the winner.

Scope

  • Editable: name, commander, partner. Not editable: winner, placement, who-went-first, duration, room id, date.
  • Localized (en + es).
  • Known limitation: edits write only the current user's copy (users/{uid}/matches/{gameId}), mirroring existing delete/ownership behavior. Other participants' synced copies are not updated — a candidate follow-up.

Testing

  • flutter test24/24 passing.
  • Unit tests for MatchEditCubit (draft mutation, save success capturing the merged game, save-error preserves draft, cancel restores) and CommanderPickerCubit (legendary filter, failure path).
  • Widget tests for the picker (pop-value), EditablePlayerTile (all callbacks incl. partner add/change/remove), app-bar actions (edit↔save/cancel), and the players list (picker → draft update).
  • flutter analyze lib/match_details introduces 0 new lints (8 pre-existing info-level lints predate this feature).

Optional follow-ups (non-blocking, from final review)

  • Reset MatchEditCubit to viewing after the success snackbar (currently rests at sticky success; behavior correct today).
  • Add a view-level integration test driving the full edit → save → read-only loop through MatchDetailsView.
  • Track participant fan-out as a backlog item.

🤖 Generated with Claude Code

Jshewmaker and others added 13 commits June 18, 2026 10:01
Inline edit mode on the Match Details screen to update player names,
commanders, and partner commanders, persisted via updateGameStats.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bite-sized TDD plan: shared commander mapper, CommanderPickerCubit +
full-screen picker, MatchEditCubit draft/save, editable widgets, and
inline edit-mode wiring into the Match Details screen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant