Repository navigation
feat(setup): country stickers on the Residence step (TASK-24899) - #4114
Conversation
Konrad approved three stickers per country for the sign-up Residence step (TASK-24899). They ship as 320 px webp files in public/ so they load only when a sticker country is shown and stay out of the JS bundle. The typed map is the one place that names a country's three files, and the approved-assets page lists them so the inventory stays complete.
…idence step The Residence step showed a generic loop. Konrad approved a country easter egg instead (TASK-24899): the mascot waves, and when the residence country is one of the 20 sticker countries it cheers while that country's three stickers are slapped on and landing-page stars and sparkles twinkle. The celebration never starts in the first 2 s after the hero arrives, so a country prefilled from geo still gets the wave; a country picked by hand celebrates at once. The sequence is CSS only (delays per element), so reduced motion shows everything at once and nothing can block the country pickers. The residence loop file has no user left and is removed.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The ds-lint ratchet counts inline styles and does not let the count rise. The per-element delay index now comes from the data attribute rules that already place each sticker and decoration.
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
Code-analysis diffPainscore total: 11090.26 → 11102.19 (+11.93) 🆕 New findings (57)
…and 37 more. ✅ Resolved (49)
…and 29 more. 📈 Painscore deltas (top movers)
|
…fset The onboarding shell already reserves the top inset above the hero, so inside the hero the top bar ends 3.5rem down. Adding the inset again pushed the two top stickers 59px too low on notched phones and shrank them on compact screens.
The compare view and Back unmount the hero, so the 2 s wave replayed on every return. The flow provider now remembers that the wave has run and a remount with a country celebrates at once. The sticker layer started its slap before the three files arrived, so a slow connection animated empty boxes. The layer now waits for the files, with a 1.5 s limit so a failed fetch never blocks the celebration. The cheering pose is fetched only for a sticker country; other visitors never need it.
The frame counter survives a pose change. Going from a 53-frame pose to a 22-frame one left it past the end after a single subtraction, so one held tick asked Lottie for a frame that does not exist. Poses that never swap behave as before.
…atic files Without a rule they fall back to the default header and are refetched on each sign-up visit.
…work Fitting each pose's artwork to the box makes every pose look the same size in isolation, but two poses swapped in one box then change scale: the cheering artwork includes the jump, so the figure came out a fifth smaller than the waving one. With fit="canvas" both poses keep the rig's own scale and ground line. The default is unchanged.
Visual QA against the approved mock: - Both poses now share one canvas box, as in the mock, sized to the hero under the top bar. The mascot no longer shrinks or jumps when it starts to cheer, and stickers are capped at 40% of its canvas so it dominates on short phones too. - The picture is laid out in a box centred on the mascot and never much taller than wide, so on a tall desktop column the stickers stay around the peanut instead of at the column's ends. - The celebration waits for the cheering pose as well as the stickers, so the mascot never blanks, and a country picked by hand waits 400 ms for the picker to close so the first slap is seen. - A hero that mounts already celebrating draws its final state at once.
The gate preloaded /residence-stickers/x.webp while next/image rendered x.webp?dpl=..., so every sticker was fetched twice and the gate never warmed the image on screen. The stickers are now plain img elements with the preloaded URL: one fetch each. A sticker whose file fails is left out instead of showing a broken-image box; the cheer and the other stickers carry on. The mascot now leaves the wave only once the cheering chunk has loaded, with no time limit and under reduced motion too. The 1.5 s fallback releases the stickers only, so a slow chunk no longer blanks the mascot.
The residence hero swaps waving-hello for cheering on a running clock. A single subtraction left the carried frame past the shorter loop's end; this pins the modulo.
There was a problem hiding this comment.
Chip review — no blocking findings — this is not an approval
Two minor findings: early sticker animation after a country pick during the opening wave, and stale Residence animation guidance.
Findings
-
MINOR · src/components/Setup/components/ResidenceHero.tsx:91 · Country picks near wave end can animate behind the closing picker
Pick a sticker country about 1.9 seconds after the Residence hero mounts, with the pose and sticker files cached.residenceWaveDone.currentis still false here, so the 400 ms picker hold is skipped; the wave ends at 2 seconds and the sticker slap starts 120 ms later, before the picker has finished closing. Preserve the 400 ms delay from a manual selection independently of the remaining wave time (celebrate after both gates), and cover a pick near the wave boundary. -
MINOR · src/components/Setup/Setup.consts.tsx:41 · Residence animation guide still points to the deleted loop
The monoengineering/ui/signup-hero-loops.mdguide still listsresidence.jsonas the Residence screen asset and instructs maintainers to replace that file to change its loop. This step now rendersResidenceHeroand the JSON is deleted, so that instruction cannot work. Update the guide to describe the new hero and sticker asset workflow alongside this change.
Checked clean
- Exact head and base SHA, PR metadata, and changed-code diff verified; no issue or review comments fetched.
- Residence preload failure, slow pose, reduced motion, country swaps, and shared mascot pose sizing/clock reviewed against implementation and tests.
- Design rulebook and signup hero guide checked; no security, privacy, or money surface in this diff.
- CI at this head was still in progress at the latest check (including unit and typecheck); completed checks observed were successful or skipped.
Security review: did not run — this change has no security, privacy or money surface, so it was not asked. This review is one reviewer short.
Third opinion by claude-opus: 0 finding(s), marked with the model name. It answers only product truth, missing tests and the cross-repo contract, so treat its findings as advice.
Copy check by claude-haiku-5-5: 0 finding(s), titled "Copy now wrong". Every quoted passage was checked against the file.
Exact head: cd5bb7218b6a · Context: repo, design, engineering · Took 3m (queued 2m)
The 400 ms picker hold only applied after the wave, so a country picked just before the wave ended slapped its stickers behind the closing picker (Chip review). Any country that arrives after the mount now gets the hold; for the geo prefill it runs out inside the wave and changes nothing.
Summary
The sign-up Residence step showed a generic loop. Konrad approved a country easter egg instead. The approved mock is mono
_temp/residence-easter-eggs/picker/template.html; the doc is monoengineering/ui/signup-hero-loops.md.waving-hello.cheering, the country's three stickers are slapped on 170 ms apart, and five landing-page stars and sparkles pop in and twinkle. The stickers keep a slow idle wobble.Task
TASK-24899 — https://app.notion.com/p/41783811757981c3b815c24ea4737d66
How it works
ResidenceHero.tsxreadsresidenceCountryfrom the setup flow context. The celebration never starts in the first 2 s after the hero first mounts (RESIDENCE_WAVE_MS). A country prefilled from geo therefore gets the wave first.residenceWaveDone), and a hero that returns with a country celebrates at once.cheeringpose has loaded, with no time limit and under reduced motion too, so it never blanks. The stickers wait for the pose and their three files, 1.5 s at most (RESIDENCE_STICKER_LOAD_MS). They are plainimgelements with the preloaded URL, so each file is fetched once; a sticker whose file fails is left out and the rest carry on.RESIDENCE_PICK_DELAY_MS), because the picker drawer is still closing over the hero.PeanutMascothas a new optional propfit="canvas"for this; the default (fit="art") is unchanged for every other call site..residence-*inglobals.css): oneanimation-delayper element, slap then idle in one animation list. Motion values are the ones in the approved mock. The last sparkle (bottom left) is mirrored withscaleX(-1).prefers-reduced-motion: reduce: no wave wait, stickers and decorations appear at once and stay still.public/residence-stickers/(60 files, 1.09 MB in total, 18 kB on average). They are fetched only when their country is shown and are not in the JS bundle.residence-stickers.consts.tsmapsiso2to its three files.next.config.jsgives the folder the sameCache-Controlrule as/flags(UNHASHED_STATIC_CACHE_CONTROL: one day, stale-while-revalidate one week).cheeringchunk is fetched only for a sticker country.alt="",aria-hidden,pointer-events: none.star.svgandsparkle.svg, unmodified; the mascot Lottie files are untouched.PeanutMascotframe clock: the counter now wraps with modulo. A swap from a 53-frame pose to a 22-frame one could ask Lottie for a frame past the end for one tick.src/assets/onboarding/residence.jsonand its loader entry are removed, because nothing uses them now.Sizes
Mascot canvas height = hero height minus 3 rem (the top bar), at most 80% of the hero width. Sticker width = 25% of the hero width, at most 40% of the canvas height and 11 rem. The mock has canvas 79% of its hero and sticker 0.31 of the canvas; its hero is about square, the real one is wider than tall.
The drawn figure is the union of the painted SVG paths in the frame of the screenshot, so it moves a few pixels with the frame.
Assumptions
p-aroundplacement, mapped onto the real hero box. The first two stickers sit below the top bar. The fourth decoration sits left of the third sticker, because the real hero is too short for the mock's gap between the two right stickers.EGG2_US_MAILBOX.pngexists in the source folder but is not in the approved order file, so it is not shipped.Risks / breaking changes
public/. On the web each visitor fetches at most three (about 55 kB), and only in a sticker country.public/wholesale, so all 60 files (1.09 MB) ship in every APK, IPA and OTA bundle.PeanutMascotis shared. Two changes touch it: the modulo wrap (same result for a pose that never swaps) and the opt-infitprop (default unchanged).globals.cssgrows by the.residence-*rules.Residence.tsxcommits the geo suggestion in an effect), so the waving state can show for a frame before the still set. A hero that mounts with the country already in the context draws the final state at once.QA
No backend is needed. Build with
NEXT_PUBLIC_VERCEL_ENV=preview, runnext start, open/dev/surfaces?s=03-a-residence-select&__fixture=profile-editat 375×667.Unit tests:
residence-stickers.consts.test.ts(20 countries, three files each, every file on disk, no unused file),ResidenceHero.test.tsx(23 tests: pick just before the wave ends, preloaded URL equals rendered src, failed sticker left out, pose held past the fallback, wave delay, non-sticker country, swap, return to wave, reduced motion, load gate and its 1.5 s limit, failed fetch, pick delay, country arriving during the wave, timer cleanup on unmount, remount after the wave, cheering fetched only for a sticker country, decorative markup, decoration order and mirror) andPeanutMascot.test.tsx(canvas fit).Checks on the current head
cd01f6329, run on the boat.dev sandbox on a copy of the working tree that was committed unchanged as this head:npm run typecheck: exit 0.npx jest src/components/Setup src/features/setup src/components/Global/PeanutMascot 'src/app/\(setup\)': 59 suites, 1,200 tests, all passed.npm run build(preview build): exit 0.npm testwas not rerun on this head. Its last full run was on the first version of this branch, before the rebase and before the QA fixes: 1,436 of 1,437 suites passed; the one failure wasscripts/__tests__/capgo-release-guard.test.js, which runsgitand the sandbox copy is not a git repository. CI runs the full suite on this head.Screenshots
Real step through the dev surface harness with fixture mode, headless Chromium, production build. The yellow "Fixture" banner belongs to the harness. The top inset is forced by setting
--safe-top: 59pxon:root.The assets branch
pr-assets-4114is deleted after the merge.