remove copy copy button from code dropdown (#3317)
This commit is contained in:
25
skyvern-frontend/src/components/CopyButton.tsx
Normal file
25
skyvern-frontend/src/components/CopyButton.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useState } from "react";
|
||||
import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
function CopyButton({ value }: { value: string }) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const handleCopy = () => {
|
||||
if (copied) {
|
||||
return;
|
||||
}
|
||||
window.navigator.clipboard.writeText(value);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 1500);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button size="icon" variant="ghost" onClick={handleCopy}>
|
||||
{copied ? <CheckIcon /> : <CopyIcon />}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export { CopyButton };
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
CopyIcon,
|
||||
@@ -33,25 +32,6 @@ import { WorkflowApiResponse } from "../types/workflowTypes";
|
||||
import { CacheKeyValuesResponse } from "@/routes/workflows/types/scriptTypes";
|
||||
import { OrgWalled } from "@/components/Orgwalled";
|
||||
|
||||
function CopyButton({ value }: { value: string }) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const handleCopy = () => {
|
||||
if (copied) {
|
||||
return;
|
||||
}
|
||||
window.navigator.clipboard.writeText(value);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 1500);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button size="icon" variant="ghost" onClick={handleCopy}>
|
||||
{copied ? <CheckIcon /> : <CopyIcon />}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
interface Dom {
|
||||
input: React.MutableRefObject<HTMLInputElement | null>;
|
||||
}
|
||||
@@ -202,7 +182,6 @@ function WorkflowHeader({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<CopyButton value={chosenCacheKeyValue ?? ""} />
|
||||
</div>
|
||||
</OrgWalled>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user