Skip to content

feat(gastown): configurable terminal orientation with drag-to-resize#1299

Merged
jrf0110 merged 3 commits intomainfrom
1237-terminal-orientation-resize
Mar 21, 2026
Merged

feat(gastown): configurable terminal orientation with drag-to-resize#1299
jrf0110 merged 3 commits intomainfrom
1237-terminal-orientation-resize

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Mar 19, 2026

Summary

  • Terminal bar can now be positioned at bottom, top, left, or right via a position picker in the tab bar. Position and expanded size are persisted to localStorage.
  • Drag-to-resize handle on the inner edge of the terminal bar with min/max constraints (horizontal: 100px–70vh, vertical: 200px–50vw).
  • Replaced static pb-[340px] with a TerminalBarPadding client component that dynamically adjusts padding based on position, size, and collapsed state. Collapsed state only reserves the tab bar strip (38px).
  • Vertical orientation adapts the tab bar to a column layout with icon-only tabs, and the AlarmStatusPane switches to single-column stacked layout.
  • DrawerStack offsets its right position when the terminal is placed on the right side of the viewport.

Closes #1237

Verification

  • pnpm typecheck — passes across all workspace packages
  • pnpm run format:check (oxfmt) — passes
  • pnpm run lint (oxlint + eslint fallback) — passes across all packages
  • Pre-push hook (format + lint + typecheck) — passes

Visual Changes

image image image

Reviewer Notes

  • The TerminalBarPadding client component was extracted because the layout files are Server Components and can't consume React context directly.
  • The DrawerStackRendererWithContext wrapper reads useTerminalBar() to compute the drawer right offset. This is safe because DrawerStackProvider is always rendered inside TerminalBarProvider in both layout files.
  • xterm.js auto-refit on resize is already handled by the existing ResizeObserver + fitAddon.fit() in useXtermPty.ts. The MayorTerminalPane additionally re-fits on position/size changes.
  • The issue notes that MayorTerminalPane duplicates xterm setup (identified in Fix terminal stability — WebSocket reconnection, resize debounce, control frame filtering #1195) — deduplication is out of scope for this PR.

Comment thread src/components/gastown/TerminalBarContext.tsx Outdated
Comment thread src/components/gastown/TerminalBar.tsx Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 19, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

No new issues in the incremental diff.

Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
src/components/gastown/DrawerStack.tsx 236 Right-docked terminal can push the drawer off-screen because the drawer width is still capped against the full viewport instead of the remaining width to the left of the terminal.
src/components/gastown/TerminalBarContext.tsx 93 Stored size is restored without clampSize, so reopening on a smaller viewport or after an orientation change can violate the new min/max constraints until the user resizes or switches position again.
Files Reviewed (1 files)
  • src/components/gastown/TerminalBar.tsx - 0 issues

Reviewed by gpt-5.4-20260305 · 258,239 tokens

jrf0110 added 2 commits March 20, 2026 20:15
…1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.
…tton

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.
@jrf0110 jrf0110 force-pushed the 1237-terminal-orientation-resize branch from e852334 to 1a4a5e5 Compare March 21, 2026 01:16
style={{
right: rightOffset,
width: DRAWER_WIDTH,
maxWidth: '94vw',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Drawer width is still capped against the full viewport

When the terminal is docked on the right, rightOffset can grow to COLLAPSED_SIZE + size, but the drawer still uses maxWidth: '94vw'. On narrower viewports, a wide right-side terminal pushes the drawer's left edge off-screen because the width limit does not subtract the reserved terminal space. Clamp against the remaining width (for example calc(100vw - rightOffset)) before applying the offset.

…/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations
@jrf0110 jrf0110 merged commit 2b4bd68 into main Mar 21, 2026
18 checks passed
@jrf0110 jrf0110 deleted the 1237-terminal-orientation-resize branch March 21, 2026 04:32
jrf0110 added a commit that referenced this pull request Mar 21, 2026
…age (#1365)

* feat(gastown): configurable terminal orientation with drag-to-resize (#1299)

* feat(gastown): configurable terminal orientation and drag-to-resize (#1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.

* fix(gastown): clamp size on orientation switch, add vertical close button

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.

* fix(gastown): fix terminal resize handle and position picker for left/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations

* chore: cherry-pick getMergeQueueData types from bead 0

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page

Add NeedsAttention component with:
- Three attention categories: open PRs, failed reviews, stale PRs
- Convoy grouping with header cards showing progress, branch, merge mode
- Action buttons: Open PR, Retry Review, Fail Bead, View Bead
- DrawerStack integration for bead and convoy drawer opening
- Confirmation dialogs for destructive actions
- Empty state when no items need attention

Rewrite MergesPageClient to use getMergeQueueData tRPC procedure
with 5s polling interval.
jrf0110 added a commit that referenced this pull request Mar 23, 2026
… log (#1378)

* feat(gastown): add getMergeQueueData tRPC procedure for merge queue page

Add a dedicated tRPC query that returns structured merge queue data:
- needsAttention section with openPRs, failedReviews, and stalePRs
- activityLog with enriched review-related bead events
- Full JOINs to review_metadata, source beads, convoy_metadata, agents, rigs
- Input params: townId (required), rigId, limit, since for filtering/polling
- Zod schemas with rpcSafe wrappers and type declarations for frontend

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page (#1365)

* feat(gastown): configurable terminal orientation with drag-to-resize (#1299)

* feat(gastown): configurable terminal orientation and drag-to-resize (#1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.

* fix(gastown): clamp size on orientation switch, add vertical close button

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.

* fix(gastown): fix terminal resize handle and position picker for left/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations

* chore: cherry-pick getMergeQueueData types from bead 0

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page

Add NeedsAttention component with:
- Three attention categories: open PRs, failed reviews, stale PRs
- Convoy grouping with header cards showing progress, branch, merge mode
- Action buttons: Open PR, Retry Review, Fail Bead, View Bead
- DrawerStack integration for bead and convoy drawer opening
- Confirmation dialogs for destructive actions
- Empty state when no items need attention

Rewrite MergesPageClient to use getMergeQueueData tRPC procedure
with 5s polling interval.

* feat(gastown): add convoy grouping and per-rig filtering to Merge Queue page (#1366)

* feat(gastown): add convoy grouping and per-rig filtering to Merge Queue page

- Add RefineryActivityLog with convoy grouping: entries grouped by convoy
  with header cards showing title, branch, progress, clickable to open
  convoy drawer
- Add per-rig filter dropdown using listRigs query and shadcn Select,
  passes rigId to getMergeQueueData for server-side filtering
- Include status_changed ActionType with type guard (no unsafe 'as' cast)
- Polish layout: page title, rig filter, Needs Attention, Activity Log
  sections with consistent headers and empty states

* fix(gastown): move hooks above early returns and paginate by convoy groups

- Move all useMemo hooks above isLoading/empty early returns to prevent
  React crash when entries transition from 0 to non-zero (hooks must be
  called in the same order on every render)
- Replace flat-entry pagination with group-based pagination: convoy
  groups (sorted by most recent activity) are kept whole, and standalone
  entries fill remaining page budget. This ensures recently active
  convoys appear on page 1 regardless of other convoys' sizes.

* fix(gastown): interleave convoy groups and standalone entries by recency in pagination

The previous pagination showed all convoy groups before any standalone
entries regardless of timestamps. A standalone entry more recent than all
convoy groups would still appear below them on page 1.

Merge convoy groups and standalone entries into a unified DisplayItem list
sorted by most-recent timestamp, then paginate over that list. Convoy
groups use their latestTimestamp as sort key; standalone entries use their
event.created_at. This ensures the most recently active items appear first
on page 1 regardless of whether they are convoy-grouped or standalone.

Hooks were already correctly placed before early returns (no conditional
hooks issue in the current code).

* fix(gastown): gate fail button behind admin check and fix pagination remaining count

Hide the admin-only 'Fail Bead' button for non-admin users by checking
isAdmin from the session. Fix the activity log pagination to compute
hasMore and remaining count based on actual visible entries rather than
the budget, preventing incorrect 'Show more' state when a convoy group
exceeds the page budget.
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.

Configurable terminal orientation (top/bottom/left/right) with drag-to-resize

2 participants