"use client"; import { useState } from "react"; import { useTranslations } from "next-intl"; import Modal from "./Modal"; import Button from "./Button"; import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard"; export default function ManualConfigModal({ isOpen, onClose, title, configs = [] }) { const t = useTranslations("common"); const resolvedTitle = title ?? t("manualConfig"); const [copiedIndex, setCopiedIndex] = useState(null); const { copy } = useCopyToClipboard(); // Delegates to the shared useCopyToClipboard hook, which transparently // falls back to a hidden textarea + legacy copy command when the // Clipboard API is unavailable (HTTP / non-secure contexts, iframes). const copyConfig = async (text, index) => { const ok = await copy(text, `manualconfig-${index}`); if (!ok) return; setCopiedIndex(index); setTimeout(() => setCopiedIndex(null), 2000); }; return (
{configs.map((config, index) => (
{config.filename}
              {config.content}
            
))}
); }