'use client'; import React, { useEffect, useState } from 'react'; import { Check, Copy, ExternalLink, ChevronDown, ChevronUp, LayoutDashboard, Globe, Rocket, } from 'lucide-react'; import { cn } from '@/lib/utils'; import type { DeployResult } from '@mcpengine/ai-pipeline/types'; // --------------------------------------------------------------------------- // Props // --------------------------------------------------------------------------- export interface DeploySuccessProps { result: DeployResult; serverName?: string; onDashboard?: () => void; onViewServer?: () => void; onDeployAnother?: () => void; className?: string; } // --------------------------------------------------------------------------- // Component // --------------------------------------------------------------------------- export function DeploySuccess({ result, serverName = 'MCP Server', onDashboard, onViewServer, onDeployAnother, className, }: DeploySuccessProps) { const [copied, setCopied] = useState(false); const [showConfig, setShowConfig] = useState(false); const [confettiFired, setConfettiFired] = useState(false); // Fire confetti on mount useEffect(() => { if (confettiFired) return; setConfettiFired(true); // Dynamic import canvas-confetti (client-side only) import('canvas-confetti') .then((mod) => { const confetti = mod.default; // Burst 1 — center confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 }, colors: ['#818cf8', '#34d399', '#f59e0b', '#f472b6'], }); // Burst 2 — left setTimeout(() => { confetti({ particleCount: 50, angle: 60, spread: 55, origin: { x: 0, y: 0.65 }, colors: ['#818cf8', '#34d399'], }); }, 200); // Burst 3 — right setTimeout(() => { confetti({ particleCount: 50, angle: 120, spread: 55, origin: { x: 1, y: 0.65 }, colors: ['#f59e0b', '#f472b6'], }); }, 400); }) .catch(() => { // canvas-confetti not installed — no big deal console.log('canvas-confetti not available'); }); }, [confettiFired]); const copyUrl = async () => { if (result.url) { await navigator.clipboard.writeText(result.url); setCopied(true); setTimeout(() => setCopied(false), 2000); } }; const slug = result.url ?.replace(/^https?:\/\//, '') .replace(/\.mcpengine\.run.*/, '') ?? 'my-server'; const claudeConfig = JSON.stringify( { mcpServers: { [slug]: { url: result.endpoint ?? result.url, }, }, }, null, 2, ); return (
{serverName} is now live and ready to connect
{/* URL display with copy */} {result.url && (
{claudeConfig}