Skip to content

T-235: TerminalGrid.tsx — 1-4 panes responsive layout + add/close + i18n keys #130

@mpiton

Description

@mpiton

Goal

src/features/terminals/TerminalGrid.tsx: responsive grid that lays out 1-4 <Terminal /> panes (CSS Grid repeat(auto-fit, minmax(...))) with an "Add terminal" tab button and per-pane close button. Reads useTerminalsStore. No state of its own beyond layout.

Layout rules:

  • 1 terminal → fullscreen pane
  • 2 terminals → split horizontal
  • 3 terminals → 2-1 stack
  • 4 terminals → 2×2 grid
  • 5+ → guard rail: button disabled, toast "Max 4 terminals (configurable in Settings, future sprint)"

Per ARCHI §11.5: limit configurable later via AppSettings. Hard-coded 4 cap here, follow-up issue tracks dynamic limit.

Acceptance criteria

  • Grid component renders correct layout for 1/2/3/4 panes (snapshot tests)
  • "Add terminal" button calls useTerminalsStore.open({ project_id, cols: 100, rows: 32 }); disabled at cap
  • Per-pane "X" button calls useTerminalsStore.close(id)
  • Focused terminal has visible ring (Tailwind ring-2 ring-primary)
  • Tab-key cycles focus between panes
  • i18n strings added to src/shared/i18n/locales/{en,fr}.json (T-222 parity test must stay green):
    • terminals.add / terminals.close / terminals.exited / terminals.maxReached
  • Unit tests:
    • it("should render 4 grid panes when 4 terminals are open")
    • it("should disable add button when 4 terminals are open")
    • it("should call close on store when close button clicked")
  • pnpm exec oxlint . --max-warnings=0 clean; vitest snapshots regenerated

Files to create/modify

  • create src/features/terminals/TerminalGrid.tsx
  • create src/features/terminals/TerminalGrid.test.tsx
  • modify src/shared/i18n/locales/en.json
  • modify src/shared/i18n/locales/fr.json
  • modify src/App.tsx to add a /terminals route or expose grid where appropriate

References

  • PRD.md F-003 + F-082 sortable terminal cards
  • ARCHI.md §6.5
  • T-222 i18n parity invariant

Dependencies

Blocked by T-234.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P0Priority P0 — must land in sprintscope: frontendReact / Tauri webview / xterm / CodeMirrorsprint:2026-05-14Sprint 2026-05-14 (Sprint 3) — terminals & PTY foundationtrack:CTrack C — frontend (React, Tailwind, Zustand, i18n)type:featureFeature work (new capability)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions