feat(a2ui-playground): container queries + mobile share sheet#2731
Conversation
Refactors the preview panel so layout reacts to the panel's own width instead of the viewport, and adds a bottom sheet for surfacing the Components + URL/QR cards on narrow panels. Container queries: - .examplesPreviewWrap hosts a 'previewPanel' container; split → stacked threshold drops from @media (max-width: 1280px) to @container (max-width: 660px), matching the grid floor (360 phone min + 280 controls min). Dragging the JSON/preview resize handle now correctly collapses the split when the panel itself can no longer fit it. - .previewQrSection hosts a 'previewQr' container so QR card layouts respond to their own column width (description hides in narrow columns). QR section polish: - Top-aligns title with the QR thumbnail (was center, which left short text floating mid-QR). - Adds a 'QR unavailable' placeholder (128×128, matching the QR slot) for live drafts whose URLs are too long to encode — keeps the create and example panels structurally aligned (both cards have a right slot). Mobile share sheet: - Adds vaul@^1.1.2. - On panels narrower than 660px the Components stack and Web/Native Preview cards collapse into a bottom sheet, opened by a phone-icon button in the panel header. - A single renderExtras() closure feeds both the inline (display: contents) and sheet renderings, so Copy state stays in sync.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR adds a mobile-friendly "Preview info" share sheet to the playground's preview panel using the ChangesMobile Preview Share Sheet with Container Queries
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
## Summary Reworks the A2UI playground for phones (≤720px) so the **preview** isn't permanently pushed below the fold. Each page now has two full-screen panes — **Chat/Code** and **Preview** — toggled by a bottom tab bar. Everything else around the input/code area gets tightened. Desktop layout is untouched. ### Tab bar - New `<MobileTabBar />` renders **Edit** + **Preview** tabs with `role=tablist`, accent-underline active state, icon + label. Always rendered; CSS shows it only at `≤720px` via `.mobileTabBar` rules in `styles.css`. - `AIChatPage` and `DemosPage` each hold an `activeMobileTab` state and apply it as `data-active-tab` on their page root. CSS hides the non-active pane and the `PanelResizeHandle`. Tab switching is pure CSS — state (chat draft, scroll position, code edits, simulation speed) is preserved across tabs. ### Chrome compaction (`≤720px`) - **`Lynx GenUI Playground` wordmark drops** on phones (was truncating to `Lynx GenUI Playg…`). Logo alone carries the brand. - **Send button** no longer forced to `width: 100%`; stays a compact 38px pill next to the model selector. - **Conversation panel** collapses into a 52px horizontal strip: `+ New Chat` as a 36px icon button, conversations as single-line chips with the desktop active-bar indicator. `Edit/Del` revealed only on the **active** chip (matches desktop hover behavior — was force-shown on every card before). - **Scenarios sidebar** collapses the same way: back-icon on the left, scenarios as one-line chips scrolling horizontally on the right. `SCENARIOS` heading dropped (redundant when chips are the only content). - **Create page header** (`Create` / `Online Agent` / `Describe the UI…`) dropped on mobile — the input area itself communicates the same thing and this band was eating ~120px. - **`A2UI Messages` title** gets `white-space: nowrap` (was wrapping to two lines), JSON badge hidden, toolbar buttons tighter, code panel `flex: 1` so the editor fills the freed space. ## Test plan - [ ] Resize browser to ≤720px (or use mobile device toolbar). Bottom tab bar should appear on Create and Examples → demo detail pages. - [ ] **Tab switching** preserves state — type in the chat input, switch to Preview, switch back: text still there. Same for the JSON editor on Examples. - [ ] **Create page Edit tab**: conversation strip = ~52px tall, `+` icon button + horizontal chip list. `Edit/Del` only visible on the active chip. - [ ] **Examples page Edit tab**: back-arrow icon + horizontal scenario chips. JSON editor fills the rest of the viewport. - [ ] **Preview tab on both pages**: phone preview takes full viewport (minus top nav + bottom tab bar). `Open on phone` sheet trigger from #2731 still works. - [ ] Resize back ≥720px → desktop side-by-side layout returns unchanged; bottom tab bar disappears. - [ ] Light + dark themes both render cleanly. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Mobile tab navigation for narrow screens: tappable Edit/Preview tabs with customizable edit label; integrated into chat and demos pages to preserve active pane. * **Style** * Wide mobile responsive overhaul (max-width: 720px): single-pane views, collapsed conversation strip, icon-only controls, tightened toolbars, hidden header text for logo-only layout. * Adjusted preview fullscreen behavior for specific narrow-width range. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/lynx-family/lynx-stack/pull/2753?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Refactors the A2UI playground preview panel so its layout reacts to the panel's own width instead of the viewport. Dragging the JSON/preview resize handle now correctly collapses the split when the panel itself can no longer fit it — previously only viewport size triggered the collapse, so resizing did nothing.
Also adds a mobile bottom sheet for the Components stack and Web/Native Preview cards on narrow panels, so the phone mockup can dominate the available space.
Container queries
.examplesPreviewWrapis the new container host (container-name: previewPanel). Split → stacked threshold drops from@media (max-width: 1280px)to@container previewPanel (max-width: 660px), matching the grid's natural floor (360 phone min + 280 controls min)..previewQrSectionis its own container (container-name: previewQr) so QR card layouts respond to their own column width (description hides in narrow examples columns).QR section polish
align-items: center, which left short text floating mid-QR).QR unavailable / URL too long to encodeplaceholder (128×128, matching the QR slot) for live drafts whose URLs can't be encoded. Keeps create and example panels structurally aligned (both cards now have a right-side slot).Mobile share sheet
vaul@^1.1.2.renderExtras()closure feeds both the inline (viadisplay: contentson.previewPanelExtras) and sheet renderings, so Copy state stays in sync between them.Test plan
QR unavailableplaceholder in place of the QR; visual rhythm aligns with the example page's QR cards.Summary by CodeRabbit
New Features
Improvements