"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 (
Automatic update checks Periodically check GitHub for new Sofa releases
); }