diff --git a/docs/TASKS.md b/docs/TASKS.md index 5583869..389bc79 100644 --- a/docs/TASKS.md +++ b/docs/TASKS.md @@ -64,7 +64,7 @@ Owner: "with many categories loaded the strip grows from the bottom-left and ove | ID | Task | Owner | Status | Notes | |---|---|---|---|---| -| T-109 | The dock publishes its own width as `--dock-w` (ResizeObserver, no React state); above 640 px `.poi-strip` and `.corner` cap at `(100% − var(--dock-w)) / 2 − 16px`, and the attribution wraps instead of being covered. Correct by construction because the dock is centred on the bar in both chromes | map-ui-dev → review → qa | doing | Alternatives weighed and rejected in the PR: a summary chip past N, a static max-width (no constant works — the agent lane moves the gutter), one flex row (touches the tray anchor, landing hint and four media queries) | +| T-109 | The dock publishes its own box as `--dock-w` / `--dock-h` (one `ResizeObserver`, no React state); above 640 px `.poi-strip` and `.corner` cap at `(100% − var(--dock-w)) / 2 − 16px`, and while a category is browsed (`.dock-actives`) the whole bottom bar lifts above the dock (`bottom: calc(var(--dock-h) + 28px)`) so the attribution is never covered. Correct by construction because the dock is centred on the bar in both chromes | map-ui-dev → review → qa | done | Alternatives weighed and rejected in the PR: a summary chip past N, a static max-width (no constant works — the agent lane moves the gutter), one flex row (touches the tray anchor, landing hint and four media queries). Review: merge after fixes (stale comment, duplicate `.badge` rule, `usePublishedBox` contract) — applied. Layout is not measurable in the node vitest environment, so the gate is e2e: `bottom-band.spec.ts` sweeps 18 cells (921/1024/1440 × human/agent chrome × none/3 browsed/15 loaded) with `boundingBox()` intersections and `elementFromPoint` on every attribution link; 13/18 red on develop, 54/54 green on the fix (`--repeat-each=3`). ≤640 px stays F-14 | ## T-110 — a person plans a walking route by clicking two points · owner approved 2026-09-02 · gate: the human can do what `plan_route` does, and the agent's tool is untouched @@ -91,7 +91,8 @@ Owner asked how a human uses routing; the answer was "only through an agent". Pa - **F-13 (tool-dev)** No tool echoes an annotation's coordinate: `AnnotationOutput` (`state.ts:55`) carries `id`, `note`, `source` only, so an agent that pinned a note by place name cannot confirm where it landed without re-resolving the name itself. Found writing the T-106 e2e, which had to read the store directly. Adding `at: [lng, lat]` (5 dp) costs ~30 B a note. - **F-14 (map-ui-dev)** At ≤640 px the loaded-categories strip overflows the bottom bar's left edge by 6–22 px (`.bottom-bar` is `justify-content: flex-end` and `.corner` is `flex-shrink: 0`, so overflow goes left). Text stays readable. Fix is letting `.corner` shrink at that tier — not `safe flex-end`, which would push the attribution off the right instead. Found during T-109. - **F-15 (map-ui-dev)** `.pin-card` has `max-width: 210px` and no `max-height`: `annotate` with `"a\n".repeat(250)` renders a ~4,400 px bubble that covers other pins. The fold (T-107) is the current escape hatch. A companion cap (`max-height` + fold-on-overflow, or collapsing interior newlines in the bubble only) is a design call. Found during T-108's review. -- **F-16 (qa)** `e2e/awakening-flight.spec.ts:249` reads bounds immediately after `setViewportSize` and races the republish (~4/24 on develop). Same family as F-1; the fix is a wait on the republished bounds, never a sleep. Handed to qa 2026-09-02. +- **F-16 (qa)** ~~`e2e/awakening-flight.spec.ts:249` reads bounds immediately after `setViewportSize` and races the republish (~4/24 on develop).~~ Fixed 2026-09-02, rides the T-109 PR: the spec captures the raw bounds tuple before the resize and `waitForFunction`s until it changes (bounded 1,500 ms, no sleep); 48/48 with `--repeat-each=12`. +- **F-17 (map-ui-dev)** With the inspector open at 1350 px, the *open* Places tray's bottom-right corner overlaps the OpenFreeMap attribution pill by ~7 CSS px (tray bottom 835 vs attribution top 828). The tray is anchored above the dock and the attribution to the map's right edge; T-109's caps and lift only govern the closed bar, not the tray panel. Cosmetic; the links stay clickable. Found capturing Devpost media 2026-09-02. ## Handoff log @@ -118,5 +119,6 @@ Append-only. `date · from → to · what`. - 2026-09-01 · orchestrator → all · `scripts/ship-pr.sh --merge-back` runs `git switch` in the repo root, which fails when the head branch is checked out in a worktree. Merge `origin/develop` inside the worktree instead, then ship without the flag — and it is the better order anyway, because the integration check then runs against the base you are merging into. - 2026-09-02 · qa → all (lesson) · Every tool call writes an activity row, read-only ones included — `get_map_state` too. "A human gesture writes no row" is only assertable before the next tool call, so an e2e that checks it must read the store, not call a tool, or assert before the first call. - 2026-09-02 · orchestrator → qa · `e2e/awakening-flight.spec.ts:249` flakes ~4/24 on develop: it reads bounds right after `setViewportSize` with no wait for the republish. Wait for the republished bounds (no fixed sleep). Ticketed F-16. +- 2026-09-02 · qa → all (lesson) · Any real tool call wakes the page into agent chrome, so a human-chrome e2e cell must reach its content state by hand: `bottom-band.spec.ts` loads 15 categories by tapping chips in the Places tray (a 4th tap evicts the oldest *painted* chip but never unloads it) and un-paints with the chips' `×`. Also: `page.waitForFunction(fn, arg, options)` — the timeout goes in the third argument; in the second it is silently the page function's argument and the wait falls back to the test timeout. - 2026-09-01 · review → all (lesson) · Four of the T-41 README defects were the same shape: prose describing what a surface was *designed* to do rather than what the component does. Read the component before the sentence, not the sibling doc. - 2026-09-02 · qa → tool-dev · Beads are tier-2/browse-only: a selected *bundled* feature paints a selection ring, and its clickable render is its category's circle layer (`INTERACTIVE_LAYER_IDS`), not `BEAD_LAYER_IDS`. A spec that needs to tap a selected station must query the interactive layers. diff --git a/e2e/awakening-flight.spec.ts b/e2e/awakening-flight.spec.ts index 85ac387..2e0d1b7 100644 --- a/e2e/awakening-flight.spec.ts +++ b/e2e/awakening-flight.spec.ts @@ -273,17 +273,37 @@ test.describe("the Awakening does not cancel the first flight (T-104)", () => { // changes (944px corridor -> 1104px), isolating this from a lane-width // change. await page.waitForTimeout(300); + // Captured raw (unrounded) so the poll below can compare tuple to tuple -- + // `beforeResize.bounds` is the tool's own *rounded* echo, and comparing a + // raw live value against a rounded one would nearly always read as + // "changed" even when nothing has, defeating the wait. + const rawBoundsBeforeResize = await page.evaluate(() => window.__glassmapStore!.getState().bounds); await page.setViewportSize({ width: 1440, height: 900 }); // Read back WHILE the flight is still in the air -- the ~2s ease is - // nowhere near done at 300ms in, and this read is one fast `page.evaluate` - // round trip, so this samples well before `waitForLiveArrival` below ever - // resolves. `onResize`'s own `pushBoundsFromMap()` call is the only thing - // that can have moved `bounds` already: the flight's own `moveend` -- the - // other path that republishes bounds -- has not fired yet, and won't for - // another second or more. Without that line `bounds` would still equal - // `beforeResize.bounds` here, describing a canvas 160px narrower than the - // one actually on screen, until the flight happens to land on its own. + // nowhere near done at 300ms in. `onResize`'s own `pushBoundsFromMap()` + // call is the only thing that can have moved `bounds` already: the + // flight's own `moveend` -- the other path that republishes bounds -- has + // not fired yet, and won't for another second or more. + // + // `page.setViewportSize` resolves once the emulated viewport itself has + // been resized, not once the window's own "resize" event -- and + // `onResize`'s listener with it -- has actually run; that dispatch is + // asynchronous relative to the CDP call, so reading `bounds` immediately + // after raced it and occasionally won, seeing the PRE-resize bounds + // (observed ~4/24 CI runs). Poll the live store directly instead of + // reading once: bounded well under the flight's own remaining ease, so a + // build whose flight simply lands before the resize handler ever runs + // cannot make this pass for the wrong reason. + await page.waitForFunction( + (previous) => { + const bounds = window.__glassmapStore?.getState().bounds; + return !!bounds && JSON.stringify(bounds) !== JSON.stringify(previous); + }, + rawBoundsBeforeResize, + { timeout: 1500 }, + ); + const midResize = await callTool(page, "get_map_state"); expect(midResize.error).toBeUndefined(); expect(midResize.bounds).not.toEqual(beforeResize.bounds); diff --git a/e2e/bottom-band.spec.ts b/e2e/bottom-band.spec.ts new file mode 100644 index 0000000..0ef7f48 --- /dev/null +++ b/e2e/bottom-band.spec.ts @@ -0,0 +1,271 @@ +/** + * T-109 -- the gate `docs/TASKS.md` states for the bottom band: "nothing in + * the bottom band covers anything else, at any width, with any number of + * categories loaded." + * + * Three fix commits earn this file (`fix/ui-poi-strip-dock-overlap`): + * - `stop the loaded-POI strip before the Places dock` -- the strip + * (`LoadedCategories.tsx`, `poi-loaded`) now stops in the gutter beside the + * dock instead of running under it. + * - `the attribution stays clear of the dock` -- three browsed chips make + * the dock wide enough to cover the licence attribution, the WebMCP badge + * and the corner whisper; the bottom bar now lifts a row above the dock + * the moment a browsed chip lands on it (`.dock-actives`). + * - `review follow-ups for the dock caps` -- tier-boundary and naming fixes + * to the same mechanism. + * + * The mechanism (`usePublishedBox.ts`, `PlacesTray.tsx`): the dock publishes + * its own border-box as `--dock-w`/`--dock-h` custom properties on + * `document.documentElement` via a `ResizeObserver`, and every other bottom- + * band surface's CSS reads them back (`.poi-strip`'s `max-width`, `.corner`'s + * `max-width`, `.bottom-bar`'s lifted `bottom`). This file never re-derives + * that arithmetic -- it only measures the DOM's own boxes and asserts they do + * not intersect, which is the one thing a CSS change could get wrong that a + * unit test of the arithmetic could not see. + * + * ## Reaching "many categories loaded, none painted" without an agent + * + * `find_features` is a real WebMCP tool call, and *every* real call wakes the + * page (`lib/awaken`; see `chrome-toggle.spec.ts`'s own note on this) -- + * calling it to load categories would contaminate every "human chrome" cell + * of the matrix below with an agent that was never supposed to be there. + * Loading is reached by hand instead, the way a person really would: tapping + * a category chip in the Places tray loads its file and paints it + * (`browse-store.ts`), and a fourth tap evicts the oldest *painted* one + * without ever unloading it (`multi-category browse: eviction`, + * `multi-browse.spec.ts`) -- so tapping fifteen chips in a row loads all + * fifteen while painting only the last three, and removing those three with + * their own `x` (`places-clear`, which only un-paints, never unloads) leaves + * exactly "fifteen loaded, zero painted, zero tool calls" -- the strip's own + * worst case, reached the same way a human reaches it. + * + * ## Settling + * + * `--dock-w`/`--dock-h` are written by a `ResizeObserver` callback, not + * synchronously with the DOM change that resizes the dock -- `waitForDock + * Published` polls both back against the dock's own measured box (rounded up + * the same way `usePublishedBox.ts` rounds) instead of sleeping. It is a + * *bounded* poll, deliberately: this file is also run once against the + * pre-fix build (which never publishes either property at all) to confirm the + * regression, and a wait for a signal that build will never send must not + * hang the whole matrix -- it degrades to "whatever the DOM actually settled + * to" instead, which is exactly what the overlap assertions need to fail + * honestly on that build. + * + * ## What is deliberately out of scope + * + * No phone-tier (390px) case: F-14 is a known, separate overflow there. No + * width below 921px: that is the sheet-inspector tier (`@media + * (max-width:920px)`), a different layout question from the lane-inspector + * one this file is about. The matrix is 3 widths x 2 chromes x 3 content + * states = 18 cases, chosen to span the fix's own documented worst points + * (921 is where the corner's licence line starts wrapping in agent chrome; + * 1024 and 1440 are representative mid/wide lane-tier widths) without + * re-running every width the manual verification in the fix commits covered. + */ +import type { Locator, Page } from "@playwright/test"; +import { TIER2_CATEGORIES } from "@/lib/store/tier2"; +import { callTool } from "./mcp"; +import { expect, test } from "./fixtures"; +import { waitForAwake, waitForFeatures, waitForTools } from "./helpers"; + +const WIDTHS = [921, 1024, 1440] as const; +const CHROMES = ["human", "agent"] as const; +const CONTENT_STATES = ["none", "browsed3", "loaded15"] as const; + +/** Three real tier-2 categories, the same ones `multi-browse.spec.ts` picks. */ +const BROWSE_PICKS = ["cafe", "bar", "bakery"] as const; + +/** 15 of the 18 tier-2 categories -- enough to stress the strip's width the + * same way the fix commits' own manual verification did ("fifteen loaded + * categories"), leaving 3 unloaded (irrelevant: nothing here asserts on the + * total roster). */ +const STRIP_CATEGORIES = TIER2_CATEGORIES.slice(0, 15); + +interface Box { + x: number; + y: number; + width: number; + height: number; +} + +function overlaps(a: Box, b: Box): boolean { + // 0px of overlap is allowed (touching edges): strict inequalities only. + return a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height; +} + +async function boxOf(locator: Locator): Promise { + const box = await locator.boundingBox(); + if (!box) throw new Error("expected element to have a box"); + return box; +} + +function chip(page: Page, category: string): Locator { + return page.locator(`[data-testid="place-chip"][data-category="${category}"]`); +} + +/** Taps a category chip and waits for its own fetch to land, the same + * `pick` idiom `multi-browse.spec.ts` uses. */ +async function pickCategory(page: Page, category: string): Promise { + await chip(page, category).click(); + await expect(chip(page, category)).not.toHaveAttribute("data-loading", "true"); +} + +/** Un-paints whatever is currently on the dock's `places-active` row, one `x` + * per chip -- `remove()` (browse-store.ts) only un-paints; it never unloads, + * so this is how "loaded, not painted" is reached for categories that were + * necessarily painted for a moment while they were the newest of three. */ +async function clearAllPainted(page: Page): Promise { + const active = page.getByTestId("places-active"); + if ((await active.count()) === 0) return; + const attr = (await active.getAttribute("data-categories")) ?? ""; + for (const category of attr.split(",").filter(Boolean)) { + await page.locator(`[data-testid="places-clear"][data-category="${category}"]`).click(); + } + await expect(page.getByTestId("places-active")).toHaveCount(0); +} + +/** + * Polls until `--dock-w`/`--dock-h` (published by `usePublishedBox.ts`'s + * `ResizeObserver`) agree with the dock's own measured, rounded-up box -- + * bounded, and swallowed on timeout (see the file header: a pre-fix build + * never publishes either property, and that is not itself the regression + * this file exists to catch). + */ +async function waitForDockPublished(page: Page): Promise { + try { + await page.waitForFunction( + () => { + const dock = document.querySelector('[data-testid="places-dock"]'); + if (!dock) return false; + const rect = dock.getBoundingClientRect(); + const width = `${Math.ceil(rect.width)}px`; + const height = `${Math.ceil(rect.height)}px`; + const styles = getComputedStyle(document.documentElement); + return ( + styles.getPropertyValue("--dock-w").trim() === width && + styles.getPropertyValue("--dock-h").trim() === height + ); + }, + // No argument to pass into the page function -- `undefined` here is + // load-bearing: `waitForFunction`'s second positional parameter is the + // page-function argument, not the options bag, and passing `{timeout}` + // there instead of as the third parameter silently falls back to the + // ambient TEST timeout (30s/60s) instead of the 3s meant to bound this + // wait -- exactly the gap that let a pre-fix build's never-resolving + // predicate eat the whole test budget instead of degrading quickly. + undefined, + { timeout: 3000 }, + ); + } catch { + // See the file header's "Settling" section. + } +} + +/** Every `.attribution a` link: on screen, and not covered by anything -- + * `document.elementFromPoint` at its own centre must land on the link + * itself or a descendant of it. */ +async function assertAttributionLinksClickable(page: Page): Promise { + const viewport = page.viewportSize(); + if (!viewport) throw new Error("page has no viewport size"); + const links = page.locator(".attribution a"); + const count = await links.count(); + expect(count).toBeGreaterThan(0); + for (let i = 0; i < count; i += 1) { + const result = await links.nth(i).evaluate((el) => { + const rect = el.getBoundingClientRect(); + const cx = rect.left + rect.width / 2; + const cy = rect.top + rect.height / 2; + const hit = document.elementFromPoint(cx, cy); + return { + rect: { x: rect.left, y: rect.top, width: rect.width, height: rect.height }, + clickable: hit === el || el.contains(hit), + text: el.textContent, + }; + }); + expect(result.clickable, `attribution link "${result.text}" covered: ${JSON.stringify(result.rect)}`).toBe( + true, + ); + expect(result.rect.x, `"${result.text}" left of viewport`).toBeGreaterThanOrEqual(0); + expect(result.rect.y, `"${result.text}" above viewport`).toBeGreaterThanOrEqual(0); + expect(result.rect.x + result.rect.width, `"${result.text}" right of viewport`).toBeLessThanOrEqual( + viewport.width, + ); + expect(result.rect.y + result.rect.height, `"${result.text}" below viewport`).toBeLessThanOrEqual( + viewport.height, + ); + } +} + +test.describe("T-109 -- nothing in the bottom band covers anything else", () => { + for (const width of WIDTHS) { + for (const chrome of CHROMES) { + for (const content of CONTENT_STATES) { + test(`${width}x900, ${chrome} chrome, ${content}`, async ({ page }) => { + if (content === "loaded15") test.setTimeout(60_000); + + await page.setViewportSize({ width, height: 900 }); + await page.goto("/"); + await waitForTools(page); + await waitForFeatures(page); + + if (chrome === "agent") { + const state = await callTool(page, "get_map_state"); + expect(state.error).toBeUndefined(); + expect(await waitForAwake(page, 2500)).toBe("awake"); + } + + let expectedActive = 0; + let expectedStrip = 0; + + if (content === "browsed3") { + await page.getByTestId("places-toggle").click(); + for (const category of BROWSE_PICKS) await pickCategory(page, category); + await page.getByTestId("places-toggle").click(); + expectedActive = 3; + expectedStrip = 0; + } else if (content === "loaded15") { + await page.getByTestId("places-toggle").click(); + for (const category of STRIP_CATEGORIES) await pickCategory(page, category); + await clearAllPainted(page); + await page.getByTestId("places-toggle").click(); + expectedActive = 0; + expectedStrip = 15; + } + + // The setup really reached the state this cell claims to test -- + // without this, a broken `pick`/`clearAllPainted` would leave every + // assertion below vacuously true against the "none" layout instead + // of failing where the setup actually broke. + await expect(page.getByTestId("places-active-item")).toHaveCount(expectedActive); + await expect(page.getByTestId("poi-loaded-item")).toHaveCount(expectedStrip); + + await waitForDockPublished(page); + + const dockBox = await boxOf(page.getByTestId("places-dock")); + const attributionBox = await boxOf(page.getByTestId("attribution")); + const badgeBox = await boxOf(page.getByTestId("webmcp-status")); + + expect( + overlaps(dockBox, attributionBox), + `dock ${JSON.stringify(dockBox)} overlaps attribution ${JSON.stringify(attributionBox)}`, + ).toBe(false); + expect( + overlaps(dockBox, badgeBox), + `dock ${JSON.stringify(dockBox)} overlaps webmcp-status ${JSON.stringify(badgeBox)}`, + ).toBe(false); + + if (expectedStrip > 0) { + const stripBox = await boxOf(page.getByTestId("poi-loaded")); + expect( + overlaps(dockBox, stripBox), + `dock ${JSON.stringify(dockBox)} overlaps poi-loaded ${JSON.stringify(stripBox)}`, + ).toBe(false); + } + + await assertAttributionLinksClickable(page); + }); + } + } + } +}); diff --git a/src/app/globals.css b/src/app/globals.css index 3dd6951..35e5bb5 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -988,6 +988,88 @@ html:is([data-chrome="awake"]:not(:where([data-panel="closed"])), :where([data-p padding: 5px 10px; border-radius: var(--radius-s); } +/* The strip also stops before the Places dock, which is an island centred over + this same bar. Nothing above holds it there: the strip's `margin-right: auto` + reaches for the corner, and the dock is out of the flow entirely (absolute, + z-index 20), so at fifteen loaded categories the row ran clean under the pill + and the browsed chips — measured 720px of overlap at 1440 and 319px at 768 — + and both surfaces became unreadable at once. + + The boundary is the gutter beside the dock, and it has to be measured + because the dock's width is content: the pill alone is 159px, the pill plus + three named browsed chips is about 720px, and a person can change which of + the two it is at any moment. `--dock-w` is the dock's own box, published by + `PlacesTray.tsx`; the halving is the dock being centred over this bar (in + agent chrome the lane shifts the dock 5px left of the bar's centre, which is + inside the 16px this leaves for the gap and the rounding). + + The strip keeps growing upward past the cap rather than being cut: more + rows of the same whole chips, which is the same choice `flex-wrap` above + already makes for the same reason. + + Only while the bar and the dock still share the band, and only where the + dock is a centred island. Below 641px the dock spans the bar and the bar is + lifted clear of it (`bottom: 62px`), and the same is true above 641px once a + browsed chip is on the dock (see the lift below) — in both cases there is no + gutter to compute and this would resolve to nothing. */ +@media (min-width: 641px) { + .map-wrap:not(:has(.dock-actives)) .poi-strip { + max-width: min(calc(100vw - 24px), calc((100% - var(--dock-w, 0px)) / 2 - 16px)); + } + /* The corner keeps the mirror image of that gutter, for a harder reason + than the strip's. Even the bare pill is 160px wide, and in agent chrome + the corridor it is centred on has lost a 300px lane — so at 921px the + attribution's own 295px was wider than the 216px left beside the dock and + ran under it, licence links and all. Capped, it wraps instead (below), and + above 1240 there is room for the whole line again so nothing changes. */ + .map-wrap:not(:has(.dock-actives)) .corner { + max-width: calc((100% - var(--dock-w, 0px)) / 2 - 16px); + } +} + +/* What the corner gives up when the gutter is narrower than the licence: the + line wraps. Two lines of licence beside the dock is the honest trade against + one line under it — and the tier below 921px already made exactly this + choice for exactly this reason. Above 1240px the gutter fits the whole line + again, so nothing wraps there and the corner reads as it always has. */ +@media (min-width: 921px) { + .map-wrap:not(:has(.dock-actives)) .attribution { + white-space: normal; + text-align: right; + } +} +/* The dock with browsed chips on it is too wide to share the band at all, and + what it covers is a licence condition. + + One tap paints a kind of place and puts a named chip on the dock; three of + them make it 320-815px wide, which at every width up to 1240 is more than + half the corridor — and in agent chrome more than the corridor itself (the + awake dock is centred on `calc((100% - var(--lane) - 10px) / 2)` with the + canvas, not the corridor, as its shrink-to-fit space). Measured with three + browsed kinds, the dock covered the OpenStreetMap attribution at every width + from 641 to 1024 in human chrome and from 641 to 1440 in agent chrome — by + 22 to 295px — the WebMCP badge by up to 255px and the corner whisper by up + to 87px, and the attribution's three links sat *under* the chips, so they + could not be clicked either. "Data © OpenStreetMap + contributors" is a licence condition and may never be covered; the same + sentence is already written at the phone tier, where this arrangement comes + from. + + So the bar takes the row above the dock, exactly as it does below 641px — + the design's own answer to the same collision, applied at the same moment + the collision appears rather than at a width. Nothing wraps, nothing + narrows, nothing is hidden: the licence, the badge, the whisper and the + disclosure all keep the form they have on the landing map, one band higher. + + `--dock-h` is the dock's own box (`PlacesTray.tsx`); the 28px is its bottom + inset (16px, 12px below 921) plus the gap the bar keeps from it. The + landing map in human chrome is untouched — with no browsed chip there is + no `.dock-actives`, and the bar stays in the corner. */ +@media (min-width: 641px) { + .map-wrap:has(.dock-actives) .bottom-bar { + bottom: calc(var(--dock-h, 0px) + 28px); + } +} .poi-strip-label { font-size: 10px; font-weight: 620; @@ -1091,6 +1173,12 @@ html:is([data-chrome="awake"]:not(:where([data-panel="closed"])), :where([data-p align-items: center; gap: 8px; padding: 7px 12px; + /* Allowed to wrap, so that the corner's cap beside the Places dock (see + `.corner` above) can narrow it instead of pushing it out to the left. Its + parts stay whole because each is `nowrap` on its own — what wraps is where + they sit, never a word. */ + flex-wrap: wrap; + justify-content: flex-end; } .badge .live-dot { width: 7px; diff --git a/src/components/PlacesTray.tsx b/src/components/PlacesTray.tsx index a5beb36..238cb66 100644 --- a/src/components/PlacesTray.tsx +++ b/src/components/PlacesTray.tsx @@ -1,6 +1,6 @@ "use client"; -import { useCallback, useMemo, useState } from "react"; +import { useCallback, useMemo, useRef, useState } from "react"; import { isAgentState } from "@/lib/awaken"; import { useMapStore } from "@/lib/store/map-store"; import type { Tier2Category } from "@/lib/store/tier2"; @@ -10,6 +10,7 @@ import { TIER2_PLURAL } from "./category-labels"; import { TRAY_ORDER, trayCount } from "./places-model"; import { loadedCategoryRows } from "./tier2-disclosure"; import { useAwakenMode } from "./useAwakenMode"; +import { usePublishedBox } from "./usePublishedBox"; const number = (n: number) => n.toLocaleString("en-US"); @@ -49,6 +50,18 @@ const number = (n: number) => n.toLocaleString("en-US"); */ export function PlacesDock() { const mode = useAwakenMode(); + /** + * The dock's own box, published to the stylesheet as `--dock-w`/`--dock-h`. + * + * Everything the bottom bar carries shares this band and none of it can know + * how big the dock is: nought to three browsed chips, each named, is a + * 159x39 to 815x177 range that no constant covers. The disclosure strip + * stops before the width; the bar takes the row above the height the moment + * a browsed chip makes the dock too wide to share the band. See + * `usePublishedBox`, `.poi-strip` and `.bottom-bar`. + */ + const dockRef = useRef(null); + usePublishedBox(dockRef, "--dock"); const [open, setOpen] = useState(false); const [failed, setFailed] = useState(null); /** The category a fourth pick pushed off the map, until the next pick. */ @@ -124,7 +137,7 @@ export function PlacesDock() { ); return ( -
+