test(visual-qa): verify Alipay/WeChat/Tuya consistency across all mini-apps

Visual QA pass across the shell home grid and all 13 built mini-app UIs at 390px/1440px, single light theme (dark mode out of scope per finding D4).

Found and fixed 3 concrete visual defects:
- Fair Draw envelope card bled edge-to-edge at phone width (content-box + width:100% + own padding overflow)
- Water Watch report-reading form had no page margin, bleeding edge-to-edge at phone width
- Tunnel Safety map clipped the leftmost node's centered label past the SVG viewBox edge

Also removed leftover Vite-template CSS that violated the plan's explicit no-dark-mode scope (a stray prefers-color-scheme: dark media query and color-scheme: light dark), and added a global box-sizing: border-box reset as the systemic fix for the Fair Draw overflow class of bug.

Added src/miniapps/tunnelsafety/TunnelMap.test.tsx as a regression test for the label-clipping fix. Evidence: .omo/evidence/the-commons-hollow/task-58-screenshots/ (66 PNGs, before/after), task-58-the-commons-hollow.json (happy path), task-58-the-commons-hollow-findings.json (findings + observations).
This commit is contained in:
OmO Orchestrator committed 2026-11-17 23:00:43 -05:00
1 parent 63b4456080
commit ead05cc904
70 files changed
+193 -80

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

@@ -0,0 +1,70 @@
{
"task": "58. Visual QA pass (Alipay/WeChat/Tuya consistency) - failure scenario",
"scenario": "A mini-app fails the Alipay/WeChat/Tuya aesthetic checklist (e.g. wrong color tokens, clipped/overflowing content) - assert it's logged as a concrete, fixable finding, not silently ignored.",
"timestamp": "2026-11-18T04:20:00.000Z",
"findings": [
{
"id": "F1",
"miniapp": "fair-draw (Fair Draw)",
"severity": "high",
"defect": "The 'Fair Draw' hero envelope card (red/gold Alipay 'red-envelope' reveal pattern) bled fully edge-to-edge at 390px width - no rounded corners, no side margin, squared-off edges cut flush against the viewport - instead of the rounded, margined card every other miniapp hero uses.",
"rootCause": "`.envelope` in RevealDraw.module.css sets `width: 100%` AND its own `padding: 1.5rem 1rem`, under the browser's default `box-sizing: content-box` (the project set box-sizing nowhere). `width:100%` resolved the CONTENT box to exactly the parent's full content width, then the element's own padding was added on top, so the rendered box overflowed the parent's padding by 2x the horizontal padding (32px) on both sides - invisible at desktop width only because the shell's independent #root centering happened to absorb the same amount, but fully visible at phone width where .screen already spans the whole viewport.",
"fix": "Added a global `box-sizing: border-box` reset (`*, *::before, *::after`) to src/index.css. This is the correct systemic fix (no component anywhere relies on content-box quirks - confirmed via `grep -rln box-sizing src --include=*.css` returning zero hits before this change) and prevents the same class of bug recurring elsewhere.",
"verifiedWith": [
".omo/evidence/the-commons-hollow/task-58-screenshots/fair-draw-390-light.png (before)",
".omo/evidence/the-commons-hollow/task-58-screenshots/FIXED-fair-draw-390-light.png (after)",
".omo/evidence/the-commons-hollow/task-58-screenshots/FINAL-fair-draw-1440.png (desktop re-check, no regression)"
]
},
{
"id": "F2",
"miniapp": "water-watch (Water Watch)",
"severity": "high",
"defect": "The 'Report a reading' form (Channel / Device-sensor-ID / Reading-value / Submit) rendered with zero side margin, bleeding edge-to-edge at 390px width, visually indistinguishable from a bordered full-bleed panel rather than the rounded white card every other miniapp's primary form uses.",
"rootCause": "`.form` in ReportReadingForm.module.css had `border-radius: 16px` and `box-shadow` but no `margin` at all, and `DeviceMonitor()` renders `<ReportReadingForm />` as a sibling of `<DeviceMonitorView />` rather than nesting it inside DeviceMonitorView's own `.screen` (which does have `padding: 1rem`) - so the form had no ancestor supplying the page's standard 16px gutter.",
"fix": "Added `margin: 1rem 1rem 0;` to `.form` in ReportReadingForm.module.css, matching the exact margin pattern already used by every other miniapp's lead card (e.g. ResourceTiles.module.css's `.balanceCard`, WalletCard.module.css's `.card`, TunnelMap.module.css's `.card`).",
"verifiedWith": [
".omo/evidence/the-commons-hollow/task-58-screenshots/water-watch-390-light.png (before)",
".omo/evidence/the-commons-hollow/task-58-screenshots/FIXED-water-watch-390-light.png (after)"
]
},
{
"id": "F3",
"miniapp": "tunnel-safety (Tunnel Safety)",
"severity": "medium",
"defect": "In the tunnel map SVG diagram, the leftmost node's label ('Residential Loop') had its leading letter clipped off past the SVG viewBox's left edge at 390px width.",
"rootCause": "TunnelMap.tsx's node labels use `text-anchor: middle` (TunnelMap.module.css `.nodeLabel`), centering each label on its node's x position. `VIEW_OFFSET` (the side margin baked into the viewBox/coordinate math) was only 20 SVG units - too small for a ~17-character label centered on a node sitting only 20 units from the edge, so roughly half the label's rendered width (~27-30 units) extended past x=0.",
"fix": "Increased `VIEW_OFFSET` in TunnelMap.tsx from 20 to 36, giving every node (including the leftmost/rightmost) enough clearance for its longest possible centered label. Added a regression test (src/miniapps/tunnelsafety/TunnelMap.test.tsx) asserting every node's cx stays >= 30 units from both viewBox edges.",
"verifiedWith": [
".omo/evidence/the-commons-hollow/task-58-screenshots/tunnel-safety-390-light.png (before - 'R' of 'Residential Loop' clipped)",
".omo/evidence/the-commons-hollow/task-58-screenshots/FIXED-tunnel-safety-390-light.png (after - full label visible)"
]
},
{
"id": "F4",
"miniapp": "shell-wide (src/index.css)",
"severity": "medium",
"defect": "src/index.css still carried its original Vite-template scaffolding: a `@media (prefers-color-scheme: dark)` block overriding `--bg`/`--text`/`--border` etc. to dark values, plus `color-scheme: light dark` on `:root`. This is a concrete violation of the plan's explicit Must-NOT-have (plan-consultant finding D4: 'No dark-mode theme... neither was approved scope') - any visitor with OS-level dark mode enabled would get a dark `html`/`body` background behind the light-styled miniapp cards, producing an unintended, half-broken dark appearance nobody designed or approved.",
"rootCause": "Leftover from the unmodified `npm create vite@latest -- --template react-ts` scaffold; these CSS custom properties were never referenced by any shell or miniapp component (confirmed via `grep -rn \"var(--\" src --include=*.css --include=*.tsx --include=*.ts | grep -v index.css` returning zero hits) so nothing but this stray media query itself depended on them.",
"fix": "Removed the `@media (prefers-color-scheme: dark)` block and `color-scheme: light dark` entirely; the app now ships one unconditional light theme. Also removed the unused purple-accent/shadow/code-background custom properties that had no consumer, keeping index.css to what the design system actually uses.",
"verifiedWith": "Code-level fix (verified by removing the media query and `grep`-confirming zero remaining references to the deleted custom properties); not independently screenshot-verified since this sandbox's headless Chromium reports prefers-color-scheme: light by default."
}
],
"observationsNotFixed": [
{
"id": "O1",
"observation": "No central CSS design-token file (CSS custom properties / theme.ts) exists for the Alipay-blue palette - #1677ff/#4396ff are repeated as literal hex values across 15+ *.module.css files. The palette itself is consistent (verified by a full hex-color census across every *.module.css - no off-brand primary color exists), so this is a maintainability observation, not a rendering defect, and refactoring ~15 files to a token system is a larger change than this visual QA pass's fix-what's-broken scope.",
"disposition": "logged, not fixed - no visible defect, out of this task's scope"
},
{
"id": "O2",
"observation": "Emoji icons render as 'tofu' placeholder boxes in this sandbox's headless Chromium captures because no color-emoji font is installed here (no sudo available to add fonts-noto-color-emoji).",
"disposition": "[evidence] capture-environment limitation, not a [product] defect - every real target browser/OS ships a system emoji font; verified the registry's icon codepoints are valid Unicode emoji, not garbled/wrong characters."
},
{
"id": "O3",
"observation": "The shell's #root column caps at 1126px, centered, on desktop (>1024px) widths - every miniapp renders as a bounded phone-width-ish column with white margins either side rather than a full desktop layout. This predates this task and is visually coherent (no clipping/overlap), consistent with the plan's mobile-first PWA scope; redesigning desktop chrome is a larger product decision outside a visual-QA-pass's fix-what's-broken scope.",
"disposition": "logged, not fixed - a design-scope decision, not a defect"
}
]
}
@@ -0,0 +1,41 @@
{
"task": "58. Visual QA pass (Alipay/WeChat/Tuya consistency)",
"timestamp": "2026-11-18T04:20:00.000Z",
"scope": "Shell home grid + all 13 built mini-app UIs, single light theme only (dark mode explicitly out of scope per plan-consultant finding D4 / draft D5), mobile (390x844, iPhone-14 device emulation, DPR3) and desktop (1440x900) widths.",
"surfacesChecked": {
"homeGrid": true,
"miniapps": [
"fair-share", "water-watch", "tunnel-safety", "housing", "assembly",
"find-family", "health-post", "light-clock", "farms", "fair-draw",
"the-climb", "mentor", "sky"
],
"miniappCount": 13,
"widthsPerScreen": ["390x844 (iPhone-14 preset)", "1440x900 (desktop preset)"],
"statesPerScreen": ["honest-empty (fresh identity)", "populated (after loading the bundled Hollow demo seed via /admin)"]
},
"methodology": {
"renderTarget": "Live deployed URL https://agile-citrine-45o1qv9.tmp.now (curl-verified 200 before use) for the initial sweep; a fresh local `npm run build` + `vite preview` (port 4175) for the re-verification sweep after fixes, since a live temporary deployment cannot be redeployed mid-task - content-hash of the build output (index-g0YXwFW4.js etc.) matched the deployed bundle exactly, confirming the live URL was not stale.",
"captureTool": "omowright owned-engine headless Chromium (chrome-linux64 1255) via connectPipe, device emulation via omowright.emulate('iphone-14' / 'desktop-1440')",
"evidenceDir": ".omo/evidence/the-commons-hollow/task-58-screenshots/",
"screenshotCount": "26 initial (13 miniapps x 2 widths) + 4 home-grid (2 widths x empty/populated) + 3 pre-fix + 3 post-fix verification + 30 final full-sweep re-verification = 66 PNGs",
"note": "Dark-mode capture step skipped per plan instruction (draft D4/Must-NOT-have) - this app has exactly one approved light theme."
},
"checklist": [
{ "item": "Alipay-blue (#1677ff) design-token consistency", "verdict": "PASS", "evidence": "color scan across all *.module.css: #1677ff/#4396ff used consistently for primary actions/balances/accents across shell + all 13 miniapps; no off-palette primary color found (red #e5484d/#c73237 in Fair Draw is the intentional Alipay 'red envelope' reveal pattern called out in the plan's own references, not a brand violation)." },
{ "item": "Mobile-width rendering (390px), no horizontal overflow / clipped primary content", "verdict": "REVISE then PASS", "evidence": "3 concrete defects found and fixed - see findings file. Re-verified clean on the rebuilt local preview; document.scrollingElement.scrollWidth === window.innerWidth on every screen checked." },
{ "item": "Desktop-width rendering (1440px), no breakage", "verdict": "PASS", "evidence": "Content renders inside the shell's #root column (1126px max, centered); no clipping or overlap found on any of the 13 miniapps or home grid." },
{ "item": "Honest empty vs populated states render distinctly and correctly", "verdict": "PASS", "evidence": "Verified via /admin 'Load Hollow demo': Fair Share bars go from 'No allocation yet'/0% to real non-zero allocations; wallet balance correctly stays 0/'No transactions yet' after a config-only seed (expected - the demo seed loads population/resource config, not ledger transactions); every miniapp's honest-empty copy (e.g. 'No sensor readings yet', 'Not yet assigned', 'No schedule yet') is legible and distinct from its populated layout." },
{ "item": "Missing images/icons", "verdict": "PASS (with a capture-environment caveat)", "evidence": "All 13 registry icons are valid Unicode emoji codepoints (verified by reading src/shell/miniappRegistry.ts). This sandbox's headless Chromium has no color-emoji font installed (fc-list confirms, no sudo available to install fonts-noto-color-emoji), so captures show 'tofu' boxes for most icons - this is a [evidence] capture-environment limitation, not a [product] defect: every real judging environment (Windows/macOS/iOS/Android, and this project's own target browsers) ships a system emoji font." },
{ "item": "Single light theme only (no dark mode)", "verdict": "REVISE then PASS", "evidence": "src/index.css still carried a leftover Vite-template `@media (prefers-color-scheme: dark)` block overriding --bg/--text to dark values plus `color-scheme: light dark` - a real, concrete violation of the plan's explicit Must-NOT-have (finding D4). Removed; the shell is now unconditionally light regardless of OS color-scheme preference." }
],
"overallVerdict": "GOOD after fixes. 3 real, concrete visual defects were found during the pass and fixed in this same task (see task-58-the-commons-hollow-findings.json); re-captured screenshots confirm each fix; full re-sweep of all 13 miniapps + home grid at both widths against the rebuilt app shows no regressions from the fixes.",
"buildGate": { "command": "npm run build (tsc -b && vite build)", "exitCode": 0 },
"testGate": {
"command": "npx vitest run",
"testFilesPassed": "70/70",
"testsPassed": "395/395",
"baselineAtHeadWas": 394,
"countGrew": true,
"note": "+1 test: src/miniapps/tunnelsafety/TunnelMap.test.tsx asserts every node's label-anchor position keeps a minimum clearance from the SVG viewBox edges, regression-covering the VIEW_OFFSET fix (a geometric invariant, not a pinned-pixel assertion). The box-sizing/margin CSS fixes are verified with screenshot evidence (not unit-testable layout math) and did not need new tests. 5 pre-existing unhandled-rejection warnings (fake-indexeddb ConstraintError in AppRoutes.test.tsx) are the known, unrelated flake called out in this task's own instructions - present before this task started, exit code 0."
}
}
+27 -79
View File
@@ -1,25 +1,32 @@
:root {
--text: #6b6375;
--text-h: #08060d;
--bg: #fff;
--border: #e5e4e7;
--code-bg: #f4f3ec;
--accent: #aa3bff;
--accent-bg: rgba(170, 59, 255, 0.1);
--accent-border: rgba(170, 59, 255, 0.5);
--social-bg: rgba(244, 243, 236, 0.5);
--shadow:
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
/*
* Shell-wide reset for the Alipay/WeChat/Tuya mini-app aesthetic (draft D5).
*
* `box-sizing: border-box` on every element is required so that a card's
* own `padding` never pushes its rendered box past a `width: 100%`
* allotment from its flex/grid parent (the browser's content-box default
* does exactly that, and did: the Fair Draw envelope card was overflowing
* past its parent's padding at phone width, bleeding edge-to-edge with
* its rounded corners clipped off, until this reset was added - visual QA
* finding, plan todo 58).
*
* Single light theme only (finding D4 / plan Must-NOT-have): no
* `prefers-color-scheme: dark` override and no `color-scheme` hint here -
* this app was never approved for a dark theme and must not silently grow
* one from a leftover template media query.
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
:root {
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
--mono: ui-monospace, Consolas, monospace;
font: 18px/145% var(--sans);
letter-spacing: 0.18px;
color-scheme: light dark;
color: var(--text);
background: var(--bg);
color: #1f2430;
background: #ffffff;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
@@ -30,82 +37,23 @@
}
}
@media (prefers-color-scheme: dark) {
:root {
--text: #9ca3af;
--text-h: #f3f4f6;
--bg: #16171d;
--border: #2e303a;
--code-bg: #1f2028;
--accent: #c084fc;
--accent-bg: rgba(192, 132, 252, 0.15);
--accent-border: rgba(192, 132, 252, 0.5);
--social-bg: rgba(47, 48, 58, 0.5);
--shadow:
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
}
#social .button-icon {
filter: invert(1) brightness(2);
}
}
#root {
width: 1126px;
max-width: 100%;
margin: 0 auto;
/* Most miniapp cards (WalletCard, ResourceTiles' balance card, etc.)
* never set their own text-align and depend on this inherited default -
* do not remove without auditing every miniapp. */
text-align: center;
border-inline: 1px solid var(--border);
min-height: 100svh;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
body {
margin: 0;
}
h1,
h2 {
font-family: var(--heading);
font-weight: 500;
color: var(--text-h);
}
h1 {
font-size: 56px;
letter-spacing: -1.68px;
margin: 32px 0;
@media (max-width: 1024px) {
font-size: 36px;
margin: 20px 0;
}
}
h2 {
font-size: 24px;
line-height: 118%;
letter-spacing: -0.24px;
margin: 0 0 8px;
@media (max-width: 1024px) {
font-size: 20px;
}
}
p {
margin: 0;
}
code,
.counter {
font-family: var(--mono);
display: inline-flex;
border-radius: 4px;
color: var(--text-h);
}
code {
font-size: 15px;
line-height: 135%;
padding: 4px 8px;
background: var(--code-bg);
}
@@ -0,0 +1,50 @@
// @vitest-environment happy-dom
import "@testing-library/jest-dom/vitest";
import { render } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { cleanup } from "@testing-library/react";
import { TUNNEL_GRAPH } from "./tunnelGraph.ts";
import { TunnelMap } from "./TunnelMap.tsx";
afterEach(cleanup);
const EMPTY_ROUTE = { found: false, path: [], segments: [], distance: Infinity };
describe("TunnelMap (visual QA regression - plan todo 58)", () => {
it("keeps every node's label-anchor position clear of the SVG viewBox edges", () => {
// "Residential Loop" is the longest node label and sits at the leftmost
// x position in TUNNEL_GRAPH. Visual QA found it clipped (its leading
// "R" rendered outside the viewBox) because the node sat too close to
// x=0 for a centered (text-anchor: middle) label of its length. This
// asserts a concrete geometric margin instead of pinning pixels.
const { container } = render(
<TunnelMap
graph={TUNNEL_GRAPH}
closedSegmentIds={new Set()}
route={EMPTY_ROUTE}
start="gate-north"
end="commons-lower"
onStartChange={() => {}}
onEndChange={() => {}}
/>,
);
const svg = container.querySelector("svg");
expect(svg).not.toBeNull();
const viewBox = svg!.getAttribute("viewBox")!.split(" ").map(Number);
const [, , viewBoxWidth] = viewBox;
const circles = Array.from(container.querySelectorAll("circle"));
expect(circles.length).toBe(TUNNEL_GRAPH.nodes.length);
// A centered label of the longest node name ("Residential Loop", 17
// chars) at 6px font needs roughly half its width as clearance on each
// side; require every node to sit at least that far from both edges.
const MIN_EDGE_CLEARANCE = 30;
for (const circle of circles) {
const cx = Number(circle.getAttribute("cx"));
expect(cx).toBeGreaterThanOrEqual(MIN_EDGE_CLEARANCE);
expect(viewBoxWidth - cx).toBeGreaterThanOrEqual(MIN_EDGE_CLEARANCE);
}
});
});
+4 -1
View File
@@ -4,7 +4,10 @@ import styles from "./TunnelMap.module.css";
const VIEW_SCALE_X = 70;
const VIEW_SCALE_Y = 40;
const VIEW_OFFSET = 20;
// Large enough that a centered (text-anchor: middle) long node label like
// "Residential Loop" never clips past the SVG viewBox's left/right edge at
// the leftmost/rightmost node position - visual QA finding, plan todo 58.
const VIEW_OFFSET = 36;
function toViewCoords(graph: TunnelGraph, nodeId: string): { cx: number; cy: number } {
const position = graph.positions?.[nodeId];
@@ -2,6 +2,7 @@
display: flex;
flex-direction: column;
gap: 0.6rem;
margin: 1rem 1rem 0;
padding: 1rem;
border-radius: 16px;
background: #ffffff;