Repository navigation
feat(share): a QR code on Share for hosts printing posters - #492
Conversation
UK hosts asked twice for a QR code for their posters. Share gets a closed "QR code for posters" row under the share buttons that opens a black-on-white code of the class link, one line on how to use it, and a print-size PNG download. The encoder (uqr 0.1.3, no dependencies) is its own chunk, fetched only when the row opens. - Disclosure atom on Radix Collapsible, for this row and the closed rows after it. - saveBlob and the ASCII file stem move to lib/download, shared with the calendar file. - On a phone, Share opens as tall as its content, like a class, so the row is in view; opening the row lifts the sheet to near-full. The desktop side panel and its settings cog stay put. - The code's spoken name is a repo a11y string, machine-translated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sync:translations fails on main until #466 (it still requests the dropped compact tab), so these four keys are copied from production's sy-atlas-translations verbatim. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Disclosure reuses the Drawer's canScroll rather than a second copy of it. - DrawerControl.expand is required, a no-op outside DrawerStack. - QrCode takes only label and url. - QrCode is keyed on the link, so a link that changes while the row is open never shows or downloads the old code. - An open Disclosure reveals itself only when it grows, so a visitor who scrolled back up is not pulled down by a resize. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The feature is the right size and the lib layer is clean, but the row costs more than the code it shows — two dependencies and three mechanisms (a Disclosure atom with its own scroll hunting, an expand verb, a snap rule) to keep a 3.7 KiB encoder behind a closed row inside an already-lazy view. One is redundant: useFitSnap grows the fitted sheet as the row opens, so expand only overshoots. With it gone, ask whether the closed row still earns the atom and the Radix dependency, or whether the code can just render in the Share body.
No ticket is linked here, so I judged the diff against its own body — which leaves its "ticket criteria" and "Blocked by" notes unverifiable. The contract holds: the four share.qr_* strings match SahajCloud's translationsSchema.json verbatim, and embedding.md needs nothing: its script-src row already covers a lazy same-origin chunk.
Findings
should-fix—DrawerStack.tsx:546: drop the wholeexpandchain;useFitSnapalready does it, at the better height.should-fix—qr.ts:33:uqrshipsrenderSVG; a printed poster wants vector.should-fix—translations.en.json:275: the reason given for hand-editing the generated snapshot is wrong.
What was checked. The whole diff; qr.ts, download.ts, Disclosure.tsx, QrPoster.tsx, ShareView.tsx, shared.tsx, DrawerStack.tsx, the three new specs, plus use-fit-snap.ts, Drawer.tsx (fitSheet pre-existed), sync-translations.mjs, translations.test.ts, embedding.md § CSP and the CHANGELOG. The ladder walked both dependencies: uqr 0.1.3's declarations, and the collapsible lock entry, which adds no transitive package. The streamliner covered 23 pieces and kept 17; two of four sketches held. reveal stays for a viewport too short to fit; initial, because SSR runs no effect.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`fitSheet` routes Share through `useFitSnap`, which observes the body and each child and re-resolves the fit snap as the QR row opens, reaching the near-full snap only when the content needs it. `expand` set that snap outright, so it overshot the fitted height and left the sheet there once the row closed again. Gone with it: `DrawerControl.expand`, the `NO_DRAWER_CONTROL` stub, the control memo's `direction` dependency, `QrPoster`'s `onOpen`, and ShareView's `useDrawerControl`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV1TjXm4oZ4aobaTjw
`PNG_TARGET_PX` had one caller. `qrPngScale` stays a named export because the node lane has no canvas: the print-resolution guarantee is only assertable through the arithmetic, not through `qrPngBlob`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV1TjXm4oZ4aobaTjw
|
Three critic threads addressed, and the branch is pushed for relay.
Lean gate ✓. Browser lane ✓, 10 scenarios, driving this sandbox's own Chromium. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
Co-Authored-By: Claude Opus 5.5 <[email protected]>
QrPoster takes the stories' and specs' initial state and starts open with it, so the failure copy (close and reopen) reads beside the row it refers to. QrCode is module-private again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md # DESIGN_SYSTEM.md
main reworked the geocoder field (#485, #495), the drawer snaps (#492, #495) and the panel header (#490) while this branch was open. Every hunk keeps both sides' behaviour. - `MapSearch` keeps this branch's controlled `value`/`onChange` — the Where step holds the draft's text, `SearchField` holds `?q` — and takes main's settle delay, measured results band and overlaying not-found message. Main's new spec held the text inside the field, so it now owns it the way both callers do; watched failing against the settle removed. - `NavHeader` takes main's `pendingTitle`, without its `t`: the X it named is this branch's `CloseButton`, which brings its own. - The mobile snap reads `opensTall(kind)` over main's `fitsContent`, so calendar, add and correct stay tall and event and Share still fit their own content. The two predicates are disjoint. - `EventHeader` takes a `title` rather than an event since #490, so the submit listing and its story pass one. - `CHANGELOG.md`, `DESIGN_SYSTEM.md` and the two import hunks are unions. DESIGN_SYSTEM.md is rebuilt on main's restructure, carrying this branch's `ProposalForm` row, `SubmitView`, `CloseButton` and the `Link` footnote note. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY4MwaWAk4ZhpqxBB5
Summary
uqrencoder (0.1.3, no dependencies) is its own 3.7 KiB chunk, fetched only when the row opens.Change outline
Components — Share view
The row sits under the share buttons. Its panel is unmounted while closed, so nothing loads until someone opens it.
Behaviour — the phone sheet's snap (
DrawerStack)Share now uses the fit snap the event view already had, and nothing else.
useFitSnapobserves the body and each of its children, so the sheet grows with the row as it opens and settles back as it closes, reaching the near-full snap only when the code needs that height.Behaviour — Disclosure reveals itself
Opening the row scrolls its own scroll container, never the host page, just far enough to show the panel. It re-runs only when the panel grows (spinner → code), so a visitor who scrolled back up stays put.
Files
Preview
DisclosureandQrPoster(incl. the failed state) — preview pendingContract impact
Host-observable, recorded in
CHANGELOG.md: a new script chunk fromsahajatlas.com, fetched on open. A CSP that already allows the widget'sscript-srcneeds no change, sodocs/embedding.mdis unchanged. Neither in-tree host (WeMeditateWeblib/atlas-embed.ts, the WordPress templates) needs a change.Test results
--full: ✓ lint, typecheck, 194 files / 2481 tests passed, build, sizeuqris not in the eager graphqr.test.ts(quiet zone, finder, ECC M → version 5, PNG ≥ 1000 px, file names),Disclosure.test.tsx,QrPoster.test.tsxManual verification
<class-title>-qr.png, about 1170 px square.Notes for reviewer
sync:translationsnever requests acompacttab —WIDGET_TABSandWIDGET_TRANSLATION_TABSlist the same nine without it. The drift runs the other way: the snapshot carriescompact.open, whichCompactEmbedView.tsx:83and:87render and SahajCloud#1268 dropped upstream. So the bare command exits 1 on that drift, and a--writewould rewrite the snapshot from the nine requested tabs and deletecompactwith it. The four keys shipped in SahajCloud#1276 and are copied verbatim from production; a sync reproduces them only oncecompactis settled (feat(widget): open every embed inline; expand the map over the page #466).@radix-ui/react-collapsiblebacks the newDisclosureatom, by choice over a hand-rolled row. That breaks the ticket's "uqr is the only new dependency" criterion.wemeditate.com./simplifyand/code-review highran;/security-reviewran (package.json, lockfile) with no findings.Detail
Review findings fixed:
QrCodekeyed on the link, so a link that changes while the row is open never shows or downloads the old code. Reveal only on growth. Disclosure reuses the Drawer'scanScroll. DESIGN_SYSTEM.md lists both new components.Dismissed:
toBlobyields null. It yields null only for a zero-size or over-limit canvas; this one is ~1170 px with a 2d context it creates itself.import('uqr'). Verified in Chromium: blocking the chunk once, then closing and reopening, refetched it and drew the code. Safari and Firefox not checked.Addressed from the adversarial review: the
expandchain is gone (useFitSnapalready lifts the fitted sheet, and at the better height),PNG_TARGET_PXis folded intoqrPngScale, and the translations note above is corrected. PNG stays overuqr'srenderSVG— see the review thread onqr.ts. Closing the row now also brings the sheet back down, whichexpandhad prevented.Measured on the dev server: 0
uqrrequests before opening, exactly 1 after. The on-screen code matches an independent encode of the Copy link value. Download bottom after open: 813/844 (390×844), 651/667 (375×667), 767/800 (desktop); hostscrollYstays 0.🤖 Generated with Claude Code