diff --git a/frontend/src/api/open-hands.types.ts b/frontend/src/api/open-hands.types.ts index 6074c5ef69..78a24159dd 100644 --- a/frontend/src/api/open-hands.types.ts +++ b/frontend/src/api/open-hands.types.ts @@ -50,6 +50,7 @@ export interface GetConfigResponse { GITHUB_CLIENT_ID: string; POSTHOG_CLIENT_KEY: string; STRIPE_PUBLISHABLE_KEY?: string; + PROVIDERS_CONFIGURED?: Provider[]; FEATURE_FLAGS: { ENABLE_BILLING: boolean; HIDE_LLM_SETTINGS: boolean; diff --git a/frontend/src/components/features/waitlist/auth-modal.tsx b/frontend/src/components/features/waitlist/auth-modal.tsx index c2befbe4c3..a78d6347a8 100644 --- a/frontend/src/components/features/waitlist/auth-modal.tsx +++ b/frontend/src/components/features/waitlist/auth-modal.tsx @@ -10,13 +10,19 @@ import GitLabLogo from "#/assets/branding/gitlab-logo.svg?react"; import BitbucketLogo from "#/assets/branding/bitbucket-logo.svg?react"; import { useAuthUrl } from "#/hooks/use-auth-url"; import { GetConfigResponse } from "#/api/open-hands.types"; +import { Provider } from "#/types/settings"; interface AuthModalProps { githubAuthUrl: string | null; appMode?: GetConfigResponse["APP_MODE"] | null; + providersConfigured?: Provider[]; } -export function AuthModal({ githubAuthUrl, appMode }: AuthModalProps) { +export function AuthModal({ + githubAuthUrl, + appMode, + providersConfigured, +}: AuthModalProps) { const { t } = useTranslation(); const gitlabAuthUrl = useAuthUrl({ @@ -50,6 +56,24 @@ export function AuthModal({ githubAuthUrl, appMode }: AuthModalProps) { } }; + // Only show buttons if providers are configured and include the specific provider + const showGithub = + providersConfigured && + providersConfigured.length > 0 && + providersConfigured.includes("github"); + const showGitlab = + providersConfigured && + providersConfigured.length > 0 && + providersConfigured.includes("gitlab"); + const showBitbucket = + providersConfigured && + providersConfigured.length > 0 && + providersConfigured.includes("bitbucket"); + + // Check if no providers are configured + const noProvidersConfigured = + !providersConfigured || providersConfigured.length === 0; + return ( @@ -61,35 +85,49 @@ export function AuthModal({ githubAuthUrl, appMode }: AuthModalProps) {
- } - > - {t(I18nKey.GITHUB$CONNECT_TO_GITHUB)} - + {noProvidersConfigured ? ( +
+ {t(I18nKey.AUTH$NO_PROVIDERS_CONFIGURED)} +
+ ) : ( + <> + {showGithub && ( + } + > + {t(I18nKey.GITHUB$CONNECT_TO_GITHUB)} + + )} - } - > - {t(I18nKey.GITLAB$CONNECT_TO_GITLAB)} - + {showGitlab && ( + } + > + {t(I18nKey.GITLAB$CONNECT_TO_GITLAB)} + + )} - } - > - {t(I18nKey.BITBUCKET$CONNECT_TO_BITBUCKET)} - + {showBitbucket && ( + } + > + {t(I18nKey.BITBUCKET$CONNECT_TO_BITBUCKET)} + + )} + + )}

)} {renderReAuthModal && }