Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

better game browser. right now the list is kinda lame. i would love to see mo… #47

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

The home page now shows the games as a card grid with a search box and kind filter chips, instead of the plain list. I ran only serve.test.mjs and shell.test.mjs, and they pass. I haven't opened the page in a browser, so the look and the filter UI are unchecked.

Notes

shipped production is serving it deploy ab54f53

opened this

The home page now shows the games as a card grid with a search box and kind filter chips, instead of the plain list. I ran only serve.test.mjs and shell.test.mjs, and they pass. I haven't opened the page in a browser, so the look and the filter UI are unchecked. bun x tsc --noEmit only printed its usage text, because the repo has no tsconfig, so it didn't type-check anything. I didn't run scripts/design-lint.ts or scripts/fast.ts.

Issue #44 has no body and its title is cut off ("i would love to see mo…"). I guessed it meant a richer, more visual browser and built that. If it meant something else, say so.

What changed

  • Card metadata: each GAMES entry in shell.js now has a kind (Sport, Throwing, Timing, Catching, Precision or Racing), an input (Tap, Hold or Drag) and an accent colour. I assigned all 19 myself, so check they suit you.
  • Cards: each card has a top bar in its game's accent colour. It also shows a "KIND · INPUT" line, the title and the blurb. The whole card is the link, and there is a visible focus outline.
  • Search and filters: the search matches every word against title, blurb, kind and input. The chips filter by kind, and there is a "No game matches." message when nothing fits.
  • No-JS fallback: the static list in index.html carries the same cards. The search and chips only appear when scripts run.
  • Tests: serve.test.mjs checks every game has valid metadata that matches the static list, and covers filterGames.
  • Docs: the README's "Add a game" section says to set the new fields.

Not done

  • Thumbnails: the colour bar stands in for them. Games render on a canvas and the repo ships no image assets, so real thumbnails would need either a screenshot step or a canvas preview.
  • Search persistence: the search and filter aren't kept in the URL.

To try it: run node serve.mjs and open http://127.0.0.1:5300/.

I also had to stage files by name, because git add -A choked on a .bash_profile in the clone.

🤖 Generated with Claude Code

Closes #44

2 earlier comments · 2 events
commented

The home page now shows the games as a card grid with a search box and kind filter chips, instead of the plain list. I ran only serve.test.mjs and shell.test.mjs, and they pass. I haven't opened the page in a browser, so the look and the filter UI are unchecked. bun x tsc --noEmit only printed its usage text, because the repo has no tsconfig, so it didn't type-check anything. I didn't run scripts/design-lint.ts or scripts/fast.ts.

Issue #44 has no body and its title is cut off ("i would love to see mo…"). I guessed it meant a richer, more visual browser and built that. If it meant something else, say so.

What changed

  • Card metadata: each GAMES entry in shell.js now has a kind (Sport, Throwing, Timing, Catching, Precision or Racing), an input (Tap, Hold or Drag) and an accent colour. I assigned all 19 myself, so check they suit you.
  • Cards: each card has a top bar in its game's accent colour. It also shows a "KIND · INPUT" line, the title and the blurb. The whole card is the link, and there is a visible focus outline.
  • Search and filters: the search matches every word against title, blurb, kind and input. The chips filter by kind, and there is a "No game matches." message when nothing fits.
  • No-JS fallback: the static list in index.html carries the same cards. The search and chips only appear when scripts run.
  • Tests: serve.test.mjs checks every game has valid metadata that matches the static list, and covers filterGames.
  • Docs: the README's "Add a game" section says to set the new fields.

Not done

  • Thumbnails: the colour bar stands in for them. Games render on a canvas and the repo ships no image assets, so real thumbnails would need either a screenshot step or a canvas preview.
  • Search persistence: the search and filter aren't kept in the URL.

To try it: run node serve.mjs and open http://127.0.0.1:5300/.

I also had to stage files by name, because git add -A choked on a .bash_profile in the clone.

🤖 Generated with Claude Code

Changes requested — before the latest push

The card grid fits the issue. The no-JS fallback is kept, the forged-by-crew notes and the footer credits are still there, and serve.test.mjs + shell.test.mjs pass on the preview's files (24/24). The static home page has no writes, sessions or terminal, so the security and tty checks don't apply. Please fix these in one round:

  1. Fix first: the layout shifts on every load. The .tools row is display:none until html.js is set, and that only happens in the script at the end of <body>. So the browser paints the static grid first. Then the search box and chips appear and push every card down by about 100px. Set the class from a one-line inline script in <head> (<script>document.documentElement.classList.add('js')</script>). Also give #kinds a min-height so the chips filling in later don't move anything.
  2. Free Throw is tagged with the wrong input. It is tagged Tap, but its own blurb says "hold to crouch and build power, release to jump", and the page uses pointerdown/pointerup. It should be Hold. Fix it in shell.js and in the static <li>.
  3. Searches and filters can't be shared or bookmarked. Keep q and kind in the URL: read location.search on load and history.replaceState on change. Then a link like /?kind=Precision reproduces the view. Make the .tools a <form method=get> so the URL format is the same with or without scripts. Add a test that filterGames gets the parsed params, or factor out a tiny parseBrowse(search) and test that.
  4. Screen readers hear the whole list on every keystroke. aria-live="polite" on <ul id="games"> re-reads every card each time you type. Remove it. Add one <p role="status"> instead that says "7 games" or "No game matches." (that can replace #none).
  5. The test doesn't catch a mistyped kind. It checks kind with toBeTruthy(), so a typo like 'Precison' would pass and add a stray one-game chip. Check it against the fixed list the GAMES comment names (Sport, Throwing, Timing, Catching, Precision, Racing), the same way input is checked.
commented

All five points are addressed on the branch and pushed. serve.test.mjs and shell.test.mjs pass (26/26), but I haven't opened the page in a browser to check the layout shift is gone.

  1. Layout shift: the js class is now set by an inline script in <head>, so the search and chips are laid out before the grid paints. #kinds has a min-height, and the status line reserves its height too.
  2. Free Throw: its input is now Hold in shell.js and in the static <li>, including the tags line.
  3. Shareable URL:

- .tools is now a <form method="get"> with name="q", and each chip is a submit button named kind. - parseBrowse(search) reads q and kind on load. An unknown kind is dropped and the query is trimmed to 80 characters. - browseUrl() builds the address, and history.replaceState updates it on every change. /?kind=Precision reproduces the view. - Tests cover parseBrowse, including a mistyped kind, and that its result feeds filterGames.

  1. Screen readers: I removed aria-live from the list. A single <p role="status"> now says "N games", "1 game" or "No game matches.", and replaces #none.
  2. Kind check: the test now checks kind against Sport, Throwing, Timing, Catching, Precision and Racing, so a typo fails it.

The static server doesn't filter, so without JavaScript the form just reloads the full list. I left the search row hidden without JS, since a control that does nothing there would mislead.

🤖 Generated with Claude Code

Approved — before the latest push

All five asks from the last round are met. I checked each one on the preview at this head.

  1. Layout shift: met. <head> now holds document.documentElement.classList.add('js'), so .tools gets laid out before the grid paints. #kinds and #status reserve their height, and a test pins the head script.
  2. Free Throw input: met. It is Hold in shell.js, on the static <li> and on its tags line.
  3. Shareable URL: met. .tools is a <form method=get>. parseBrowse drops a kind it doesn't know and trims q to 80 characters, and history.replaceState keeps the address current. /?kind=Precision and /?q=apple both answer 200 on the preview. Tests cover a mistyped kind, a long query, and the parsed view feeding filterGames.
  4. Screen readers: met. aria-live is gone from the list. One <p role="status"> says N games, 1 game or "No game matches.", and a test asserts it.
  5. Mistyped kind: met. kind is now checked against the fixed list of six.

The page has no writes, sessions or terminal (forge.json declares no tty), so the security and terminal checks don't apply. Output goes through textContent, and the accents come from constants in GAMES. The footer credits and the forged-by-crew notes are intact.

Non-blocking:

  • The chips are type=button, so the kinds click listener's preventDefault does nothing and could go.
  • #status is declared in two separate rules that could be one.
  • The branch was cut before #46. When I ran this head's shell.js against main's shell.test.mjs, the two metrics tests failed because track() isn't in it. The textual merge looks clean, but rebase onto main before landing so the forge's check runs on the combined file.
commented

I merged main into the branch, resolved the two conflicts, and pushed. bun test serve.test.mjs passes (31 tests, 0 failures); I didn't run the rest of the suite here, since the forge runs the full check on the push. scripts/fast.ts doesn't exist in this clone, so I ran that one file directly. bun x tsc --noEmit printed only its usage text and no type errors, which means the type check didn't actually run (there is probably no tsconfig.json). I didn't run bun scripts/design-lint.ts either.

  • README.md: the "Add a game" paragraph keeps the card grid, search and kind-filter wording from this branch. It also keeps main's step to run bun scripts/og.mjs for the share card and tags.
  • serve.test.mjs: I took main's file and appended this branch's tests unchanged. These are the kind/input/accent checks, filterGames, parseBrowse and the home-page form checks.
Approved

The only change since 9161d89 is c75faf1, a merge of main (#46 metrics, #48 share cards). The merge is clean: git diff ecaabdf c75faf1 is exactly this pull's four files and nothing else. The README paragraph keeps the card, search and filter wording and gains main's bun scripts/og.mjs step. index.html keeps the og:begin/og:end block and the footer's "Most played" link. shell.js keeps track(id) beside the new filterGames/parseBrowse/browseUrl/kindsOf. The new tests are appended after main's in serve.test.mjs.

Earlier asks:

  • Round 1, items 1–5 (layout shift, Free Throw Hold, shareable URL, one status line, kind checked against the six): still met, and the code is unchanged since I approved it.
  • Round 2, non-blocking rebase onto main: met. On this head, bun test serve.test.mjs shell.test.mjs stats.test.mjs limits.test.mjs passes 45/0, including the metrics tests that failed against the old head and the og staleness check.

On the preview: /, /?kind=Precision, /?q=apple, /stats/, /api/stats, /og/home.png and /orchard/ all answer 200. The home page carries all 19 data-kind cards and the og image tag, and the served shell.js has both parseBrowse and track. The page has no writes, sessions or terminal, so the security and tty items don't apply.

Non-blocking, carried over and not reopened: the no-op preventDefault click listener on #kinds, and the two separate #status rules.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs