summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/AuthInProgress.tsx
diff options
context:
space:
mode:
authormatt korwel <[email protected]>2025-06-20 10:46:41 -0700
committerGitHub <[email protected]>2025-06-20 10:46:41 -0700
commit7c8a1da8fe0856e7ebedcd543f82e20f09816222 (patch)
tree28e597e682bad94d7799028d73449209df1866cb /packages/cli/src/ui/components/AuthInProgress.tsx
parent7c4af82da4ee4322daeb0ab78acafda4a73dc7e9 (diff)
Auth blocking (#1261)
Diffstat (limited to 'packages/cli/src/ui/components/AuthInProgress.tsx')
-rw-r--r--packages/cli/src/ui/components/AuthInProgress.tsx51
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/cli/src/ui/components/AuthInProgress.tsx b/packages/cli/src/ui/components/AuthInProgress.tsx
new file mode 100644
index 00000000..804e2ff8
--- /dev/null
+++ b/packages/cli/src/ui/components/AuthInProgress.tsx
@@ -0,0 +1,51 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import React, { useState, useEffect } from 'react';
+import { Box, Text } from 'ink';
+import Spinner from 'ink-spinner';
+import { Colors } from '../colors.js';
+
+interface AuthInProgressProps {
+ onTimeout: () => void;
+}
+
+export function AuthInProgress({
+ onTimeout,
+}: AuthInProgressProps): React.JSX.Element {
+ const [timedOut, setTimedOut] = useState(false);
+
+ useEffect(() => {
+ const timer = setTimeout(() => {
+ setTimedOut(true);
+ onTimeout();
+ }, 30000);
+
+ return () => clearTimeout(timer);
+ }, [onTimeout]);
+
+ return (
+ <Box
+ borderStyle="round"
+ borderColor={Colors.Gray}
+ flexDirection="column"
+ padding={1}
+ width="100%"
+ >
+ {timedOut ? (
+ <Text color={Colors.AccentRed}>
+ Authentication timed out. Please try again.
+ </Text>
+ ) : (
+ <Box>
+ <Text>
+ <Spinner type="dots" /> Waiting for auth...
+ </Text>
+ </Box>
+ )}
+ </Box>
+ );
+}