From 5029b30b2b597627bffd6473e970b5ebdf5c293b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 11 Nov 2026 21:27:54 +0100 Subject: [PATCH] fix(i18n): drop the translation notice from the sign-in pages Eight of ten languages opened the sign-in, registration and profile take-over pages with the "machine translated" strip above the form, the first thing a visitor read before having an account. The strip stays in the app shell, where the language can be changed and a correction reported; its text is unchanged. --- ...-shell-translation-banner.browser.test.tsx | 70 +++++++++++++++++++ src/components/layout/auth-shell.tsx | 1 - 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/components/layout/__tests__/auth-shell-translation-banner.browser.test.tsx diff --git a/src/components/layout/__tests__/auth-shell-translation-banner.browser.test.tsx b/src/components/layout/__tests__/auth-shell-translation-banner.browser.test.tsx new file mode 100644 index 000000000..7e5a4bea4 --- /dev/null +++ b/src/components/layout/__tests__/auth-shell-translation-banner.browser.test.tsx @@ -0,0 +1,70 @@ +/** + * The "machine translated" strip is not part of signing in. + * + * It belongs to the app, where the language can be changed and a correction + * reported; on the sign-in, registration and take-over pages it was the first + * thing a visitor in eight of ten languages read, above the form. + */ +import { describe, expect, it, vi } from "vitest"; + +import { renderWithApp } from "../../../../tests/browser/render"; +import { stubFetch } from "../../../../tests/browser/fetch-stub"; + +// Chrome that is not the subject. +vi.mock("../sidebar-nav", () => ({ SidebarNav: () => null })); +vi.mock("../bottom-nav", () => ({ BottomNav: () => null })); +vi.mock("../top-bar", () => ({ TopBar: () => null })); +vi.mock("../offline-banner", () => ({ OfflineBanner: () => null })); +vi.mock("../shared-record-banner", () => ({ SharedRecordBanner: () => null })); +vi.mock("@/components/gamification/achievement-unlock-notifier", () => ({ + AchievementUnlockNotifier: () => null, +})); +vi.mock("@/components/insights/layout-coach-fab", () => ({ + LayoutCoachFab: () => null, +})); +vi.mock("@/components/insights/layout-coach-mount", () => ({ + LayoutCoachMount: () => null, +})); +vi.mock("@/components/onboarding/tour-launcher", () => ({ + TourLauncher: () => null, +})); +vi.mock("@/components/day/day-layer", () => ({ DayLayerMount: () => null })); +vi.mock("@/components/command-palette/command-palette.lazy", () => ({ + CommandPaletteMount: () => null, +})); +vi.mock("../global-shortcuts", () => ({ GlobalShortcuts: () => null })); + +import { AuthShell } from "../auth-shell"; + +const BANNER = '[data-slot="maintainership-banner"]'; + +async function mountAt(path: string, user: { id: string } | null) { + window.history.replaceState(null, "", path); + await renderWithApp( + +
+ , + { user, locale: "fr" }, + ); + await expect + .poll(() => document.querySelector('[data-slot="page"]')) + .toBeTruthy(); +} + +describe("translation notice", () => { + it("is not shown on the sign-in page", async () => { + stubFetch().on("GET", "/api/auth/me", { + status: 401, + error: "Unauthorized", + }); + await mountAt("/auth/login", null); + await new Promise((resolve) => setTimeout(resolve, 100)); + expect(document.querySelector(BANNER)).toBeNull(); + }); + + it("is still shown inside the app", async () => { + stubFetch(); + await mountAt("/", { id: "signed-in" }); + await expect.poll(() => document.querySelector(BANNER)).toBeTruthy(); + }); +}); diff --git a/src/components/layout/auth-shell.tsx b/src/components/layout/auth-shell.tsx index 35a73b3dc..a53ea8b43 100644 --- a/src/components/layout/auth-shell.tsx +++ b/src/components/layout/auth-shell.tsx @@ -342,7 +342,6 @@ export function AuthShell({ return (
{demoMode ? : null} -