"use client"; import React from "react"; import { useTranslation } from "@/shared/lib/useTranslation"; import { Link as LinkIcon } from "lucide-react"; import { Modal, ModalContent, ModalBody, Button, Image, } from "@nextui-org/react"; import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext"; import { FaFacebook } from "react-icons/fa"; import { FaLinkedin } from "react-icons/fa6"; import { FaXTwitter } from "react-icons/fa6"; import { copyToClipboard } from "@/shared/utils/clipboard"; import toast from "react-hot-toast"; interface SharePlatformModalProps { isOpen: boolean; onClose: () => void; onShareComplete: () => void; } const SharePlatformModal: React.FC = ({ isOpen, onClose, onShareComplete, }) => { const { t } = useTranslation(); const { platformConfig } = usePlatformConfig(); const handleCopyLink = async () => { try { const res = await copyToClipboard(window.location.origin); onShareComplete(); if (res.success) { toast.success(t("Copied to clipboard")); } } catch (err) { console.error("Failed to copy link:", err); } }; const handleSocialShare = (platform: "x" | "facebook" | "linkedin") => { const text = t( `Just launched my first MCP Platform:{{name}} with xpack.ai 🚀 Built in minutes, no coding, ready for AI Agents 🤖 👉Go and try my MCP: {{link}} #MCP #AI #APIs #XPack #AIagents #DevTools`, { name: platformConfig.name, link: window.location.origin, } ); let url = ""; const shareUrl = encodeURIComponent(window.location.origin); switch (platform) { case "x": url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${shareUrl}`; break; case "facebook": url = `https://www.facebook.com/sharer/sharer.php?u=${shareUrl}`; break; case "linkedin": url = `https://www.linkedin.com/sharing/share-offsite/?url=${shareUrl}`; break; } if (url) { window.open(url, "_blank", "width=600,height=400"); onShareComplete(); } }; return ( {/* Header */}

{t("Your MCP Market is ready.")}

{t("Share your MCP to the world")}

{/* Preview Card */}

{platformConfig.website_title || platformConfig.name}

{platformConfig.meta_description}

{platformConfig.logo && ( {platformConfig.name} )} {platformConfig.name} • {window.location.hostname}
{/* Actions */}
{/* Social buttons */}
{/* Copy link button */}
); }; export default SharePlatformModal;