(key: string, value: string | null)
| 27 | const [rawSourceCode, setRawSourceCode] = useState<Record<string, string | null>>({}) |
| 28 | |
| 29 | const handleCopy = async (key: string, value: string | null) => { |
| 30 | if (value) { |
| 31 | const didCopy = await copy(value) |
| 32 | if (!didCopy) return |
| 33 | setCopiedStates((prev) => ({ ...prev, [key]: true })) |
| 34 | setTimeout(() => { |
| 35 | setCopiedStates((prev) => ({ ...prev, [key]: false })) |
| 36 | }, 2000) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | useEffect(() => { |
| 41 | const fetchRegistryData = async () => { |