Repository navigation
Description
Summary
Product direction (confirmed):
We need to update to utilize container-aware responsiveness. Embedding is a core behaviour of the project and we need to be able to respond gracefully to all kinds of embeds.
The widget ships as <sahaj-atlas> embedded in arbitrary host layouts, yet zero container queries exist — every responsive decision keys off the viewport (.claude/reports/RELEASE_READINESS.md §5, Appendix C): useBreakpoint/useIsDesktop via react-responsive's useMediaQuery (src/config/responsive.ts:14-25 and :33-45), plus Tailwind md: variants. Consequence: a 320px-wide column embed on a desktop viewport gets desktop behaviour — a left drawer with handleOnly (no drag handle, no swipe dismiss), the desktop contact popover instead of tel:, no sticky register bar. A narrow-column WordPress sidebar embed gets the wrong interaction model.
In map mode it is worse than wrong — it is impossible: the canvas is position: fixed; inset: 0 (src/App.tsx:173-176), so the map takes the whole viewport regardless of the element's size. Map-mode embedding currently REQUIRES a full-page slot, and that is undocumented.
Current state (verified)
useIsDesktop()consumers:src/views/DrawerStack/DrawerStack.tsx:180,src/views/EventView/EventView.tsx:53,src/components/molecules/EventActions/EventActions.tsx:74(lines current on the in-flightfeat/classify-errorsbranch; the readiness report cites 169/47/74 pre-branch).useIsDesktopdebounces 200ms for a reason: the drawer direction (left ≥md / bottom below) remounts the drawer wrapper on the md crossing — vauldirectionisn't hot-swappable (responsive.ts:27-31docblock). Any container-based signal needs the same damping.LEFT_DRAWER_PX = 352hard-duplicates the--sy-drawer-wCSS default (src/hooks/use-map-controller.tsx:62-66) — a host overriding the variable silently desyncs map camera padding.- Dead code: of the five
breakpointsentries onlymdis consumed today (useBreakpoint('md')atuse-map-controller.tsx:105, plususeIsDesktop); the report flagsxs/sm/xlas dead. Cleanup moves INTO this ticket since it rewritesresponsive.ts. tailwind.config.js:243isplugins: []today.
Proposed changes (implementer refines)
- Observe the widget CONTAINER: a ResizeObserver-based
useContainerBreakpointhook replacing viewportuseIsDesktopwherever the question is really "how wide is the widget" (drawer chrome, popover-vs-tel:, sticky register bar). Keep the remount-damping behaviour. - CSS side: evaluate the
@tailwindcss/container-queriesplugin for@containervariants. Tailwind is pinned3.4.3— v4 utilities don't exist here, and an ungenerated class fails silently (lands in the DOM with no CSS behind it) — see.claude/rules/code-style.md. Any new variant must be verified by computed style, not class presence. - A documented decision table — required output, not optional: for each responsive behaviour, container-derived vs viewport-derived, with the reason. Some decisions may genuinely stay viewport/device-based (e.g. drawer direction bottom-vs-left may be about the device; touch affordances are about the input, not the slot width).
- Define map-mode behaviour in a non-full-page slot — a decision is required in this ticket either way: contain the canvas to the element instead of fixed-inset, OR document full-page as a hard requirement in the host-facing docs.
- Opportunistic (same file region): unify
LEFT_DRAWER_PXwith--sy-drawer-wif it falls out of the container work naturally.
Honest sizing: this is the largest ticket of the wave. It touches DrawerStack/EventView/EventActions regions that sibling tickets also touch — plan for it to merge last and rebase over siblings (this repo squash-merges; see the stacked-PR guidance in CLAUDE.md).
Acceptance criteria
- A narrow (≤400px-wide) column embed on a desktop viewport gets the narrow interaction model per the decision table (drag/dismiss affordances,
tel:contact, sticky register bar — or the explicitly decided equivalent). - The decision table (container-derived vs viewport-derived, per behaviour, with reasons) exists in the code/docs and is reproduced in the implementation report.
- Map mode in a non-full-page slot: either the canvas is contained to the element (no longer
position: fixed; inset: 0), or full-page is documented as a requirement in host-facing docs — the decision is stated. -
src/config/responsive.tsis rewritten; dead breakpoint entries are removed. - If
@tailwindcss/container-queriesis adopted, the plugin is added additively totailwind.config.js, and every new variant is verified generated via computed style. - No regression at real mobile sizes: snap-point ladder, drag-tracking chrome, and swipe dismiss still work.
- Lint + typecheck +
pnpm test:runpass. - Verified in the running widget in at least three shapes: full-page desktop, real mobile viewport, and a narrow column embed on a desktop viewport (via
demo.htmlor a constrained wrapper). - Write an implementation report to
.claude/reports/<issue-number>-<short-slug>.md— in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.
Files affected
src/config/responsive.ts— full rewrite, including dead-breakpoint cleanup- A new container-size hook (e.g.
src/hooks/use-container-breakpoint.ts) - The
useIsDesktopcall sites' behavioural branches:src/views/DrawerStack/DrawerStack.tsx,src/views/EventView/EventView.tsx,src/components/molecules/EventActions/EventActions.tsx src/App.tsx— map-container region onlytailwind.config.js— plugin addition only (additive; a sibling ticket owns the rest of that file)
Parallel implementation: this ticket OWNS the files/regions listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones. This ticket should expect to rebase over siblings at merge time.
References
.claude/reports/RELEASE_READINESS.md§5 (Responsiveness — adapts to the viewport, not its container), Appendix C.claude/rules/code-style.md— Tailwind 3.4.3 pin + the silent ungenerated-class trapCLAUDE.md— stacked-PR / squash-merge rebase guidance
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
fix(widget): guard the slot probe, and measure one box not two
fix(drawer): show the handle the narrow sheet actually earns
merge: bring in main (#145, #146)