🙌 OpenHands: AI-Driven Development
refactor(frontend): Display TOS and Privacy policy links on Sign In page (#9697)
Hiep Le35b945b9d136
diff --git a/frontend/__tests__/components/features/auth-modal.test.tsx b/frontend/__tests__/components/features/auth-modal.test.tsxindex 15f2e52655..875bb1c852 100644--- a/frontend/__tests__/components/features/auth-modal.test.tsx+++ b/frontend/__tests__/components/features/auth-modal.test.tsx@@ -44,4 +44,64 @@ describe("AuthModal", () => {expect(window.location.href).toBe(mockUrl);});++ it("should render Terms of Service and Privacy Policy text with correct links", () => {+ render(<AuthModal githubAuthUrl="mock-url" appMode="saas" />);++ // Find the terms of service section using data-testid+ const termsSection = screen.getByTestId("auth-modal-terms-of-service");+ expect(termsSection).toBeInTheDocument();+++ // Check that all text content is present in the paragraph+ expect(termsSection).toHaveTextContent(+ "AUTH$BY_SIGNING_UP_YOU_AGREE_TO_OUR",+ );+ expect(termsSection).toHaveTextContent("COMMON$TERMS_OF_SERVICE");+ expect(termsSection).toHaveTextContent("COMMON$AND");+ expect(termsSection).toHaveTextContent("COMMON$PRIVACY_POLICY");++ // Check Terms of Service link+ const tosLink = screen.getByRole("link", {+ name: "COMMON$TERMS_OF_SERVICE",+ });+ expect(tosLink).toBeInTheDocument();+ expect(tosLink).toHaveAttribute("href", "https://www.all-hands.dev/tos");+ expect(tosLink).toHaveAttribute("target", "_blank");+ expect(tosLink).toHaveClass("underline", "hover:text-primary");++ // Check Privacy Policy link+ const privacyLink = screen.getByRole("link", {+ name: "COMMON$PRIVACY_POLICY",+ });+ expect(privacyLink).toBeInTheDocument();+ expect(privacyLink).toHaveAttribute(+ "href",+ "https://www.all-hands.dev/privacy",+ );+ expect(privacyLink).toHaveAttribute("target", "_blank");+ expect(privacyLink).toHaveClass("underline", "hover:text-primary");++ // Verify that both links are within the terms section+ expect(termsSection).toContainElement(tosLink);+ expect(termsSection).toContainElement(privacyLink);+ });++ it("should open Terms of Service link in new tab", () => {+ render(<AuthModal githubAuthUrl="mock-url" appMode="saas" />);++ const tosLink = screen.getByRole("link", {+ name: "COMMON$TERMS_OF_SERVICE",+ });+ expect(tosLink).toHaveAttribute("target", "_blank");+ });++ it("should open Privacy Policy link in new tab", () => {+ render(<AuthModal githubAuthUrl="mock-url" appMode="saas" />);++ const privacyLink = screen.getByRole("link", {+ name: "COMMON$PRIVACY_POLICY",+ });+ expect(privacyLink).toHaveAttribute("target", "_blank");+ });});diff --git a/frontend/src/components/features/waitlist/auth-modal.tsx b/frontend/src/components/features/waitlist/auth-modal.tsxindex 2bba95560b..c2befbe4c3 100644--- a/frontend/src/components/features/waitlist/auth-modal.tsx+++ b/frontend/src/components/features/waitlist/auth-modal.tsx@@ -91,6 +91,31 @@ export function AuthModal({ githubAuthUrl, appMode }: AuthModalProps) {{t(I18nKey.BITBUCKET$CONNECT_TO_BITBUCKET)}</BrandButton></div>++ <p+ className="mt-4 text-xs text-center text-muted-foreground"+ data-testid="auth-modal-terms-of-service"+ >+ {t(I18nKey.AUTH$BY_SIGNING_UP_YOU_AGREE_TO_OUR)}{" "}+ <a+ href="https://www.all-hands.dev/tos"+ target="_blank"+ className="underline hover:text-primary"+ rel="noopener noreferrer"+ >+ {t(I18nKey.COMMON$TERMS_OF_SERVICE)}+ </a>{" "}+ {t(I18nKey.COMMON$AND)}{" "}+ <a+ href="https://www.all-hands.dev/privacy"+ target="_blank"+ className="underline hover:text-primary"+ rel="noopener noreferrer"+ >+ {t(I18nKey.COMMON$PRIVACY_POLICY)}+ </a>+ .+ </p></ModalBody></ModalBackdrop>);diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.tsindex 9cfdd504ed..99bdd5b914 100644--- a/frontend/src/i18n/declaration.ts+++ b/frontend/src/i18n/declaration.ts@@ -683,4 +683,8 @@ export enum I18nKey {COMMON$OPTIONAL = "COMMON$OPTIONAL",BROWSER$SERVER_MESSAGE = "BROWSER$SERVER_MESSAGE",API$NO_KEY_AVAILABLE = "API$NO_KEY_AVAILABLE",+ AUTH$BY_SIGNING_UP_YOU_AGREE_TO_OUR = "AUTH$BY_SIGNING_UP_YOU_AGREE_TO_OUR",+ COMMON$TERMS_OF_SERVICE = "COMMON$TERMS_OF_SERVICE",+ COMMON$AND = "COMMON$AND",+ COMMON$PRIVACY_POLICY = "COMMON$PRIVACY_POLICY",}diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.jsonindex d32c781973..7b1abdcdc9 100644--- a/frontend/src/i18n/translation.json+++ b/frontend/src/i18n/translation.json@@ -10926,5 +10926,69 @@"tr": "Kullanılabilir API anahtarı yok","de": "Kein API-Schlüssel verfügbar","uk": "Немає доступного API-ключа"+ },+ "AUTH$BY_SIGNING_UP_YOU_AGREE_TO_OUR": {+ "en": "By signing up, you agree to our",+ "ja": "サインアップすることで、あなたは当社の",+ "zh-CN": "注册即表示您同意我们的",+ "zh-TW": "註冊即表示您同意我們的",+ "ko-KR": "가입하면 당사의",+ "no": "Ved å registrere deg godtar du våre",+ "it": "Registrandoti, accetti i nostri",+ "pt": "Ao se inscrever, você concorda com nossos",+ "es": "Al registrarte, aceptas nuestros",+ "ar": "من خلال التسجيل، فإنك توافق على",+ "fr": "En vous inscrivant, vous acceptez nos",+ "tr": "Kaydolarak, hizmet şartlarımızı kabul etmiş olursunuz",+ "de": "Mit der Anmeldung stimmen Sie unseren",+ "uk": "Реєструючись, ви погоджуєтеся з нашими"+ },+ "COMMON$TERMS_OF_SERVICE": {+ "en": "Terms of Service",+ "ja": "利用規約",+ "zh-CN": "服务条款",+ "zh-TW": "服務條款",+ "ko-KR": "서비스 약관",+ "no": "Vilkår for bruk",+ "it": "Termini di servizio",+ "pt": "Termos de Serviço",+ "es": "Términos de servicio",+ "ar": "شروط الخدمة",+ "fr": "Conditions d'utilisation",+ "tr": "Hizmet Şartları",+ "de": "Nutzungsbedingungen",+ "uk": "Умови надання послуг"+ },+ "COMMON$AND": {+ "en": "and",+ "ja": "と",+ "zh-CN": "和",+ "zh-TW": "和",+ "ko-KR": "및",+ "no": "og",+ "it": "e",+ "pt": "e",+ "es": "y",+ "ar": "و",+ "fr": "et",+ "tr": "ve",+ "de": "und",+ "uk": "та"+ },+ "COMMON$PRIVACY_POLICY": {+ "en": "Privacy Policy",+ "ja": "プライバシーポリシー",+ "zh-CN": "隐私政策",+ "zh-TW": "隱私政策",+ "ko-KR": "개인정보 처리방침",+ "no": "Personvernerklæring",+ "it": "Informativa sulla privacy",+ "pt": "Política de Privacidade",+ "es": "Política de privacidad",+ "ar": "سياسة الخصوصية",+ "fr": "Politique de confidentialité",+ "tr": "Gizlilik Politikası",+ "de": "Datenschutzrichtlinie",+ "uk": "Політика конфіденційності"}}