From 7c8a1da8fe0856e7ebedcd543f82e20f09816222 Mon Sep 17 00:00:00 2001 From: matt korwel Date: Fri, 20 Jun 2025 10:46:41 -0700 Subject: Auth blocking (#1261) --- packages/cli/src/ui/components/AuthInProgress.tsx | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 packages/cli/src/ui/components/AuthInProgress.tsx (limited to 'packages/cli/src/ui/components/AuthInProgress.tsx') 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 ( + + {timedOut ? ( + + Authentication timed out. Please try again. + + ) : ( + + + Waiting for auth... + + + )} + + ); +} -- cgit v1.2.3