/** * Registration Form Editor Main Settings Page */ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { UserPlus, Settings, Loader2, AlertCircle, FormInput, Mail, } from "lucide-react" import { toast } from "sonner" import { useRegistrationForm } from "../hooks/use-registration-form" import { EditorTab } from "./tabs/editor-tab" import { SettingsTab } from "./tabs/settings-tab" import { EmailsTab } from "./tabs/emails-tab" import { RegistrationFormUpgradeTab } from "./tabs/upgrade-tab" import { FeatureHeader } from "@/components/feature-header" import { Crown } from "lucide-react" import { usePro } from "@/contexts/pro-context" export function RegistrationFormSettings() { const { isPro } = usePro() const { settings, fields, isLoading, isSaving, error, hasChanges, updateSettings, addField, updateField, deleteField, duplicateField, toggleFieldEnabled, reorderFields, saveSettings, resetToDefaults, } = useRegistrationForm() if (isLoading) { return (
Loading registration form editor...
) } const handleSave = async () => { const success = await saveSettings() if (success) { toast.success("Settings saved", { description: "Your registration form settings have been saved successfully." }) } else { toast.error("Failed to save settings", { description: "Please try again or check your connection." }) } } const handleReset = async () => { const success = await resetToDefaults() if (success) { toast.success("Settings reset", { description: "Registration form settings have been reset to defaults." }) } else { toast.error("Failed to reset settings", { description: "Please try again or check your connection." }) } } return ( } title="Registration Form" description="Customize WordPress and WooCommerce registration forms with custom fields." documentationUrl="https://www.swiftcommerce.io/help/customization/registration-forms/" enabled={settings.enabled} onEnabledChange={(enabled) => updateSettings({ enabled })} hasChanges={hasChanges} isSaving={isSaving} onSave={handleSave} onReset={handleReset} > {/* Error Alert */} {error && (
{error}
)} {/* Tabs */} Field Editor Settings Emails {!isPro && ( Upgrade to Pro )} {!isPro && ( )}
) }