Skip to content

Show a picture of each prototype on its gallery card - #15

Draft
bcsfreitas wants to merge 5 commits into
mainfrom
gallery-thumbnails
Draft

bcsfreitas wants to merge 5 commits into
mainfrom
gallery-thumbnails

Conversation

@bcsfreitas

Copy link
Copy Markdown
Collaborator

Each prototype card in the gallery now shows a picture of the prototype's first view, instead of only an icon.

What changes

  • Cards show a picture. A 16:10 still image of the first view in the tree's order, rendered alone in its system's preview document. Prototypes with no view (empty, or only documents, diagrams or canvases) show a quiet placeholder of the same size. List view and Home are unchanged.
  • Pictures refresh on their own locally. While the dev server runs, about 4 s after a prototype stops changing, its picture is retaken if it is missing or stale. This happens only for prototypes the running contributor may change, one at a time, in one shared headless Chromium.
  • A command for agents. yarn studio thumbnails [<folder>…] [--missing] [--stale] [--yes] [--json] previews, then takes pictures.
  • The deployed site uses committed pictures. The build copies them to _thumbnails/<id>.jpg and never needs a browser. A missing picture never fails the build, and build:inspect checks every picture the manifest names.
  • Pictures follow the prototype. Renames and moves carry them, duplicates copy them, and rebuild copies read stale.

Storage: .thumbnail.jpg (JPEG q80, 640×400, roughly 20–80 KB) plus .thumbnail.json (artifactId, fingerprint, capturedAt) at each prototype's top level.

Decisions

  • The picture is always the first view, with no chooser (Bernardo's call).
  • No new automated tests (Bernardo's call). Each ticket was checked in a real browser, and the existing suites still pass.
  • STUDIO_THUMBNAILS=off turns automatic capture off. The e2e harness sets it so a background Chromium never competes with a scenario.
  • Existing prototypes get their pictures only when someone commits them, either by running the command or through their next local edit.

Checks

Last full run of yarn lint, typecheck, format:check and test (1020 passed), build and build:inspect: all green on the merged tree (69f69fa minus the last commit). The last commit (69f69fa) only turns automatic pictures off for the e2e harness, and after it typecheck passed. The e2e files prototype-gallery, organize-prototypes, live-updates and deployed-site then passed 46 of 46.

yarn studio thumbnails [<folder>...] [--missing] [--stale] [--yes] [--json]
captures a prototype's first view, alone in its system's preview document,
in headless Chromium (1280x800 at scale 0.5, JPEG q80) into .thumbnail.jpg
and .thumbnail.json. It previews first, writes with --yes, works only in
prototypes the contributor may change, keeps the old picture when the view
errors or is empty, and reuses the running dev server's preview documents
or starts its own.

The manifest gives each prototype with a picture thumbnail { url, stale },
where stale compares a fingerprint of its files and system. The dev server
serves pictures from the prototype's folder; the build copies them to
_thumbnails/<id>.jpg and build:inspect checks every one it names.

CollectionCard gains an image prop: prototype cards show the picture in a
16:10 area, or a placeholder with the prototype icon, fading in without
layout shift and without animation under reduced motion. List view, Home
and system cards are unchanged.

The dev server's preview-document servers move to
tooling/preview/dev-documents.ts so the command can run them too.
Duplicating already copied .thumbnail.jpg and .thumbnail.json (dot files
aren't skipped) and rewrote the record's artifactId with the other IDs.
Now a plain duplicate's record gets the copy's fingerprint when the
original's picture was current, since new IDs don't change what it
shows, and a rebuild copy's record gets an empty fingerprint so it reads
stale until it is rebuilt. Renames, moves, archiving and restoring carry
the files inside the folder unchanged.

systemVersion accepts anything with a dir, so the organizer can look up
the system's version without loading the registry.
The manifest watcher's changed files now also feed tooling/thumbnails/auto.ts.
A change inside a prototype marks it; about 4 s after its last change, its
first view is captured when its picture is missing or stale and the running
contributor may change it (own prototypes, or any as an Admin; never archived
ones or ones whose system was deleted). Captures run one at a time in one
shared headless Chromium, launched on first need and closed after 3 idle
minutes or when the dev server closes.

Hidden files never mark a prototype, so writing .thumbnail.* causes no
capture loop; its manifest refresh carries the new address to open
galleries. A view that errors keeps its last picture. A lock in the system's
temporary folder lets only one dev server of a checkout capture at a time.
Without Playwright's Chromium the dev server logs one line and stops trying.
STUDIO_THUMBNAILS=off skips automatic capture for one dev server. The e2e
harness sets it so a background Chromium never competes with a scenario
for the machine.
@netlify

netlify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for ea-prototyping-playground ready!

Name Link
🔨 Latest commit 69f69fa
🔍 Latest deploy log https://app.netlify.com/projects/ea-prototyping-playground/deploys/6b004bda7e4876706bbb02f6
😎 Deploy Preview https://deploy-preview-15--ea-prototyping-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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