Download projects/gemini-cli/packages/cli/src/ui/components/LoadingIndicator.tsx from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 2.59 kB
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/components/LoadingIndicator.tsx
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai@2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/components/LoadingIndicator.tsx
-
curl -L -o LoadingIndicator.tsx https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/2147bc06c2ccf123b96f98eace2e6bf6486e7f0e/projects/gemini-cli/packages/cli/src/ui/components/LoadingIndicator.tsx
2.59 kB
| /** | |
| * @license | |
| * Copyright 2025 Google LLC | |
| * SPDX-License-Identifier: Apache-2.0 | |
| */ | |
| import type { ThoughtSummary } from '@google/gemini-cli-core'; | |
| import type React from 'react'; | |
| import { Box, Text } from 'ink'; | |
| import { Colors } from '../colors.js'; | |
| import { useStreamingContext } from '../contexts/StreamingContext.js'; | |
| import { StreamingState } from '../types.js'; | |
| import { GeminiRespondingSpinner } from './GeminiRespondingSpinner.js'; | |
| import { formatDuration } from '../utils/formatters.js'; | |
| import { useTerminalSize } from '../hooks/useTerminalSize.js'; | |
| import { isNarrowWidth } from '../utils/isNarrowWidth.js'; | |
| interface LoadingIndicatorProps { | |
| currentLoadingPhrase?: string; | |
| elapsedTime: number; | |
| rightContent?: React.ReactNode; | |
| thought?: ThoughtSummary | null; | |
| } | |
| export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({ | |
| currentLoadingPhrase, | |
| elapsedTime, | |
| rightContent, | |
| thought, | |
| }) => { | |
| const streamingState = useStreamingContext(); | |
| const { columns: terminalWidth } = useTerminalSize(); | |
| const isNarrow = isNarrowWidth(terminalWidth); | |
| if (streamingState === StreamingState.Idle) { | |
| return null; | |
| } | |
| const primaryText = thought?.subject || currentLoadingPhrase; | |
| const cancelAndTimerContent = | |
| streamingState !== StreamingState.WaitingForConfirmation | |
| ? `(esc to cancel, ${elapsedTime < 60 ? `${elapsedTime}s` : formatDuration(elapsedTime * 1000)})` | |
| : null; | |
| return ( | |
| <Box paddingLeft={0} flexDirection="column"> | |
| {/* Main loading line */} | |
| <Box | |
| width="100%" | |
| flexDirection={isNarrow ? 'column' : 'row'} | |
| alignItems={isNarrow ? 'flex-start' : 'center'} | |
| > | |
| <Box> | |
| <Box marginRight={1}> | |
| <GeminiRespondingSpinner | |
| nonRespondingDisplay={ | |
| streamingState === StreamingState.WaitingForConfirmation | |
| ? '⠏' | |
| : '' | |
| } | |
| /> | |
| </Box> | |
| {primaryText && ( | |
| <Text color={Colors.AccentPurple}>{primaryText}</Text> | |
| )} | |
| {!isNarrow && cancelAndTimerContent && ( | |
| <Text color={Colors.Gray}> {cancelAndTimerContent}</Text> | |
| )} | |
| </Box> | |
| {!isNarrow && <Box flexGrow={1}>{/* Spacer */}</Box>} | |
| {!isNarrow && rightContent && <Box>{rightContent}</Box>} | |
| </Box> | |
| {isNarrow && cancelAndTimerContent && ( | |
| <Box> | |
| <Text color={Colors.Gray}>{cancelAndTimerContent}</Text> | |
| </Box> | |
| )} | |
| {isNarrow && rightContent && <Box>{rightContent}</Box>} | |
| </Box> | |
| ); | |
| }; | |