summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/AuthDialog.tsx
diff options
context:
space:
mode:
authorTommaso Sciortino <[email protected]>2025-06-19 19:28:56 -0700
committerGitHub <[email protected]>2025-06-19 19:28:56 -0700
commit2f1fc3f359b5c6e989ae75efc8a92325f2c369bf (patch)
tree22c7e7de9b4331c7d122a7958086ecf24cc7fa7f /packages/cli/src/ui/components/AuthDialog.tsx
parent4059a3e8ee7275ede97e150b2f3d62a9e681564c (diff)
Initially hide some Auth options behind "More..." (#1245)
Diffstat (limited to 'packages/cli/src/ui/components/AuthDialog.tsx')
-rw-r--r--packages/cli/src/ui/components/AuthDialog.tsx23
1 files changed, 20 insertions, 3 deletions
diff --git a/packages/cli/src/ui/components/AuthDialog.tsx b/packages/cli/src/ui/components/AuthDialog.tsx
index b16529cf..856d4238 100644
--- a/packages/cli/src/ui/components/AuthDialog.tsx
+++ b/packages/cli/src/ui/components/AuthDialog.tsx
@@ -28,7 +28,7 @@ export function AuthDialog({
const [errorMessage, setErrorMessage] = useState<string | null>(
initialErrorMessage || null,
);
- const authItems = [
+ const allAuthItems = [
{
label: 'Login with Google Personal Account',
value: AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
@@ -41,7 +41,20 @@ export function AuthDialog({
{ label: 'Vertex AI', value: AuthType.USE_VERTEX_AI },
];
- let initialAuthIndex = authItems.findIndex(
+ const isSelectedAuthInMore = allAuthItems
+ .slice(2)
+ .some((item) => item.value === settings.merged.selectedAuthType);
+
+ const [showAll, setShowAll] = useState(isSelectedAuthInMore);
+
+ const initialAuthItems = [
+ ...allAuthItems.slice(0, 2),
+ { label: 'More...', value: 'more' },
+ ];
+
+ const items = showAll ? allAuthItems : initialAuthItems;
+
+ let initialAuthIndex = items.findIndex(
(item) => item.value === settings.merged.selectedAuthType,
);
@@ -50,6 +63,10 @@ export function AuthDialog({
}
const handleAuthSelect = (authMethod: string) => {
+ if (authMethod === 'more') {
+ setShowAll(true);
+ return;
+ }
const error = validateAuthMethod(authMethod);
if (error) {
setErrorMessage(error);
@@ -75,7 +92,7 @@ export function AuthDialog({
>
<Text bold>Select Auth Method</Text>
<RadioButtonSelect
- items={authItems}
+ items={items}
initialIndex={initialAuthIndex}
onSelect={handleAuthSelect}
onHighlight={onHighlight}