Files
sofa/app/(pages)/settings/_components/update-check-section.tsx
T
jakeandClaude Opus 4.6 fc982bee1b Comprehensive Web Interface Guidelines audit: accessibility, motion, and typography
- Add global MotionConfig reducedMotion="user" in root layout
- Add color-scheme: dark, theme-color meta, skip-to-main-content link
- Add aria-hidden={true} to ~60+ decorative icons across 33 files
- Add aria-label to all icon-only buttons (logout, star rating, play, delete, etc.)
- Replace transition-all with specific properties (11 files)
- Add motion-safe: prefix for CSS hover transforms and animate-pulse
- Add prefers-reduced-motion: reduce override in globals.css
- Add useReducedMotion guard to status-dot pulsing animation
- Fix focus-visible styles on auth form inputs (focus → focus-visible, stronger ring)
- Add text-balance to all headings (13 files)
- Replace "..." with "…" (U+2026) in all loading/placeholder text
- Add autocomplete, spellCheck, role="alert" to auth form
- Add aria-label to Switch controls and filmography select
- Fix heading hierarchy (h3 → h2 where h2 was skipped)
- Add break-words to title overview, overscroll-contain to drawer
- Add confirmation dialog for destructive library removal
- Add group-focus-within:opacity-100 for keyboard-accessible backup actions
- Add role="radio" + aria-checked to star rating buttons
- Add aria-label to carousel region, role="img" to TMDB logo SVG
- Add text-foreground to native select for dark mode consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 18:20:25 -05:00

62 lines
1.7 KiB
TypeScript

"use client";
import { IconWorldUpload } from "@tabler/icons-react";
import { useState } from "react";
import { toast } from "sonner";
import { CardContent, CardDescription, CardTitle } from "@/components/ui/card";
import { Switch } from "@/components/ui/switch";
import { toggleUpdateCheck } from "@/lib/actions/settings";
export function UpdateCheckSection({
initialEnabled,
}: {
initialEnabled: boolean;
}) {
const [enabled, setEnabled] = useState(initialEnabled);
const [toggling, setToggling] = useState(false);
async function handleToggle(checked: boolean) {
const previous = enabled;
setEnabled(checked);
setToggling(true);
try {
await toggleUpdateCheck(checked);
toast.success(
checked ? "Update checks enabled" : "Update checks disabled",
);
} catch {
setEnabled(previous);
toast.error("Failed to update setting");
} finally {
setToggling(false);
}
}
return (
<CardContent>
<div className="flex items-center justify-between gap-4">
<div className="flex items-start gap-3">
<div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10">
<IconWorldUpload
aria-hidden={true}
className="size-4 text-primary"
/>
</div>
<div>
<CardTitle>Automatic update checks</CardTitle>
<CardDescription>
Periodically check GitHub for new Sofa releases
</CardDescription>
</div>
</div>
<Switch
checked={enabled}
onCheckedChange={handleToggle}
disabled={toggling}
aria-label="Toggle automatic update checks"
/>
</div>
</CardContent>
);
}