diff options
| author | Gal Zahavi <[email protected]> | 2025-08-07 15:55:53 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-07 22:55:53 +0000 |
| commit | 4f2974dbfe36638915f1b08448d2563c64f88644 (patch) | |
| tree | 3c895adaad2de5a9e1ac14495c78f1b06d6c7d8d /packages/cli/src/ui/App.tsx | |
| parent | 65e4b941ee96525895b5a11fcb95725817478775 (diff) | |
feat(ui): Improve UI layout adaptation for narrow terminals (#5651)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.tsx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index d311facf..a25b7a56 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -93,6 +93,7 @@ import { ShowMoreLines } from './components/ShowMoreLines.js'; import { PrivacyNotice } from './privacy/PrivacyNotice.js'; import { setUpdateHandler } from '../utils/handleAutoUpdate.js'; import { appEvents, AppEvent } from '../utils/events.js'; +import { isNarrowWidth } from './utils/isNarrowWidth.js'; const CTRL_EXIT_PROMPT_DURATION_MS = 1000; @@ -433,6 +434,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { // Terminal and UI setup const { rows: terminalHeight, columns: terminalWidth } = useTerminalSize(); + const isNarrow = isNarrowWidth(terminalWidth); const { stdin, setRawMode } = useStdin(); const isInitialMount = useRef(true); @@ -441,7 +443,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { 20, Math.floor(terminalWidth * widthFraction) - 3, ); - const suggestionsWidth = Math.max(60, Math.floor(terminalWidth * 0.8)); + const suggestionsWidth = Math.max(20, Math.floor(terminalWidth * 0.8)); // Utility callbacks const isValidPath = useCallback((filePath: string): boolean => { @@ -835,11 +837,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { items={[ <Box flexDirection="column" key="header"> {!settings.merged.hideBanner && ( - <Header - terminalWidth={terminalWidth} - version={version} - nightly={nightly} - /> + <Header version={version} nightly={nightly} /> )} {!settings.merged.hideTips && <Tips config={config} />} </Box>, @@ -994,9 +992,10 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { <Box marginTop={1} - display="flex" justifyContent="space-between" width="100%" + flexDirection={isNarrow ? 'column' : 'row'} + alignItems={isNarrow ? 'flex-start' : 'center'} > <Box> {process.env.GEMINI_SYSTEM_MD && ( @@ -1021,7 +1020,7 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { /> )} </Box> - <Box> + <Box paddingTop={isNarrow ? 1 : 0}> {showAutoAcceptIndicator !== ApprovalMode.DEFAULT && !shellModeActive && ( <AutoAcceptIndicator |
