Skip to content

Commit 762c558

Browse files
committed
refactor(tui): adjust panel chrome and dynamic visible items
Update PANEL_CHROME constant to better reflect actual padding needs Add dynamic calculation of visible items based on terminal height
1 parent 7ed65bc commit 762c558

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/cli/tui/routes/workflow/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export const HEADER_HEIGHT = 3 // Branding header
88
export const FOOTER_HEIGHT = 2 // Telemetry bar + status footer
99
export const PANEL_BORDER = 2 // Top and bottom border of panel
10-
export const PANEL_CHROME = 4 // Extra buffer for panel headers, padding, etc.
10+
export const PANEL_CHROME = 2 // Extra buffer for padding
1111

1212
/**
1313
* Calculate visible items based on terminal height

src/cli/tui/routes/workflow/context/ui-state/initial-state.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55
import type { WorkflowState } from "./types"
66
import packageJson from "../../../../../../../package.json" with { type: "json" }
7+
import { calculateVisibleItems } from "../../constants"
8+
9+
/**
10+
* Get initial visible item count based on actual terminal dimensions
11+
*/
12+
function getInitialVisibleItemCount(): number {
13+
const termHeight = process.stdout.rows ?? 30
14+
return calculateVisibleItems(termHeight)
15+
}
716

817
/**
918
* Create initial workflow UI state
@@ -30,7 +39,7 @@ export function createInitialState(workflowName: string, totalSteps = 0): Workfl
3039
selectedAgentId: null,
3140
selectedSubAgentId: null,
3241
selectedItemType: null,
33-
visibleItemCount: 10,
42+
visibleItemCount: getInitialVisibleItemCount(),
3443
scrollOffset: 0,
3544
totalSteps,
3645
workflowStatus: "running",

0 commit comments

Comments
 (0)