Repository navigation
feat: open the product image larger, with zoom, when the buyer taps it - #20
Conversation
Tapping the shirt on a product page did nothing, and on a phone its 1199 x 1312 drawing is shown about 330 px wide: too small to see the print before buying. The image is now a button that opens a dialog. The shirt is drawn again at twice the page's scale in the colour picked, fitted to the screen, and a tap on it (or its zoom button, from the keyboard) zooms in 2.5x keeping that point under the finger; the buyer moves around by dragging, scrolling or with the arrow keys. The dialog opens at once with a spinner and draws once it has painted, so the tap is answered even on a slow phone, and a colour already drawn is not drawn again. A drag that only ends on the backdrop does not close it, and a turned phone or resized window goes back to the whole shirt. The zoom numbers and scroll math live in the pure zoom.js; the dialog is image-viewer.js, driven by two browser scenarios (desktop and phone). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wLvLxLyWs3XJWb1qwvr5B
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. WalkthroughProduct pages now open an enlarged image viewer. The viewer draws the selected product at a larger scale, supports point-centered zoom and panning, and closes through its controls or Escape. Product pages, translations, styles, documentation, and tests include the viewer. ChangesProduct Image Viewer
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
actor Shopper
participant product-page.js
participant image-viewer.js
participant ProductCanvas
Shopper->>product-page.js: Click product-zoom
product-page.js->>image-viewer.js: Open with product, color, label, and draw callback
image-viewer.js->>ProductCanvas: Draw at VIEWER_SCALE when color key changes
Shopper->>image-viewer.js: Tap image to toggle zoom
Possibly related PRs
Merge Risk:
|
What
On a product page, tapping the shirt image did nothing. It now opens a dialog with the shirt larger, so the buyer can look at the print up close before buying.
#product-zoom, labelled "View larger image"), with a magnifier badge in its corner so it looks tappable.VIEWER_SCALE = 2, a 2398 × 2624 canvas) in the colour picked, fitted to the screen. The title is the product and colour, e.g. "Mostro Invaders T-shirt in navy blue".ZOOM_FACTOR) and keeps the tapped point under the finger. Another tap zooms back out. The buyer moves around by dragging (touch), scrolling or the arrow keys (the stage is focusable, since Safari does not focus a scroller by itself). The zoom button in the header does the same from the keyboard, centred, witharia-pressed.Why this way
src/store/zoom.jswith unit tests at 100%.src/store/image-viewer.jsonly measures and wires events, likesize-guide.js.<dialog>as the size guide does, CSSOM only for the zoomed width (allowed bystyle-src 'self'), and text throughel()/textContent. The CSP is untouched.Decision for the maintainer
The spec said scale 1 was the largest drawing, so a design file larger than the print area was never seen. That is no longer true. At scale 2 a series' text is sharp when zoomed, and a design file up to twice the print area (1060 × 1400 px) shows its extra detail in the zoomed view.
designs/invaders-design.png(1070 × 1470) already does. The six arcade designs were shrunk to scale-1 size in 5a10f81, so they look upscaled when zoomed. Larger source files for them would make the zoom worth more, at the cost of a heavier collection page. That trade-off is left to you; this PR only updates the spec sentence to describe it (docs/SPEC.md, "Add a full design"). The shirt itself is the 1199 × 1312 base photo, upscaled; no file change would give it more detail.Files
src/store/zoom.js(new, pure) andtests/store/zoom.test.js.src/store/image-viewer.js(new, DOM).src/store/product-page.js: opens the viewer.product.html: the button. The 16<id>.htmlpages were regenerated withnpm run seo.css/store.css: the badge, the dialog and the spinner. The stage gradient became a--stage-backdroptoken shared with.product-stage.src/store/icons.js: thezoomInandzoomOuticons.src/store/strings/{en,es,fr,it,pt}.js:enlargeImage,zoomImage,zoomHintin all five languages.docs/SPEC.md,AGENTS.md,README.md: the new behaviour and modules.Test plan
npm run coverage: 297/297 unit tests, 100% lines, branches and functions.npm run coverage:all: 38/38 browser tests, 100% combined line coverage ofsrc/.🤖 Generated with Claude Code
https://claude.ai/code/session_016wLvLxLyWs3XJWb1qwvr5B
Summary by CodeRabbit