From cab0e50fff8c1a0cefb380aa0dc1fbcd5e79f6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 28 Jun 2026 20:29:15 +0200 Subject: [PATCH] Collapse the active-sessions and security-activity lists by default Both account-security lists now render behind a disclosure control and open only on click. The trigger carries aria-expanded and aria-controls and is keyboard-operable; the region is gated with hidden. State is UI-only and not persisted. --- .../settings/security-activity-card.tsx | 41 ++++++++++++++---- .../settings/security-sessions-card.tsx | 43 +++++++++++++++---- 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/src/components/settings/security-activity-card.tsx b/src/components/settings/security-activity-card.tsx index 7f7426984..bc3450dbb 100644 --- a/src/components/settings/security-activity-card.tsx +++ b/src/components/settings/security-activity-card.tsx @@ -8,14 +8,15 @@ * shared `GET /api/auth/me/security-activity` endpoint. Each row shows a * readable action label, the resolved location, the masked IP, and the time. */ +import { useId, useState } from "react"; import { useQuery } from "@tanstack/react-query"; -import { Loader2, ShieldCheck } from "lucide-react"; +import { ChevronDown, Loader2, ShieldCheck } from "lucide-react"; import { SettingsCard } from "@/components/settings/settings-card"; -import { SettingsCardHeader } from "@/components/settings/_card-header"; import { useTranslations } from "@/lib/i18n/context"; import { queryKeys } from "@/lib/query-keys"; import { apiGet } from "@/lib/api/api-fetch"; +import { cn } from "@/lib/utils"; interface ActivityRow { action: string; @@ -53,6 +54,10 @@ export function SecurityActivityCard({ isAuthenticated: boolean; }) { const { t } = useTranslations(); + // Collapsed by default — the feed opens only on demand, keeping the security + // surface skimmable. UI-only state; nothing is persisted across reloads. + const [open, setOpen] = useState(false); + const regionId = useId(); const { data, isLoading, isError } = useQuery({ queryKey: queryKeys.securityActivity(), @@ -65,12 +70,32 @@ export function SecurityActivityCard({ return ( - -
+ +