MCPcopy Create free account
hub / github.com/mlco2/codecarbon / handleCopy

Function handleCopy

webapp/src/components/createExperimentModal.tsx:97–113  ·  view source on GitHub ↗
(token: string | undefined)

Source from the content-addressed store, hash-verified

95 };
96
97 const handleCopy = (token: string | undefined) => {
98 if (!token) return;
99 navigator.clipboard
100 .writeText(token)
101 .then(() => {
102 setIsCopied(true);
103 toast.success("Experiment ID copied to clipboard");
104 copyTimerRef.current = setTimeout(
105 () => setIsCopied(false),
106 2000,
107 );
108 })
109 .catch((err) => {
110 console.error("Failed to copy experiment id:", err);
111 toast.error("Failed to copy experiment ID");
112 });
113 };
114
115 return (
116 <Dialog open={isOpen} onOpenChange={handleClose}>

Callers 1

CreateExperimentModalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…