π OpenHands: AI-Driven Development
chore(frontend): Remove waitlist variant of auth modal (#7150)
sp.wack0a6321246add
diff --git a/frontend/__tests__/components/features/waitlist-modal.test.tsx b/frontend/__tests__/components/features/auth-modal.test.tsxsimilarity index 81%rename from frontend/__tests__/components/features/waitlist-modal.test.tsxrename to frontend/__tests__/components/features/auth-modal.test.tsxindex f97a3a0c57..197dcf8fab 100644--- a/frontend/__tests__/components/features/waitlist-modal.test.tsx+++ b/frontend/__tests__/components/features/auth-modal.test.tsx@@ -1,10 +1,10 @@import { render, screen } from "@testing-library/react";import { it, describe, expect, vi, beforeAll, afterAll } from "vitest";import userEvent from "@testing-library/user-event";-import { WaitlistModal } from "#/components/features/waitlist/waitlist-modal";+import { AuthModal } from "#/components/features/waitlist/auth-modal";import * as CaptureConsent from "#/utils/handle-capture-consent";-describe("WaitlistModal", () => {+describe("AuthModal", () => {beforeAll(() => {vi.stubGlobal("location", { href: "" });});@@ -14,7 +14,7 @@ describe("WaitlistModal", () => {});it("should render a tos checkbox that is unchecked by default", () => {- render(<WaitlistModal ghTokenIsSet={false} githubAuthUrl={null} />);+ render(<AuthModal githubAuthUrl={null} />);const checkbox = screen.getByRole("checkbox");expect(checkbox).not.toBeChecked();@@ -22,7 +22,7 @@ describe("WaitlistModal", () => {it("should only enable the GitHub button if the tos checkbox is checked", async () => {const user = userEvent.setup();- render(<WaitlistModal ghTokenIsSet={false} githubAuthUrl={null} />);+ render(<AuthModal githubAuthUrl={null} />);const checkbox = screen.getByRole("checkbox");const button = screen.getByRole("button", { name: "GITHUB$CONNECT_TO_GITHUB" });@@ -40,7 +40,7 @@ describe("WaitlistModal", () => {);const user = userEvent.setup();- render(<WaitlistModal ghTokenIsSet={false} githubAuthUrl="mock-url" />);+ render(<AuthModal githubAuthUrl="mock-url" />);const checkbox = screen.getByRole("checkbox");await user.click(checkbox);diff --git a/frontend/src/components/features/waitlist/waitlist-modal.tsx b/frontend/src/components/features/waitlist/auth-modal.tsxsimilarity index 59%rename from frontend/src/components/features/waitlist/waitlist-modal.tsxrename to frontend/src/components/features/waitlist/auth-modal.tsxindex 380ca206ae..dc84693fde 100644--- a/frontend/src/components/features/waitlist/waitlist-modal.tsx+++ b/frontend/src/components/features/waitlist/auth-modal.tsx@@ -2,8 +2,6 @@ import React from "react";import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";import AllHandsLogo from "#/assets/branding/all-hands-logo.svg?react";-import { JoinWaitlistAnchor } from "./join-waitlist-anchor";-import { WaitlistMessage } from "./waitlist-message";import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";import { ModalBody } from "#/components/shared/modals/modal-body";import { TOSCheckbox } from "./tos-checkbox";@@ -11,15 +9,11 @@ import { handleCaptureConsent } from "#/utils/handle-capture-consent";import { BrandButton } from "../settings/brand-button";import GitHubLogo from "#/assets/branding/github-logo.svg?react";-interface WaitlistModalProps {- ghTokenIsSet: boolean;+interface AuthModalProps {githubAuthUrl: string | null;}-export function WaitlistModal({- ghTokenIsSet,- githubAuthUrl,-}: WaitlistModalProps) {+export function AuthModal({ githubAuthUrl }: AuthModalProps) {const { t } = useTranslation();const [isTosAccepted, setIsTosAccepted] = React.useState(false);@@ -34,23 +28,24 @@ export function WaitlistModal({<ModalBackdrop><ModalBody className="border border-tertiary"><AllHandsLogo width={68} height={46} />- <WaitlistMessage content={ghTokenIsSet ? "waitlist" : "sign-in"} />+ <div className="flex flex-col gap-2 w-full items-center text-center">+ <h1 className="text-2xl font-bold">+ {t(I18nKey.AUTH$SIGN_IN_WITH_GITHUB)}+ </h1>+ </div><TOSCheckbox onChange={() => setIsTosAccepted((prev) => !prev)} />- {!ghTokenIsSet && (- <BrandButton- isDisabled={!isTosAccepted}- type="button"- variant="primary"- onClick={handleGitHubAuth}- className="w-full"- startContent={<GitHubLogo width={20} height={20} />}- >- {t(I18nKey.GITHUB$CONNECT_TO_GITHUB)}- </BrandButton>- )}- {ghTokenIsSet && <JoinWaitlistAnchor />}+ <BrandButton+ isDisabled={!isTosAccepted}+ type="button"+ variant="primary"+ onClick={handleGitHubAuth}+ className="w-full"+ startContent={<GitHubLogo width={20} height={20} />}+ >+ {t(I18nKey.GITHUB$CONNECT_TO_GITHUB)}+ </BrandButton></ModalBody></ModalBackdrop>);diff --git a/frontend/src/components/features/waitlist/join-waitlist-anchor.tsx b/frontend/src/components/features/waitlist/join-waitlist-anchor.tsxdeleted file mode 100644index de0abf559a..0000000000--- a/frontend/src/components/features/waitlist/join-waitlist-anchor.tsx+++ /dev/null@@ -1,17 +0,0 @@-import { useTranslation } from "react-i18next";-import { I18nKey } from "#/i18n/declaration";--export function JoinWaitlistAnchor() {- const { t } = useTranslation();-- return (- <a- href="https://www.all-hands.dev/join-waitlist"- target="_blank"- rel="noreferrer"- className="rounded bg-[#FFE165] text-black text-sm font-bold py-[10px] w-full text-center hover:opacity-80"- >- {t(I18nKey.WAITLIST$JOIN_WAITLIST)}- </a>- );-}diff --git a/frontend/src/components/features/waitlist/waitlist-message.tsx b/frontend/src/components/features/waitlist/waitlist-message.tsxdeleted file mode 100644index bbfbc9f0fc..0000000000--- a/frontend/src/components/features/waitlist/waitlist-message.tsx+++ /dev/null@@ -1,36 +0,0 @@-import { useTranslation } from "react-i18next";-import { I18nKey } from "#/i18n/declaration";--interface WaitlistMessageProps {- content: "waitlist" | "sign-in";-}--export function WaitlistMessage({ content }: WaitlistMessageProps) {- const { t } = useTranslation();-- return (- <div className="flex flex-col gap-2 w-full items-center text-center">- <h1 className="text-2xl font-bold">- {content === "sign-in" && t(I18nKey.AUTH$SIGN_IN_WITH_GITHUB)}- {content === "waitlist" && t(I18nKey.WAITLIST$ALMOST_THERE)}- </h1>- {content === "sign-in" && (- <p>- {t(I18nKey.LANDING$OR)}{" "}- <a- href="https://www.all-hands.dev/join-waitlist"- target="_blank"- rel="noreferrer noopener"- className="text-blue-500 hover:underline underline-offset-2"- >- {t(I18nKey.WAITLIST$JOIN)}- </a>{" "}- {t(I18nKey.WAITLIST$IF_NOT_JOINED)}- </p>- )}- {content === "waitlist" && (- <p className="text-sm">{t(I18nKey.WAITLIST$PATIENCE_MESSAGE)}</p>- )}- </div>- );-}diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.tsindex 030eac4cc4..dbffe78f02 100644--- a/frontend/src/i18n/declaration.ts+++ b/frontend/src/i18n/declaration.ts@@ -301,6 +301,7 @@ export enum I18nKey {STATUS$ERROR_LLM_SERVICE_UNAVAILABLE = "STATUS$ERROR_LLM_SERVICE_UNAVAILABLE",STATUS$ERROR_LLM_INTERNAL_SERVER_ERROR = "STATUS$ERROR_LLM_INTERNAL_SERVER_ERROR",STATUS$ERROR_LLM_OUT_OF_CREDITS = "STATUS$ERROR_LLM_OUT_OF_CREDITS",+ STATUS$ERROR_LLM_CONTENT_POLICY_VIOLATION = "STATUS$ERROR_LLM_CONTENT_POLICY_VIOLATION",STATUS$ERROR_RUNTIME_DISCONNECTED = "STATUS$ERROR_RUNTIME_DISCONNECTED",STATUS$LLM_RETRY = "STATUS$LLM_RETRY",AGENT_ERROR$BAD_ACTION = "AGENT_ERROR$BAD_ACTION",diff --git a/frontend/src/routes/root-layout.tsx b/frontend/src/routes/root-layout.tsxindex 064c0eaf23..c7db0d160a 100644--- a/frontend/src/routes/root-layout.tsx+++ b/frontend/src/routes/root-layout.tsx@@ -14,10 +14,9 @@ import { useGitHubAuthUrl } from "#/hooks/use-github-auth-url";import { useIsAuthed } from "#/hooks/query/use-is-authed";import { useConfig } from "#/hooks/query/use-config";import { Sidebar } from "#/components/features/sidebar/sidebar";-import { WaitlistModal } from "#/components/features/waitlist/waitlist-modal";+import { AuthModal } from "#/components/features/waitlist/auth-modal";import { AnalyticsConsentFormModal } from "#/components/features/analytics/analytics-consent-form-modal";import { useSettings } from "#/hooks/query/use-settings";-import { useAuth } from "#/context/auth-context";import { useMigrateUserConsent } from "#/hooks/use-migrate-user-consent";import { useBalance } from "#/hooks/query/use-balance";import { SetupPaymentModal } from "#/components/features/payment/setup-payment-modal";@@ -60,7 +59,6 @@ export default function MainApp() {const navigate = useNavigate();const { pathname } = useLocation();const [searchParams] = useSearchParams();- const { providersAreSet } = useAuth();const { data: settings } = useSettings();const { error, isFetching } = useBalance();const { migrateUserConsent } = useMigrateUserConsent();@@ -114,7 +112,7 @@ export default function MainApp() {}, [error?.status, pathname, isFetching]);const userIsAuthed = !!isAuthed && !authError;- const renderWaitlistModal =+ const renderAuthModal =!isFetchingAuth && !userIsAuthed && config.data?.APP_MODE === "saas";return (@@ -131,13 +129,7 @@ export default function MainApp() {<Outlet /></div>- {renderWaitlistModal && (- <WaitlistModal- ghTokenIsSet={providersAreSet}- githubAuthUrl={gitHubAuthUrl}- />- )}-+ {renderAuthModal && <AuthModal githubAuthUrl={gitHubAuthUrl} />}{config.data?.APP_MODE === "oss" && consentFormIsOpen && (<AnalyticsConsentFormModalonClose={() => {