1
0
Fork 0
polaris-task-force/src/components/frontend/account/ToursPreference.tsx
Z8MB1E 9c3870cf79 fix(mobile): meet the 24px tap-target floor across the app
Session A measured 159 targets under the WCAG 2.5.8 minimum on 42 routes;
this brings that to zero. Mostly one-line spacing changes: small caption
labels and text links were 14-21px tall because shadcn Label/Button use
leading-none and bare text links carry no vertical padding.

- shared Dialog close button: p-1 with right-3/top-3 so the 24px hit box
  keeps the icon where it was
- tour card: Skip all tours (13 routes), All boards on standings cards (6)
- detail pages: 27 Back links, journals All journals, wiki category
  links, voiceover card titles, factions batch link
- dashboard: 7 View all / View full record links
- account preferences: mute rows min-h-6, radio and tours labels, plus
  contacts filter labels and the campaigns show-completed label
- ribbon studio: mirror label and stripe/module remove buttons
- helpdesk ticket titles, radio tick-sound label
2026-10-12 22:17:51 -04:00

43 lines
1.4 KiB
TypeScript

"use client";
import { useEffect, useState } from "react";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import { isToursOptedOut, setToursOptedOut } from "@/lib/tours/dismissals";
/**
* Per-browser guided-tours preference. Lives in localStorage (same store the
* tour dismissals use), not the user record: tours are a device concern, and
* the header replay control stays available either way.
*/
export function ToursPreference() {
const [optedOut, setOptedOut] = useState(false);
const [mounted, setMounted] = useState(false);
useEffect(() => {
setOptedOut(isToursOptedOut());
setMounted(true);
}, []);
return (
<div className="flex items-center justify-between gap-4">
<div className="flex flex-col gap-0.5">
<Label htmlFor="tours-autostart" className="py-0.5 text-sm">
Auto-start page tours
</Label>
<p className="text-xs text-muted-foreground">
Short guided walkthroughs the first time you visit a page. You can always replay the
current page&apos;s tour from the header help icon.
</p>
</div>
<Switch
id="tours-autostart"
checked={mounted ? !optedOut : true}
onCheckedChange={(checked) => {
setOptedOut(!checked);
setToursOptedOut(!checked);
}}
/>
</div>
);
}