13 Commits
Author SHA1 Message Date
Kevin BurchellandClaude Opus 4.8 f348d33192 Scoring: order-number badges on the fielder throw chain
Show the step in the sequence on each selected fielder: the primary fielder
gets a "1" badge (when a chain exists) and each Thrown-to fielder gets 2, 3,
… so a 4-6-3 reads 4(1) 6(2) 3(3) before recording. The badge uses --blue on
--surface so it stays legible in both themes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-19 19:32:23 -07:00
Kevin BurchellandClaude Opus 4.8 6762d5559c Fix outs not filling in light mode (circular --out-color)
The light-theme --out-color token was defined as var(--out-color) — a
self-reference, which is invalid, so .dot.out.on had no background and the
out dots never filled in while balls (green) and strikes (red) did. Dark mode
was unaffected because it redefines the token. Give it a real warm-grey value
so outs fill as they happen, and so the .t-out play-log text is readable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-18 16:25:19 -07:00
Kevin BurchellandClaude Opus 5.5 c6459ed68d At-bat bar: the batter in your scorecards, and career vs this pitcher
A second line under the at-bat bar shows how the batter has hit in your other
saved games (cached until My Games changes; today's game is left out — its chips
already show it) and their career line against the pitcher on the mound, from
MLB's vsPlayer stats (once per matchup; roster entries now keep MLB ids).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 14:20:59 -07:00
Kevin BurchellandClaude Opus 5.5 4e18ce3960 Full field view in the Bases card
An Infield / Full field switch on the Bases card (remembered per device). Full
field draws the home team's park: the outfield wall and warning track for all
30 parks, MLB's posted distance signs where the wall measures them, the foul
lines to the poles, and the same tappable bases and runner tags as the infield.
Walls come from the stadium editor (js/fields.js, generated).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 12:36:19 -07:00
Kevin BurchellandClaude Opus 5.5 f448b7584b Scorecard tab: no white chip behind the logo in dark mode
The dark-background logos are light-colored, so the white chip on the selected
tab hid them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:15:47 -07:00
Kevin BurchellandClaude Opus 5.5 71c985690b Team pickers in the box score; dark-mode team logos
- The box score's team names are the team pickers (tap the name to change
  team), so the separate picker row is gone and the buttons move up.
- Pickers are sized to the chosen team, not the longest name.
- In dark mode every team logo uses MLB's dark-background version, so dark
  logos like the Yankees' stay visible.
- Removed the old header-logo code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:00:58 -07:00
Kevin BurchellandClaude Opus 5.5 02a8184627 Two-column layout on laptop and desktop screens
At 1300px and wider, scoring controls stay on the left and the scorecard,
pitchers and play log sit in a column on the right that stays in view while
scrolling. Phones, iPads and printing keep the single column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:38:29 -07:00
Kevin BurchellandClaude Opus 5.5 56c44094e1 Postseason series view in My Games; synced games count as backed up
- My Games opens with a Postseason section: saved playoff games grouped by
  year, round and teams, with the series score, a chip per game, and gaps
  marked 'not scored'.
- The backup reminder no longer counts games whose saved version is already
  in the cloud on a synced device; the menu hint says 'Backed up by sync'.
- Sync: a game's updatedAt only ever grows, so two edits queued in the same
  millisecond while offline can't share a time and get the second rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 19:51:49 -07:00
Kevin BurchellandClaude Opus 5.5 2bf1bec49c Sync: a slow upload no longer blocks syncing; "Sync now" gives feedback
Bug: syncPush stayed "busy" until every upload reached the server. Firestore
holds queued writes until it's back online, so one slow upload made every
later sync (including "Sync now") silently do nothing. Now "busy" only
covers the scan, each game tracks its own in-flight upload so it isn't
queued twice, and later changes still upload.

"Sync now" shows Syncing…, then "✓ Synced at 1:05 PM — 2 games uploaded"
(or "nothing new to upload", or that uploads are queued on a slow
connection). The panel shows games on this device vs. in the cloud and
refreshes when other devices' changes arrive.

Tests: Sync now feedback/counts; a stuck upload doesn't block later syncs
(fails on the previous code). 52 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:02:51 -07:00
Kevin BurchellandClaude Opus 5.5 91296a1e5c Sync across devices with Firebase (waiting on project config)
- js/sync.js: email/password sign-in (☁ Sync in the menu), a status pill in
  the header, and a sync engine that fingerprints each saved game and uploads
  the changed ones a few seconds after scoring pauses (right away when a game
  ends or the app is hidden), uploads deletions as { deleted: true }, and
  applies other devices' changes from a live Firestore listener (including
  the game open on screen). Newer version wins; the losing older version is
  kept in My Games as a copy and left out of season stats.
- firestore.rules: owner-only access; updates must be newer than stored.
- Firebase compat SDK 12.19.0 bundled in js/vendor/firebase (Apache 2.0,
  license included); loaded only on signed-in devices and cached on first use.
- js/firebase-config.js is null until the Firebase project exists, so sync
  stays hidden and nothing extra loads.
- Tests: two simulated devices on an in-memory Firebase (7 cases incl.
  offline queue and conflict copy); 50 passing. README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:50:53 -07:00
Kevin BurchellandClaude Opus 5.5 54aaa10937 Earned runs by inning reconstruction; play-log lines linked to plays
- Earned runs (rule 9.16): a batter who reaches on an error counts as the
  out that should have been made; once real outs plus those reach three,
  later runs in the half-inning are unearned. A reliever gets no benefit
  from errors made before he entered. (Catch-up keeps MLB's own ER.)
- Plate appearances get ids (older games get them on load). The result
  line in the play log points at its play: editing it offers "Edit play"
  (opens the scorecard cell editor so stats follow), and deleting it asks
  whether to remove the play from the scorecard and stats too (undoable).
  Catch-up and "Add it" lines are linked as well; a hand "+ Out" now logs
  its own result line.
- Tests: three earned-run cases (2 outs + error + HR = 0 ER; 1 out case;
  reliever case) and three play-log cases. 43 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:19:50 -07:00
Kevin BurchellandClaude Opus 5.5 5925427369 Use the official 2026 ALDS logo in the postseason badge
The 2026 ALDS primary logo (from SportsLogos.net, trimmed and resized to
450 px; the dark variant was skipped because it carries a watermark and a
solid background) is bundled at assets/postseason/alds-2026.png and
precached (cache scorecard-v4). For ALDS games in 2026 the scorecard
badge, PDF header and Share final image show it with the game number;
other years and rounds keep the league-logo badge. POSTSEASON rounds can
carry an `official` logo per year for future additions.

Tests: 2026 ALDS badge uses the bundled logo and game number; other years
and rounds don't; every bundled logo exists and is in the offline cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:13:39 -07:00
Kevin BurchellandClaude Opus 5.5 2d1a1b5dbb Split into feature files, add tests and a README
- index.html (8.4k lines) becomes markup only; styles move to css/app.css
  and the script to nine feature files in js/ (data, game, scoring,
  render, scorecard, mlb, storage, reports, ui), loaded in order as plain
  scripts sharing one global scope. Code is unchanged apart from moving
  (checked character-for-character); a load-order check confirmed no code
  that runs at load uses a later file.
- sw.js precaches the new files (cache scorecard-v3) and revalidates with
  the server so a new page never runs with older cached scripts.
- Tests (npm test; node:test + jsdom, MLB fixtures, no network):
  * all four ALDS Game 1s caught up from an empty scorecard: 0 Check vs MLB
    differences, team RISP/LOB, score, every batter and pitcher line equal
    to MLB's box score; a hand-scored start + mid-at-bat catch-up
  * hand-scoring rules: strike three, ABS overturns, reaching on error,
    double plays, outs on the bases, counts kept on runner outs, RISP,
    innings pitched, inherited runners, Undo with log edits, cell editor,
    loading older saved games
  34 passing; GitHub Actions runs them on every push.
- README: what it does, running locally, code layout, tests, credits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 08:05:23 -07:00