"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; interface VariationModalProps { assetId: string; assetName: string; onClose: () => void; } export function VariationModal({ assetId, assetName, onClose }: VariationModalProps) { const [count, setCount] = useState(5); const [loading, setLoading] = useState(false); const [launched, setLaunched] = useState(false); async function handleSpawn() { setLoading(true); await fetch(`/api/assets/${assetId}/variations`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ count }), }); setLoading(false); setLaunched(true); } function handleClose() { setLaunched(false); setCount(5); onClose(); } return ( Spawn Variations Generate new ads with the same emotional pattern as “{assetName}” but with different hook angles. {launched ? (

Spawning {count} variations

The AI pipeline is running. New assets will appear in the Asset Library when ready.

) : ( <>
setCount(Math.max(1, Math.min(20, parseInt(e.target.value) || 5)))} />

Each variation keeps the same visual style and CTA but explores a different hook angle. Uses the original ad as a reference image for visual consistency.

)}
); }