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
This commit is contained in:
diegosouzapw
2026-05-15 08:25:33 -03:00
parent 5072b82e93
commit 1dd17260ac
2 changed files with 18 additions and 6 deletions

View File

@@ -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 (
<button
@@ -457,7 +468,7 @@ export default function SkillsPage() {
: "border-transparent text-text-muted hover:text-text-main"
}`}
>
AI Skills
{t("agentSkillsTab")}
</button>
</div>

View File

@@ -2336,6 +2336,7 @@
"skillsTab": "Skills",
"executionsTab": "Executions",
"sandboxTab": "Sandbox",
"agentSkillsTab": "AI Skills",
"loading": "Loading skills...",
"noSkills": "No skills found",
"noExecutions": "No executions found",