fix(settings): consolidate sign-in management and tidy the settings IA

Follow-ups on the v1.25.1 settings group consolidation.

- Sign-in security is no longer split across two top-level groups. Active
  sessions, trusted devices, and the login-activity feed move into Account
  > Security alongside the second-factor and passkey controls, so every
  "who can sign in as me" control sits in one place. The Data & Privacy
  pane keeps the data / retention / encryption story and cross-links to
  the security home. Sessions and activity are no longer duplicated on the
  Profile tab.
- First-child sub-tabs no longer repeat their group name: the section
  titles become "Profile & preferences", "Connections", and
  "Privacy & retention" across all six locales.
- Account deletion moves out of Advanced into the Account group as a
  standalone card; research mode and the data reset stay in Advanced.
- Disambiguate the Spanish labels for the health record vs medical
  history (they both read "Historial médico"); medical history becomes
  "Antecedentes médicos".
- The section heading carries its id on a single breakpoint instance to
  clear a duplicate-id-aria violation; the focus hook keeps targeting
  both instances and picks the visible one.
- The in-page sub-tab strip scrolls its active tab into view on a narrow
  viewport, matching the group strip.
- Redirect /settings/layout to the Display landing now that nothing links
  to the old personalisation hub.
- Note in code that delivery channels deliberately stay under
  Integrations (a channel is a delivery provider).
This commit is contained in:
Marc-André Bombeck committed 2026-06-29 00:34:24 +02:00
1 parent 4702546cdb
commit aa432244ce
18 files changed
+516 -253

No files matched your search

@@ -0,0 +1,70 @@
/**
* v1.25.1 (H1) — sign-in management consolidation.
*
* Active sessions, trusted devices, and the login-activity feed moved out of
* the Data & Privacy group into Account → Security so every "who can sign in as
* me" control sits in one place. This SSR test pins that the three cards render
* inside `<SecuritySection>`.
*/
import { describe, it, expect, vi } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
vi.mock("@/hooks/use-auth", () => ({
useAuth: () => ({ isAuthenticated: true, isLoading: false }),
}));
import { I18nProvider } from "@/lib/i18n/context";
import { queryKeys } from "@/lib/query-keys";
import { SecuritySection } from "../index";
function render() {
const client = new QueryClient({
defaultOptions: {
queries: {
retry: false,
staleTime: Number.POSITIVE_INFINITY,
refetchOnMount: false,
},
},
});
// Seed the MFA status so the second-factor cards paint instead of skeletons.
client.setQueryData(queryKeys.mfaStatus(), {
totp: { enabled: false },
recoveryCodesRemaining: 0,
webauthn: [],
passkeyNudgeDismissed: true,
});
client.setQueryData(queryKeys.passkeys(), []);
// Seed the embedded sign-in reads so the cards paint without firing network.
client.setQueryData(queryKeys.sessions(), { sessions: [] });
client.setQueryData(queryKeys.securityActivity(), { events: [] });
client.setQueryData(queryKeys.trustedDevices(), {
devices: [
{
id: "td-1",
label: "Firefox on macOS",
isCurrent: true,
createdAt: "2099-01-01T00:00:00.000Z",
lastUsedAt: "2099-01-01T00:00:00.000Z",
expiresAt: "2099-01-01T00:00:00.000Z",
},
],
});
return renderToStaticMarkup(
<I18nProvider initialLocale="en">
<QueryClientProvider client={client}>
<SecuritySection />
</QueryClientProvider>
</I18nProvider>,
);
}
describe("<SecuritySection> — sign-in management home (H1)", () => {
it("renders the active-session, trusted-device, and security-activity cards", () => {
const html = render();
expect(html).toContain('data-slot="settings-security-sessions-card"');
expect(html).toContain('data-slot="settings-trusted-devices-card"');
expect(html).toContain('data-slot="settings-security-activity-card"');
});
});
@@ -10,6 +10,14 @@ import { TotpCard } from "./totp-card";
import { SecurityKeysCard, type WebauthnKeyInfo } from "./security-keys-card";
import { PasskeyListSection } from "./passkey-list-section";
import { PasskeyUpgradeNudge } from "./passkey-upgrade-nudge";
// v1.25.1 (H1) — active sessions, trusted devices, and the login-activity feed
// are "who/what can sign in as me" — the same mental model as the second-factor
// and passkey controls above. They used to live in the Data & Privacy group
// (split across two top-level groups); they now sit here in Account → Security
// as the single sign-in-management home.
import { SecuritySessionsCard } from "@/components/settings/security-sessions-card";
import { TrustedDevicesCard } from "@/components/settings/trusted-devices-card";
import { SecurityActivityCard } from "@/components/settings/security-activity-card";
interface MfaStatus {
totp: { enabled: boolean };
@@ -45,28 +53,40 @@ export function SecuritySection() {
passkeys != null &&
passkeys.length === 0;
if (isLoading || !status) {
return (
<div className="space-y-4">
// The second-factor / passkey cards depend on the MFA status payload, so they
// skeleton while it loads. The session / device / activity cards own their own
// reads and loading states, so they render unconditionally below — a slow or
// failed `/api/auth/me/mfa` must never hide active-session revocation.
const mfaCards =
isLoading || !status ? (
<>
<Skeleton className="h-40 w-full rounded-xl" />
<Skeleton className="h-40 w-full rounded-xl" />
<Skeleton className="h-40 w-full rounded-xl" />
</div>
</>
) : (
<>
{showNudge && <PasskeyUpgradeNudge />}
<TotpCard
enabled={status.totp.enabled}
recoveryCodesRemaining={status.recoveryCodesRemaining}
/>
<SecurityKeysCard keys={status.webauthn} />
<PasskeyListSection isAuthenticated={isAuthenticated} />
</>
);
}
return (
<div className="space-y-6">
{showNudge && <PasskeyUpgradeNudge />}
{mfaCards}
<TotpCard
enabled={status.totp.enabled}
recoveryCodesRemaining={status.recoveryCodesRemaining}
/>
<SecurityKeysCard keys={status.webauthn} />
<PasskeyListSection isAuthenticated={isAuthenticated} />
{/* v1.25.1 (H1) — sign-in management consolidated here. */}
<SecuritySessionsCard isAuthenticated={isAuthenticated} />
<TrustedDevicesCard isAuthenticated={isAuthenticated} />
<SecurityActivityCard isAuthenticated={isAuthenticated} />
</div>
);
}