- Also updated ci.yml to ensure that linting failures will break the build. Fully fixes https://b.corp.google.com/issues/411384603
32 lines
744 B
TypeScript
32 lines
744 B
TypeScript
import React from 'react';
|
|
import { Box, Text } from 'ink';
|
|
import Spinner from 'ink-spinner';
|
|
|
|
interface LoadingIndicatorProps {
|
|
isLoading: boolean;
|
|
currentLoadingPhrase: string;
|
|
elapsedTime: number;
|
|
}
|
|
|
|
export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
|
isLoading,
|
|
currentLoadingPhrase,
|
|
elapsedTime,
|
|
}) => {
|
|
if (!isLoading) {
|
|
return null; // Don't render anything if not loading
|
|
}
|
|
|
|
return (
|
|
<Box marginTop={1} paddingLeft={0}>
|
|
<Box marginRight={1}>
|
|
<Spinner type="dots" />
|
|
</Box>
|
|
<Text color="cyan">
|
|
{currentLoadingPhrase} ({elapsedTime}s)
|
|
</Text>
|
|
<Box flexGrow={1}>{/* Spacer */}</Box>
|
|
<Text color="gray">(ESC to cancel)</Text>
|
|
</Box>
|
|
);
|
|
};
|