mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -04:00
- 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>
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import { IconDoorEnter } 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 { toggleRegistration } from "@/lib/actions/settings";
|
|
|
|
export function RegistrationSection({
|
|
initialRegistrationOpen,
|
|
}: {
|
|
initialRegistrationOpen: boolean;
|
|
}) {
|
|
const [registrationOpen, setRegistrationOpen] = useState(
|
|
initialRegistrationOpen,
|
|
);
|
|
const [toggling, setToggling] = useState(false);
|
|
|
|
async function handleToggle(checked: boolean) {
|
|
const previous = registrationOpen;
|
|
setRegistrationOpen(checked);
|
|
setToggling(true);
|
|
try {
|
|
await toggleRegistration(checked);
|
|
toast.success(checked ? "Registration opened" : "Registration closed");
|
|
} catch {
|
|
setRegistrationOpen(previous);
|
|
toast.error("Failed to update registration 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">
|
|
<IconDoorEnter aria-hidden={true} className="size-4 text-primary" />
|
|
</div>
|
|
<div>
|
|
<CardTitle>Open registration</CardTitle>
|
|
<CardDescription>
|
|
Allow new users to create accounts
|
|
</CardDescription>
|
|
</div>
|
|
</div>
|
|
<Switch
|
|
checked={registrationOpen}
|
|
onCheckedChange={handleToggle}
|
|
disabled={toggling}
|
|
aria-label="Toggle open registration"
|
|
/>
|
|
</div>
|
|
</CardContent>
|
|
);
|
|
}
|