diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index a8232c7c24..aad5e51211 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -32,46 +32,6 @@ vi.mock('./components/QuittingDisplay.js', () => ({ QuittingDisplay: () => Quitting..., })); -vi.mock('./components/Footer.js', () => ({ - Footer: () => Footer, -})); - -vi.mock('./semantic-colors.js', () => ({ - theme: { - status: { - warning: 'yellow', - }, - }, -})); - -// Don't mock the layout components - let them render normally so tests can see the Ctrl messages - -vi.mock('./hooks/useLayoutConfig.js', () => ({ - useLayoutConfig: () => ({ - mode: 'default', - shouldUseStatic: true, - shouldShowFooterInComposer: true, - }), -})); - -vi.mock('./hooks/useFooterProps.js', () => ({ - useFooterProps: () => ({ - model: 'test-model', - targetDir: '/test', - debugMode: false, - branchName: 'test-branch', - debugMessage: '', - corgiMode: false, - errorCount: 0, - showErrorDetails: false, - showMemoryUsage: false, - promptTokenCount: 0, - nightly: false, - isTrustedFolder: true, - vimMode: undefined, - }), -})); - describe('App', () => { const mockUIState: Partial = { streamingState: StreamingState.Idle, @@ -95,6 +55,7 @@ describe('App', () => { ); expect(lastFrame()).toContain('MainContent'); + expect(lastFrame()).toContain('Notifications'); expect(lastFrame()).toContain('Composer'); }); @@ -126,6 +87,7 @@ describe('App', () => { ); expect(lastFrame()).toContain('MainContent'); + expect(lastFrame()).toContain('Notifications'); expect(lastFrame()).toContain('DialogManager'); }); diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 50d1b84afe..8a582be7f7 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -4,16 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { useUIState } from './contexts/UIStateContext.js'; +import { Box, Text } from 'ink'; import { StreamingContext } from './contexts/StreamingContext.js'; +import { Notifications } from './components/Notifications.js'; +import { MainContent } from './components/MainContent.js'; +import { DialogManager } from './components/DialogManager.js'; +import { Composer } from './components/Composer.js'; +import { useUIState } from './contexts/UIStateContext.js'; import { QuittingDisplay } from './components/QuittingDisplay.js'; -import { useLayoutConfig } from './hooks/useLayoutConfig.js'; -import { ScreenReaderAppLayout } from './layouts/ScreenReaderAppLayout.js'; -import { DefaultAppLayout } from './layouts/DefaultAppLayout.js'; +import { theme } from './semantic-colors.js'; export const App = () => { const uiState = useUIState(); - const layout = useLayoutConfig(); if (uiState.quittingMessages) { return ; @@ -21,11 +23,35 @@ export const App = () => { return ( - {layout.mode === 'screenReader' ? ( - - ) : ( - - )} + + + + + + + {uiState.dialogsVisible ? ( + + ) : ( + + )} + + {uiState.dialogsVisible && uiState.ctrlCPressedOnce && ( + + + Press Ctrl+C again to exit. + + + )} + + {uiState.dialogsVisible && uiState.ctrlDPressedOnce && ( + + + Press Ctrl+D again to exit. + + + )} + + ); }; diff --git a/packages/cli/src/ui/components/Composer.tsx b/packages/cli/src/ui/components/Composer.tsx index 2e826d97f2..9acc49a44d 100644 --- a/packages/cli/src/ui/components/Composer.tsx +++ b/packages/cli/src/ui/components/Composer.tsx @@ -26,12 +26,10 @@ import { useSettings } from '../contexts/SettingsContext.js'; import { ApprovalMode } from '@google/gemini-cli-core'; import { StreamingState } from '../types.js'; import { ConfigInitDisplay } from '../components/ConfigInitDisplay.js'; -import { useLayoutConfig } from '../hooks/useLayoutConfig.js'; export const Composer = () => { const config = useConfig(); const settings = useSettings(); - const layout = useLayoutConfig(); const uiState = useUIState(); const uiActions = useUIActions(); const { vimEnabled, vimMode } = useVimMode(); @@ -178,7 +176,7 @@ export const Composer = () => { /> )} - {!settings.merged.ui?.hideFooter && layout.shouldShowFooterInComposer && ( + {!settings.merged.ui?.hideFooter && (