MCPcopy Create free account
hub / github.com/PageAI-Pro/page-ui / copyCode

Function copyCode

components/bricks/brick-copy-code.tsx:26–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 });
25
26 const copyCode = async () => {
27 if (copied) {
28 return false;
29 }
30
31 setFailed(false);
32 setLoading(true);
33
34 try {
35 const code = await getCode();
36
37 if (!code) {
38 setFailed(true);
39 } else {
40 setCopied(true);
41 navigator.clipboard.writeText(code);
42 }
43 } catch (error) {
44 console.error(error);
45 setFailed(true);
46 } finally {
47 setLoading(false);
48 }
49
50 setTimeout(() => {
51 setCopied(false);
52 setFailed(false);
53 }, 2000);
54 };
55
56 const animation = {
57 initial: { opacity: 0, translateY: 10 },

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected