MCPcopy Index your code
hub / github.com/intentui/intentui / handleCopy

Function handleCopy

src/components/code/code-block.tsx:24–33  ·  view source on GitHub ↗
(key: string, value: string | null)

Source from the content-addressed store, hash-verified

22 const { copy } = useClipboard()
23
24 const handleCopy = async (key: string, value: string | null) => {
25 if (value) {
26 const didCopy = await copy(value)
27 if (!didCopy) return
28 setCopiedStates((prev) => ({ ...prev, [key]: true }))
29 setTimeout(() => {
30 setCopiedStates((prev) => ({ ...prev, [key]: false }))
31 }, 2000)
32 }
33 }
34 useEffect(() => {
35 const fetchContents = async () => {
36 const loadedContents: Record<string, string> = {}

Callers 1

CodeBlockFunction · 0.70

Calls 1

copyFunction · 0.85

Tested by

no test coverage detected