From 0c26aaebdd21257089972579e9bc043e11072d15 Mon Sep 17 00:00:00 2001 From: CLYEH Date: Wed, 2 Sep 2026 12:55:50 +0800 Subject: [PATCH 1/6] fix(ui): stop the loaded-POI strip before the Places dock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bottom-left disclosure grew right and up as categories loaded while the Places dock sat centred over the same band, absolutely positioned and out of the flow: nothing bounded the strip's right edge against the dock's left one. With fifteen loaded-but-unpainted categories and three browsed chips the two overlapped by 720px at 1440, 449px at 1024 and 319px at 768 — the counts and the browsed chips illegible at once, and the strip is the only thing on screen that says an agent put thousands of searchable places in memory. The dock now publishes its own width as `--dock-w` and the strip stops in the gutter beside it. Measured rather than a constant, because the dock's width is content: 159px for the pill alone, ~720px with three named chips, and a person changes which of the two it is with a tap. The strip wraps into more rows past the cap instead of being cut, which is the choice the row already made. Verified in Chromium at 390/641/700/768/900/921/1024/1240/1241/1360/1440/1600/ 1920, in human and agent chrome, at 0/3/6/10/15/18 loaded categories: overlap is now 0px in every case (was non-zero in 22 of 40 before). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01GvdrJcKNZkfREdb7QGRYYH --- src/app/globals.css | 27 +++++++++++++++ src/components/PlacesTray.tsx | 14 ++++++-- src/components/usePublishedWidth.ts | 51 +++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 src/components/usePublishedWidth.ts diff --git a/src/app/globals.css b/src/app/globals.css index 95cb70b..2af6499 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -988,6 +988,33 @@ 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 where the dock is a centred island. Below 641px it spans the bar and + the bar is lifted clear of it (`bottom: 62px`), so there is no gutter to + compute and this would resolve to nothing. */ +@media (min-width: 641px) { + .poi-strip { + max-width: min(calc(100vw - 24px), calc((100% - var(--dock-w, 0px)) / 2 - 16px)); + } +} .poi-strip-label { font-size: 10px; font-weight: 620; diff --git a/src/components/PlacesTray.tsx b/src/components/PlacesTray.tsx index a5beb36..2c88786 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 { usePublishedWidth } from "./usePublishedWidth"; const number = (n: number) => n.toLocaleString("en-US"); @@ -49,6 +50,15 @@ const number = (n: number) => n.toLocaleString("en-US"); */ export function PlacesDock() { const mode = useAwakenMode(); + /** + * The dock's own width, published to the stylesheet as `--dock-w`. + * + * The loaded-POI disclosure shares this band and has no way to know how wide + * the dock is: nought to three browsed chips, each named, is a 159-720px + * range that no constant covers. See `usePublishedWidth` and `.poi-strip`. + */ + const dockRef = useRef(null); + usePublishedWidth(dockRef, "--dock-w"); 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 +134,7 @@ export function PlacesDock() { ); return ( -
+