"use client"; import { useState } from 'react'; import { UseFormReturn } from 'react-hook-form'; import { toast } from 'sonner'; import { z } from 'zod'; import { Sparkles } from 'lucide-react'; import Editor from 'react-simple-code-editor'; //@ts-nocheck import { highlight, languages } from 'prismjs/components/prism-core'; import 'prismjs/components/prism-clike'; import 'prismjs/components/prism-javascript'; import 'prismjs/themes/prism-tomorrow.css'; import { heroFormSchema } from '@/lib/validators'; import { Button } from '@/components/ui/button'; import { FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { Textarea } from '@/components/ui/textarea'; import { regeneratePowerLogicAction } from '@/app/actions/db.actions'; type FormSchemaType = z.infer; interface PowerLogicSectionProps { form: UseFormReturn; } export const PowerLogicSection = ({ form }: PowerLogicSectionProps) => { const [isGenerating, setIsGenerating] = useState(false); const handleRegenerateCode = async () => { setIsGenerating(true); const toastId = toast.loading("Generating new superpower logic..."); const logicDescription = form.getValues('powerLogicDescription'); const result = await regeneratePowerLogicAction(logicDescription); if (result.success && result.data) { form.setValue('powerLogic', result.data, { shouldValidate: true, shouldDirty: true }); toast.success("New logic generated!", { id: toastId }); } else { toast.error(result.message || "Could not generate logic.", { id: toastId }); } setIsGenerating(false); }; return (

Superpower Logic

( Logic Description