---
name: wingwire-web-mockup-build
description: "Use when building a WingWire Web HTML mockup from a spec."
license: MIT
author: HamaratLabs
version: 1.0.0
---
# WingWire Web Mockup Build
Procedure for building a single-file HTML/CSS/JS desktop mockup (WingWire Web series, e.g. C2/C3) from a written design spec plus a previous mock to reuse code from.
## User's design standards (always apply)
- **Desktop, not phone.** The user flags any screen that still behaves like the Android app: narrow centered column in a wide window, stacked full-width cards, back buttons/duplicate headers next to a persistent sidebar, bottom-sheet patterns, empty halves of the screen. Keep the Android tones/typography/mono captions, drop the phone layout.
- **Telegram Desktop proportions are the reference.** Fixed ~340px left list (bottom tab bar), flexible content; reading/form screens (profile, settings, permissions, cron detail, usage, sessions) as ONE centered ≤720px column of grouped rounded cards with small UPPERCASE section labels and grey footnotes; full width only for chat, galleries, media viewer, dashboard. Never a percentage split like 37/63 for a profile — the user calls it "bad proportions".
- **Chat composer pinned to the very bottom, messages stacking from the bottom**, thin 56px header, ≤760px message column, optional right context panel.
- One primary full-width action per screen ("Send to VideoGen → v4 (3 notes)"), destructive actions as red text with a grey explanation, not buttons.
- Mock data must be internally consistent and project-specific: never copy numbers from a reference screenshot (total vs cleanup amount mismatches get noticed).
## Coordinator workflow (before any build)
1. When the user sends reference screenshots, describe the transferable decisions per screenshot and map each to a WingWire screen; wait until they say they're done, then fold all of them into ONE spec.
2. Write the spec yourself with exact dimensions, routes, per-screen layout, states and copy (store it in the project's notes folder), then delegate the build against it. Handing the builder only a vague brief produced a mock the user called under-thought.
3. After each mock: run a desktop-fitness UX audit (per screen: what is phone-like at 1440 and 1920, severity, fix) before building the next version; then look at the screenshots yourself and list remaining defects concretely before reporting.
4. If a reference screenshot visibly contains a secret (API key in a chat preview), warn the user once, and tell the builder never to transcribe text from the images.
## Workflow that worked
1. Read the full spec, the UX audit of the previous mock, and the previous mock's `index.html` + README in full before writing anything — the previous mock's CSS tokens/components (card, btn, badge, chip, perm-item pattern) are almost always directly reusable, only the page *skeleton* usually needs rebuilding.
2. Write the file in stages via `write_file` (head+CSS+body shell) then `patch` (append JS in large chunks: data → helpers → per-section render functions → router/interactions) — a single 2500+ line file is too much to compose and verify in one shot, and `patch`'s fuzzy matching tolerates re-anchoring between chunks.
3. **Always syntax-check the JS before screenshotting**: extract the `` body with a small Python regex into a `.js` file and run `node --check` on it. This catches template-literal/string-escaping mistakes (see below) in seconds instead of after a blind screenshot round.
4. Screenshot every required route with headless Chrome driven via hash + query params (`file://...index.html#route?param=1`), at both 1440x900 and 1920x1080, then inspect **every single one** with vision — don't skip any on the assumption the pattern is identical to a working one already checked.
5. Verify interactivity with a REAL browser session (`mcp__browser_exec`, not just static screenshots): click handlers, tab switches, theme toggle, resize handles (dispatch synthetic mousedown/mousemove/mouseup), live-recompute logic (e.g. compression estimator), pin-click seeking. A screenshot only proves the HTML rendered; it does not prove the `onclick` wiring is correct.
## Pitfalls hit and fixed
- **`text-transform: uppercase` under `` turns English labels into `BRANDİNG` / `İN`.** Put `lang="en"` on the English span/thead (Turkish labels keep correct `BUGÜN`). Same bug class as the app's `uppercaseGroupName`.
- **Percent-height bars inside a flex column child render 0 px** unless the child itself has `height: 100%` (mini bar charts looked empty in the first shot).
- Multi-screen static mocks: one file per direction, screens as `` switched by `#hash` (shared `ortak.js`), shared tokens copied verbatim from `src/ui/styles.css` in `ortak.css`; screenshot with a scratch Playwright script (`createRequire(/package.json)`) that also reports elements past `innerWidth` and an English-word regex, then still inspect every PNG with vision.
- Honest-data mocks: label every sample number `ÖRNEK`, show `—` + the concrete missing requirement where no source exists, and check status/label vocabulary against the real `strings.ts` (invented Haberci states were caught this way).
- Doc research in unattended runs (`execute_code` blocked, delegation budget may be 0): `web_extract` with `char_limit=2000`, then `grep` the saved full-text file in the profile's `cache/web/`; JS-only doc sites (TikTok, Pinterest) via `browser_exec` `document.body.innerText`.
- **Nested string escaping across template-literal boundaries.** A JS file built almost entirely of backtick template literals still contains plain `${...}` expressions evaluated as REAL JavaScript, not template-literal text — a single-quoted string INSIDE a `${}` expression follows normal JS string-escaping rules (`\'` needs exactly one backslash to escape an apostrophe), while literal text sitting directly between backticks follows template-literal rules (where `\\'` — two backslashes then an unescaped quote — is correct when you want the OUTPUT to contain a literal backslash followed by a quote, e.g. for a nested `onclick="...'...\'...'..."` HTML attribute). Mixing these two contexts up (writing `\\'` inside a `${}` JS string literal) produces a `SyntaxError: Unexpected identifier` that only `node --check` catches cleanly — grep for `\\\\'` patterns in the source as a quick manual check, and when a string needs an embedded apostrophe, prefer switching the literal to double quotes (`"text's"`) over any backslash-escaping scheme — it sidesteps the ambiguity entirely.
- **`.content{height:100vh}` as a flex child with TWO stacked children (a 56px topbar sibling + a `height:100%` panel) silently clips the panel's bottom content.** When a route renders `pageTopbar() + viewerShellHtml` as two separate block-level children of a fixed-height container, a child with `height:100%` resolves against the CONTAINER's full height, not "the remaining space after the topbar" — so topbar(56px) + panel(100% of container) overflows by 56px, and if the container has `overflow:hidden` (needed so an internal composer/timeline can be pinned to the bottom), that overflow is silently clipped off-screen with no visual error, no console warning — only visible by actually screenshotting at the real window height and checking the very bottom edge. Fix: make the container a flex column (`display:flex;flex-direction:column`), mark the topbar `flex-shrink:0`, and give the main panel `flex:1;min-height:0` instead of `height:100%`.
- **`repeat(auto-fill, minmax(Npx,1fr))` vs `repeat(auto-fit, minmax(Npx,1fr))` for a media grid.** `auto-fill` reserves empty trailing grid tracks when there are fewer items than tracks-that-would-fit, so 2-3 cards end up squeezed to the LEFT at their minimum width with a large dead empty area to the right — this is a real, visually distinct bug from `auto-fit` (which collapses empty tracks to 0 and lets the real items' `1fr` stretch to fill the row), and it reproduces exactly the "empty gap" failure mode that UX audits call out. Always use `auto-fit` for "cards grow when there are few, wrap into more columns when there are many"; pair it with a `max-width` cap + `justify-self:start` on the card itself so 1-2 items don't balloon to the full row width instead.
- **Multi-draft choice (A/B/C) deliverables:** each draft one HTML file with `#durum-alt` hash states + `?shot=1` hiding the demo nav; expose `window.__S` so a Playwright `klavye-test.mjs` can press real keys and assert state (catches dead Enter/Esc paths). Build the per-letter collage by writing an HTML file INSIDE the screenshot folder (relative `src`) and screenshotting it; a collage HTML elsewhere with `parca/x.png` paths silently never loads (waitForFunction timeout). Check label legibility on a `sips --resampleWidth 1080` copy.
- **Adding a sidebar tab:** the real `.tabbar__btn` is equal-width (`flex:1`, 11px/600, ellipsis); measure the new label in the browser against (sidebar−8)/N−4 px before drawing it — "Yapılacak" (51 px) silently became "Yapıla…" at 7 tabs. Propose `flex: 1 1 auto` and print label-vs-button widths from the screenshot script.
- **Popovers in list mocks:** an upward popover anchored on a row near the bottom covers that row's own title; open it sideways (right of the chip row) so the selected item stays readable. Put the `ÖRNEK` badge per screen (inside each `[data-screen]`) in an empty area — one global bottom-right badge covered phone tab bars.
- **Global top bar with a window-centred search:** at 1440 it fits, at 1100 the centred search hits the right button cluster (4 px). Have the screenshot script measure crumb↔search and search↔right-zone gaps at 1100/1440/1920, give the search `clamp(260px, 31vw, 440px)` and drop button labels below 1280 (icon + badge stay).
- **Month-grid event chips:** `text-overflow: ellipsis` on a `display:flex` chip cuts mid-word without dots; use `display:-webkit-box; -webkit-line-clamp:2` so 108-px cells wrap to two lines.
- Private-name check for deliverables: a script reads the private names from a source file (e.g. `shared/privateNames.ts`) and greps without printing them, so the output can go into the report without leaking the names.
- **Shell CSS class names leak into SVG:** a shared `.sq{width:30px;height:30px}` applied to an SVG `` overrides its width/height attributes (SVG2 geometry properties) — every square rendered 30 px and the root got clipped. Give SVG shapes unique classes (`rsq`).
- Single-file mock shells need `html, body, #root { height: 100% }`; without `#root` the grid shrinks to content height (side panel ended at 668 px on a short page).
- Off-canvas drawers (`translateX(105%)`) inflate `scrollWidth` (2091 at 1440) unless the parent has `overflow:hidden`; add `visibility:hidden` when closed. Measure `documentElement.scrollWidth` AND inner `overflow:auto` containers in the screenshot script.
- Playwright `recordVideo`: a recording can come out with a grey band over the bottom ~90 px even though the page is fine — extract frames with ffmpeg (`-ss T -frames:v 1`) and look at them; re-record if needed. Contact sheets (`tile=4x4`) are too small to catch this.
- Concept videos from real data: drive a `?demo=1` script in the page (fake cursor + ripple + caption drawn in DOM, since ffmpeg has no drawtext), set `window.__demoDone`, record, then `ffmpeg -ss 0.5 -c:v libx264 -pix_fmt yuv420p -an`. Replay real timestamps with long gaps capped (piecewise time map) and say so in a visible chip; `prefers-reduced-motion` → jump to the final state (verify with `document.getAnimations()` running = 0).
- A plain space or ` ` between Plus Jakarta text and a mono `` can render as ~0 px; use an inline-block spacer.
- When you write "readable even at 44 nodes / on one screen" in a recommendation, screenshot that exact case first (it needed scrolling).
- When a previous mock's own README documents a specific CSS fix it already applied (e.g. "switched `repeat(4,1fr)` to `repeat(auto-fit,minmax(220px,1fr))`"), copy that exact fix rather than re-deriving a similar-looking one from memory — `auto-fill` and `auto-fit` look interchangeable at a glance but are not.