"use client"; import { useFormState } from "react-dom"; import { Alert, Box, Button, Card, CardContent, Checkbox, FormControlLabel, Stack, TextField, Typography } from "@mui/material"; import type { GeneralSettings } from "@/src/lib/settings"; import { updateCloudflareSettingsAction, updateGeneralSettingsAction } from "./actions"; type Props = { general: GeneralSettings | null; cloudflare: { hasToken: boolean; zoneId?: string; accountId?: string; }; }; export default function SettingsClient({ general, cloudflare }: Props) { const [generalState, generalFormAction] = useFormState(updateGeneralSettingsAction, null); const [cloudflareState, cloudflareFormAction] = useFormState(updateCloudflareSettingsAction, null); return ( Settings Configure organization-wide defaults and DNS automation. General {generalState?.message && ( {generalState.message} )} Cloudflare DNS Configure a Cloudflare API token with Zone.DNS Edit permissions to enable DNS-01 challenges for wildcard certificates. {cloudflare.hasToken && ( A Cloudflare API token is already configured. Leave the token field blank to keep it, or select “Remove existing token” to delete it. )} {cloudflareState?.message && ( {cloudflareState.message} )} } label="Remove existing token" disabled={!cloudflare.hasToken} /> ); }