"use client"; import { useState } from "react"; import Modal from "./Modal"; import Button from "./Button"; export default function ManualConfigModal({ isOpen, onClose, title = "Manual Configuration", configs = [], }) { const [copiedIndex, setCopiedIndex] = useState(null); const copyToClipboard = async (text, index) => { try { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text); } else { const textarea = document.createElement("textarea"); textarea.value = text; textarea.style.position = "fixed"; textarea.style.left = "-9999px"; textarea.style.top = "-9999px"; textarea.style.opacity = "0"; document.body.appendChild(textarea); textarea.focus(); textarea.select(); document.execCommand("copy"); document.body.removeChild(textarea); } setCopiedIndex(index); setTimeout(() => setCopiedIndex(null), 2000); } catch (err) { console.log("Failed to copy:", err); } }; return (
{configs.map((config, index) => (
{config.filename}
              {config.content}
            
))}
); }