|
1 | 1 | import { useEffect, useMemo, useState } from "react"; |
2 | | -import * as Fathom from "fathom-client"; |
3 | 2 | import { notTranslation as useTranslations } from "../../utils"; |
| 3 | +import CopyUrl from "../CopyUrl"; |
4 | 4 | import useRPCData from "../../hooks/useRPCData"; |
5 | 5 | import useAddToNetwork from "../../hooks/useAddToNetwork"; |
6 | 6 | import { useLlamaNodesRpcData } from "../../hooks/useLlamaNodesRpcData"; |
7 | | -import { FATHOM_DROPDOWN_EVENTS_ID } from "../../hooks/useAnalytics"; |
8 | 7 | import { useRpcStore } from "../../stores"; |
9 | 8 | import { renderProviderText } from "../../utils"; |
10 | 9 | import { Tooltip } from "../../components/Tooltip"; |
11 | 10 | import useAccount from "../../hooks/useAccount"; |
12 | | -import { Popover, PopoverDisclosure, usePopoverStore } from "@ariakit/react/popover"; |
13 | 11 |
|
14 | 12 | export default function RPCList({ chain, lang }) { |
15 | 13 | const [sortChains, setSorting] = useState(true); |
@@ -276,53 +274,3 @@ const LightGreenIcon = () => ( |
276 | 274 | /> |
277 | 275 | </svg> |
278 | 276 | ); |
279 | | - |
280 | | -const CopyUrl = ({ url }) => { |
281 | | - const [open, setOpen] = useState(false); |
282 | | - |
283 | | - useEffect(() => { |
284 | | - if (open) { |
285 | | - setTimeout(() => { |
286 | | - setOpen(false); |
287 | | - }, 500); |
288 | | - } |
289 | | - }, [open]); |
290 | | - |
291 | | - const popover = usePopoverStore({ placement: "bottom", open }); |
292 | | - |
293 | | - return ( |
294 | | - <> |
295 | | - <PopoverDisclosure |
296 | | - store={popover} |
297 | | - render={ |
298 | | - <button |
299 | | - className="max-w-[40ch] px-2 py-[2px] -my-[2px] text-center text-sm overflow-hidden whitespace-nowrap text-ellipsis dark:hover:bg-[#222222] dark:hover:text-white hover:bg-[#EAEAEA] rounded-[50px]" |
300 | | - onClick={() => { |
301 | | - navigator.clipboard.writeText(url).then( |
302 | | - () => { |
303 | | - setOpen(true); |
304 | | - if (url.includes("eth.llamarpc")) { |
305 | | - Fathom.trackGoal(FATHOM_DROPDOWN_EVENTS_ID[1], 0); |
306 | | - } |
307 | | - }, |
308 | | - () => { |
309 | | - console.error(`Failed to copy ${url}`); |
310 | | - }, |
311 | | - ); |
312 | | - }} |
313 | | - > |
314 | | - {url} |
315 | | - </button> |
316 | | - } |
317 | | - /> |
318 | | - {popover.show ? ( |
319 | | - <Popover |
320 | | - store={popover} |
321 | | - className="max-w-md p-1 text-sm border border-gray-500 rounded bg-neutral-50 text-black drop-shadow" |
322 | | - > |
323 | | - <p>Copied!</p> |
324 | | - </Popover> |
325 | | - ) : null} |
326 | | - </> |
327 | | - ); |
328 | | -}; |
0 commit comments