Download packages/app/src/pages/session/session-panel-width.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/pages/session/session-panel-width.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/pages/session/session-panel-width.ts
-
curl -L -o session-panel-width.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/pages/session/session-panel-width.ts
1.1 kB
| // The review pane has no width of its own: it takes whatever the chat panel | |
| // leaves behind. Instead of capping the chat panel at a fraction of the window | |
| // (which forces the review pane to grow with the monitor), reserve a fixed | |
| // minimum for the review pane and let the chat panel take everything else. | |
| export const SESSION_PANEL_WIDTH_MIN = 450 | |
| export const REVIEW_PANE_WIDTH_MIN = 480 | |
| export const REVIEW_PANE_WIDTH_MIN_SPLIT = 800 | |
| export function sessionPanelWidthMax(input: { available: number; split: boolean }) { | |
| const pane = input.split ? REVIEW_PANE_WIDTH_MIN_SPLIT : REVIEW_PANE_WIDTH_MIN | |
| return Math.max(SESSION_PANEL_WIDTH_MIN, input.available - pane) | |
| } | |
| // `available` is undefined until the layout row is first measured; render the | |
| // stored width untouched until then to avoid a first-frame snap. | |
| export function clampSessionPanelWidth(input: { width: number; available: number | undefined; split: boolean }) { | |
| if (input.available === undefined) return input.width | |
| return Math.min(input.width, sessionPanelWidthMax({ available: input.available, split: input.split })) | |
| } | |