"use client"; import type { ReactNode } from "react"; import { useState } from "react"; import { Check, Copy } from "lucide-react"; import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; import { Switch } from "@/components/ui/switch"; export function SettingsSection({ title, description, action, children, }: { title: string; description?: string; action?: ReactNode; children: ReactNode; }) { return (

{title}

{description ? (

{description}

) : null}
{action ?
{action}
: null}
{children}
); } export function SettingsCard({ className, children, }: { className?: string; children: ReactNode; }) { return (
{children}
); } export function ToggleRow({ title, description, defaultChecked = false, checked, onCheckedChange, }: { title: string; description?: string; defaultChecked?: boolean; /** Pass `checked` + `onCheckedChange` to make the switch controlled. */ checked?: boolean; onCheckedChange?: (checked: boolean) => void; }) { return (

{title}

{description ? (

{description}

) : null}
); } export function CopyField({ label, description, value, }: { label: string; description?: string; value: string; }) { const { t } = useTranslation(); const [copied, setCopied] = useState(false); const copy = async () => { try { await navigator.clipboard.writeText(value); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { // Clipboard unavailable (insecure context) — silently ignore. } }; return (

{label}

{description ? (

{description}

) : null}
{value}
); } /** Light/white CTA used for primary actions on the dark settings surface. */ export const whiteButton = "bg-foreground text-background hover:bg-foreground/90"; /** Field label with an optional required asterisk. */ export function FieldLabel({ children, required, }: { children: ReactNode; required?: boolean; }) { return ( {children} {required ? * : null} ); }