mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 03:24:42 -07:00
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2025 Google LLC
|
||
|
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { Box, Text } from 'ink';
|
||
|
|
import { useAppContext } from '../contexts/AppContext.js';
|
||
|
|
import { useUIState } from '../contexts/UIStateContext.js';
|
||
|
|
import { Colors } from '../colors.js';
|
||
|
|
import { StreamingState } from '../types.js';
|
||
|
|
import { UpdateNotification } from './UpdateNotification.js';
|
||
|
|
|
||
|
|
export const Notifications = () => {
|
||
|
|
const { startupWarnings } = useAppContext();
|
||
|
|
const { initError, streamingState, updateInfo } = useUIState();
|
||
|
|
|
||
|
|
const showStartupWarnings = startupWarnings.length > 0;
|
||
|
|
const showInitError =
|
||
|
|
initError && streamingState !== StreamingState.Responding;
|
||
|
|
|
||
|
|
if (!showStartupWarnings && !showInitError && !updateInfo) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
{updateInfo && <UpdateNotification message={updateInfo.message} />}
|
||
|
|
{showStartupWarnings && (
|
||
|
|
<Box
|
||
|
|
borderStyle="round"
|
||
|
|
borderColor={Colors.AccentYellow}
|
||
|
|
paddingX={1}
|
||
|
|
marginY={1}
|
||
|
|
flexDirection="column"
|
||
|
|
>
|
||
|
|
{startupWarnings.map((warning, index) => (
|
||
|
|
<Text key={index} color={Colors.AccentYellow}>
|
||
|
|
{warning}
|
||
|
|
</Text>
|
||
|
|
))}
|
||
|
|
</Box>
|
||
|
|
)}
|
||
|
|
{showInitError && (
|
||
|
|
<Box
|
||
|
|
borderStyle="round"
|
||
|
|
borderColor={Colors.AccentRed}
|
||
|
|
paddingX={1}
|
||
|
|
marginBottom={1}
|
||
|
|
>
|
||
|
|
<Text color={Colors.AccentRed}>
|
||
|
|
Initialization Error: {initError}
|
||
|
|
</Text>
|
||
|
|
<Text color={Colors.AccentRed}>
|
||
|
|
{' '}
|
||
|
|
Please check API key and configuration.
|
||
|
|
</Text>
|
||
|
|
</Box>
|
||
|
|
)}
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
};
|