import { Flex, chakra } from '@chakra-ui/react'; import React from 'react'; import config from 'configs/app'; import { Button } from 'toolkit/chakra/button'; import { Image } from 'toolkit/chakra/image'; import { Link } from 'toolkit/chakra/link'; import { PopoverRoot, PopoverTrigger, PopoverContent, PopoverBody } from 'toolkit/chakra/popover'; import { Skeleton } from 'toolkit/chakra/skeleton'; import { useDisclosure } from 'toolkit/hooks/useDisclosure'; import IconSvg from 'ui/shared/IconSvg'; interface Props { className?: string; hash: string; isLoading?: boolean; } const ContractCodeIde = ({ className, hash, isLoading }: Props) => { const { open, onOpenChange } = useDisclosure(); const ideLinks = React.useMemo(() => { return config.UI.ides.items .map((ide) => { const url = decodeURIComponent(ide.url.replace('{hash}', hash).replace('{domain}', config.app.host || '')); const icon = 'icon_url' in ide ? { : ; return ( { icon } { ide.title } ); }); }, [ hash ]); if (isLoading) { return ; } if (ideLinks.length === 0) { return null; } return ( Redactors { ideLinks } ); }; export default React.memo(chakra(ContractCodeIde));