fix(ui): route the hand-built segment rows through Segmented

The narrative period, the lab result type, both admin filters, the chart
range tabs, the mood chart's own copy of them, the sleep-stage window and
the re-authentication method each spelled a segmented control by hand,
with their own sizes and fills. They render Segmented now; the range tabs
keep their long names as a hover title, and the admin filters gain an
accessible group name in every language. A test refuses a new button row
whose aria-pressed compares a state to each button's value, and names
the rows that remain with why they are not one choice on one track.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 16:43:59 +02:00
1 parent 160da978e6
commit 7ed953a029
21 files changed
+205 -211

No files matched your search

+12 -20
View File
@@ -16,6 +16,7 @@ import {
XCircle,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Segmented } from "@/components/ui/segmented";
import { EmptyState } from "@/components/ui/empty-state";
import { Input } from "@/components/ui/input";
import {
@@ -231,26 +232,17 @@ export function LoginOverviewSection() {
<div className="space-y-3">
{/* Quick-filter pills. Failed-only is the most common
admin "is something wrong" question — keep the one-tap shortcut. */}
<div className="flex gap-1">
<Button
variant={filter === "all" ? "default" : "ghost"}
aria-pressed={filter === "all"}
size="sm"
className="min-h-11 min-w-11 px-3 text-xs"
onClick={resetPageOnFilterChange(() => setFilter("all"))}
>
{t("admin.allAuthEvents")}
</Button>
<Button
variant={filter === "failed" ? "default" : "ghost"}
aria-pressed={filter === "failed"}
size="sm"
className="min-h-11 min-w-11 px-3 text-xs"
onClick={resetPageOnFilterChange(() => setFilter("failed"))}
>
{t("admin.failedOnly")}
</Button>
</div>
<Segmented
mode="toggle"
label={t("admin.loginOverviewFilterLabel")}
slot="admin-login-filter"
value={filter}
onChange={resetPageOnFilterChange(setFilter)}
options={[
{ value: "all", label: t("admin.allAuthEvents") },
{ value: "failed", label: t("admin.failedOnly") },
]}
/>
{/* Detailed filter row */}
<div className="grid gap-2 md:grid-cols-2 lg:grid-cols-[minmax(0,1.5fr)_repeat(3,minmax(0,1fr))]">
@@ -16,6 +16,7 @@ import { showErrorToast } from "@/lib/errors/error-toast";
import { Badge } from "@/components/ui/badge";
import { SettingsCardActions } from "@/components/settings/_card-actions";
import { Button } from "@/components/ui/button";
import { Segmented } from "@/components/ui/segmented";
import { EmptyState } from "@/components/ui/empty-state";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -312,20 +313,17 @@ export function UserManagementSection() {
className="flex flex-wrap items-center gap-1.5"
data-slot="admin-users-filter"
>
{(["all", "admin", "user"] as const).map((value) => (
<Button
key={value}
// Neutral pills: the selected filter is a state, not a call to
// action, so it never takes the primary fill.
variant={filter === value ? "secondary" : "outline"}
size="sm"
className="min-h-11 min-w-11 px-3 text-xs sm:min-h-9"
onClick={() => setFilter(value)}
aria-pressed={filter === value}
>
{t(`admin.section.users.filter.${value}`)}
</Button>
))}
<Segmented
mode="toggle"
label={t("admin.section.users.filterLabel")}
slot="admin-users-filter-choice"
value={filter}
onChange={setFilter}
options={(["all", "admin", "user"] as const).map((value) => ({
value,
label: t(`admin.section.users.filter.${value}`),
}))}
/>
</div>
{filteredUsers ? (