From 1dd17260ac7881cda432455543d449872ec6404b Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Fri, 15 May 2026 08:25:33 -0300 Subject: [PATCH] fix(skills): harden clipboard copy + add i18n key for AI Skills tab - AgentSkillCopyButton: wrap navigator.clipboard.writeText in try/catch with textarea fallback for HTTP contexts and older browsers - Replace hardcoded 'AI Skills' tab label with t('agentSkillsTab') i18n key - Add 'agentSkillsTab' key to en.json skills namespace --- src/app/(dashboard)/dashboard/skills/page.tsx | 23 ++++++++++++++----- src/i18n/messages/en.json | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/(dashboard)/dashboard/skills/page.tsx b/src/app/(dashboard)/dashboard/skills/page.tsx index 3da61b54d7..aacd0bd62f 100644 --- a/src/app/(dashboard)/dashboard/skills/page.tsx +++ b/src/app/(dashboard)/dashboard/skills/page.tsx @@ -36,11 +36,22 @@ interface Execution { function AgentSkillCopyButton({ value, label = "Copy link" }: { value: string; label?: string }) { const [copied, setCopied] = useState(false); - const copy = () => { - void navigator.clipboard.writeText(value).then(() => { - setCopied(true); - setTimeout(() => setCopied(false), 2000); - }); + const copy = async () => { + try { + await navigator.clipboard.writeText(value); + } catch { + // Fallback for HTTP contexts or older browsers + const ta = document.createElement("textarea"); + ta.value = value; + ta.style.position = "fixed"; + ta.style.opacity = "0"; + document.body.appendChild(ta); + ta.select(); + document.execCommand("copy"); + document.body.removeChild(ta); + } + setCopied(true); + setTimeout(() => setCopied(false), 2000); }; return ( diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index 429bdfac29..5c847c3a6f 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -2336,6 +2336,7 @@ "skillsTab": "Skills", "executionsTab": "Executions", "sandboxTab": "Sandbox", + "agentSkillsTab": "AI Skills", "loading": "Loading skills...", "noSkills": "No skills found", "noExecutions": "No executions found",