Skip to content

fix(desktop): responsive composer, model-picker viewport fit, provider model search - #101

Merged
mlubbad merged 1 commit into
mainfrom
fix/desktop-frontend-ui
Jul 21, 2026
Merged

mlubbad merged 1 commit into
mainfrom
fix/desktop-frontend-ui

Conversation

@mlubbad

@mlubbad mlubbad commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Fixes the three reported frontend issues at their root causes, plus a stacking sweep from the same review.

1 — Composer breaks when DevTools narrows the window

Root cause: .composer-row was a single-line flex of fixed-size items, and the model pill had no truncation — a long model id (gemini-3.1-pro-preview) wrapped inside the fixed 32px pill and the controls spilled out of the card.
Fix: the row wraps (flex-wrap); the trailing model/mic/voice/send cluster is one right-aligned .composer-actions unit that wraps as a whole; long ids ellipsize via a min-width:0 chain with the full id on the pill tooltip.
Verified live at 770px: no overflow, row wraps to two tidy lines, a 45-char id keeps the pill at 32px with an ellipsis.

2 — Models & keys unusable after "Load models" (hundreds of chips, no search)

Root cause: ProvidersPage rendered the entire catalog unconditionally.
Fix: catalogs ≥ 10 models get a per-provider search box (filters the full catalog, case-insensitive, live match counter); ≥ 24 models are capped behind "Show all N models" / "Show fewer". Every existing feature (click-to-use, eye visibility toggle, remove, custom add, Load models, Test, key entry) is untouched and keeps operating on the full catalog.
Verified live against the real backend: Google Gemini (48 loaded models) → 24 chips + search + "Show all 48 models"; NVIDIA NIM (122) same; searching "flash-image" → "3 of 48 match"; small providers keep the plain row.

3 — Model mega-menu opens clipped past the top of the window

Root cause: useMenuFit measured once at open, but the picker's provider list loads async — the bottom-anchored panel then grows upward past the viewport top with no re-measure. (The 50vh CSS cap and the one-shot clamp landed in #21/#74; this was the remaining gap.)
Fix: the hook re-clamps on panel size changes (ResizeObserver) — which hardens every menu in the app, since they all route through it — and a panel taller than the viewport is capped to it and scrolls internally (author max-heights tighter than the viewport are respected). .mp-pop also drops its rigid min-width: 520px for width: min(520px, calc(100vw - 16px)) with flexible columns, so it can't out-width a narrow window.
Verified live: opened the picker, watched it grow 1 → 7 rows when the fetch landed, panel stayed fully on-screen with the models column scrolling internally.

4 — Comprehensive sweep + regression tests

  • Stacking: .settings-overlay and .palette-overlay had no z-index, so open in-page menus (z 40–45) could paint over the Settings modal / command palette — both now sit on the modal tier (60). Audited the full z scale (10/20/30/40–45/60/70/80/200) — no other inversions.
  • Menus: every popover in the app uses useMenuFit, so the ResizeObserver fix covers the add-menu, flyouts, retry menu, mic picker, conv/project menus, etc.
  • New tests (all green, 357 total):
    • useMenuFit.test — growth-after-open re-clamp, taller-than-viewport cap, observer teardown
    • ProvidersPage.test — cap + expander, full-catalog search past the cap, counter, empty state, actions from a filtered view, small-catalog no-chrome
    • ModelPicker.test — async load row set, select/effort/thinking/more/close paths
    • Composer.test — pill truncation contract (short label + full-id tooltip), actions grouping
    • styles.contract.test — pins the load-bearing CSS rules as text (jsdom computes no layout), with a tiny brace-aware extractor that handles @media nesting

npm run typecheck ✓ · npm run test 357/357 ✓ · npm run build ✓ (backend/shell untouched)

🤖 Generated with Claude Code

…r model search

Three user-visible UI defects, fixed at their root causes:

1. Composer turned to soup at narrow widths (DevTools docked, split screen):
   .composer-row was a single-line flex of fixed-size items and the model pill
   had no truncation, so long model ids wrapped inside the fixed-height pill and
   controls spilled out of the card. The row now wraps; the trailing
   model/mic/voice/send cluster is one right-aligned .composer-actions unit that
   wraps as a whole; long model ids ellipsize (full id on the pill tooltip).

2. Model+effort mega-menu opened clipped past the viewport top: useMenuFit
   measured once at open, but the picker's provider list loads async and the
   bottom-anchored panel then grows UPWARD with no re-measure. The hook now
   re-clamps on panel size changes (ResizeObserver), and a panel taller than the
   viewport is capped to it and scrolls internally (author max-heights tighter
   than the viewport stay untouched). .mp-pop also loses its rigid 520px
   min-width (width: min(520px, 100vw - 16px), flexible columns).

3. Models & keys drowned in chips after "Load models" (hundreds of ids, no
   search): big catalogs now get a per-provider search box (filters the FULL
   catalog, case-insensitive, with a match counter) and a 24-chip cap behind
   "Show all N models" / "Show fewer". Every chip feature (pick, eye, remove,
   custom add) keeps operating on the full catalog.

Sweep fixes from the same review: .settings-overlay and .palette-overlay sat on
z-index auto, so open in-page menus (z 40-45) could paint over them — both now
sit on the modal tier (60).

Tests: ResizeObserver growth + viewport-cap cases in useMenuFit.test; search/
cap/expander cases in ProvidersPage.test; new ModelPicker.test (async load,
select/effort/thinking/close paths); new Composer.test (pill truncation
contract, actions grouping); new styles.contract.test pinning the load-bearing
CSS rules (jsdom computes no layout, so the stylesheet contract is asserted as
text). Desktop suite: 357 tests green; typecheck + build green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mlubbad
mlubbad merged commit c2a3f90 into main Jul 21, 2026
6 checks passed
@mlubbad
mlubbad deleted the fix/desktop-frontend-ui branch July 21, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant