mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
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:
@@ -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>
|
||||
|
||||
|
||||
@@ -2336,6 +2336,7 @@
|
||||
"skillsTab": "Skills",
|
||||
"executionsTab": "Executions",
|
||||
"sandboxTab": "Sandbox",
|
||||
"agentSkillsTab": "AI Skills",
|
||||
"loading": "Loading skills...",
|
||||
"noSkills": "No skills found",
|
||||
"noExecutions": "No executions found",
|
||||
|
||||
Reference in New Issue
Block a user