fix(tui): make the welcome panel responsive to terminal size (#1067)

Merged
SA
3mo ago
+242-57

Closes #1067.

What & why

The welcome panel (home_logo slot) rendered a fixed two-column boot box — block ALTIMATE CODE wordmark on the left (~65 cols), "What is Altimate Code" on the right — that never shrank. On a typical terminal it took ~40–50% of the screen and couldn't be reduced, which is what #1067 reports.

What this does

It now scales with terminal size, reactively (adapts live on resize), using the repo's existing breakpoint idiom (useTerminalDimensions + createMemo, as in routes/session/permission.tsx and component/upgrade-indicator.tsx). Both axes gate each step — the wordmark is wide and tall:

VariantWhenWhat shows~height
full≥110w & ≥44hthe two-column wordmark boot box (large windows only)~13 rows
mediumin between (the common case)title + one condensed line + CTA, no wordmark~6 rows
compact<60w or <18ha single line; the border title already carries the version~3 rows

On an everyday laptop terminal (e.g. 106×31, 80×24) you now get medium; the full branded panel returns only when there's genuinely room for it.

Notes

  • The breakpoint decision is a pure function in welcome-panel-utils.ts (mirroring upgrade-indicator-utils.ts), so it's unit-testable without the render/sync context. 4 tests cover the thresholds and that the smaller dimension wins.
  • Scope: responsiveness only. No dismiss / collapse-once-connected behavior change — that's separable and can be a follow-up if wanted.
  • Thresholds are four named constants in welcome-panel-utils.ts, easy to tune.

Verified

tsgo --noEmit clean · 4 unit tests pass · existing home-onboarding render test still passes · oxlint 0/0 · prettier.

🤖 Generated with Claude Code


Summary by cubic

Make the TUI welcome panel responsive to its available space, so it no longer overtakes small terminals or sidebar layouts. Addresses AI-1067 by switching between full, medium, and compact layouts, updating live on resize and sidebar toggle.

  • Bug Fixes
    • Moved breakpoint logic to welcome-panel-utils as welcomePanelVariant(width, height) using available size and PANEL_VERTICAL_RESERVE; thresholds are floors (MEDIUM_MIN_*, FULL_MIN_* with height floor 36).
    • WelcomePanel now accepts availableWidth/availableHeight; home passes width-4 and height-PANEL_VERTICAL_RESERVE, session passes contentWidth() and height-PANEL_VERTICAL_RESERVE.
    • Simplified render logic with <Switch>/<Match>, deduped the CTA, trimmed the full left column to 54 cols, and shortened the medium copy; no change to CTA/dismiss behavior.
    • Expanded unit tests to prove both width/height gates, exact boundaries, and sidebar/short-terminal cases.

Summary by CodeRabbit

  • New Features

    • The welcome panel now adapts its layout to the available terminal size.
    • Added full, medium, and compact layouts for different terminal dimensions.
    • Compact layouts provide condensed information and streamlined readiness actions.
    • The panel now accounts for available content space across home and session views.
  • Tests

    • Added coverage for layout selection across terminal size thresholds, boundary conditions, and constrained dimensions.