diff --git a/apps/web/.env b/apps/web/.env index 6bee72bf..d371e8c3 100644 --- a/apps/web/.env +++ b/apps/web/.env @@ -3,4 +3,4 @@ NEXT_PUBLIC_UPLOAD_API=https://upload-api.zora.co NEXT_PUBLIC_IPFS_GATEWAY=https://ipfs.decentralized-content.com -NEXT_PUBLIC_NETWORK_TYPE=testnet \ No newline at end of file +NEXT_PUBLIC_NETWORK_TYPE=testnet diff --git a/apps/web/src/components/Icon/assets/share.svg b/apps/web/src/components/Icon/assets/share.svg new file mode 100644 index 00000000..7d632bf7 --- /dev/null +++ b/apps/web/src/components/Icon/assets/share.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/web/src/components/Icon/icons.ts b/apps/web/src/components/Icon/icons.ts index ad21397e..61620c58 100644 --- a/apps/web/src/components/Icon/icons.ts +++ b/apps/web/src/components/Icon/icons.ts @@ -35,6 +35,7 @@ import Play from './assets/play.svg' import Plus from './assets/plus.svg' import Refresh from './assets/refresh.svg' import ResumeTemplate from './assets/resume-template.svg' +import Share from './assets/share.svg' import Trash from './assets/trash.svg' import Twitter from './assets/twitter.svg' import Warning16 from './assets/warning-16.svg' @@ -80,6 +81,7 @@ export const icons = { resumeTemplate: ResumeTemplate, trash: Trash, twitter: Twitter, + share: Share, warning: Warning, 'warning-16': Warning16, } diff --git a/apps/web/src/modules/auction/components/CurrentAuction/PlaceBid.tsx b/apps/web/src/modules/auction/components/CurrentAuction/PlaceBid.tsx index e15cde34..b234e368 100644 --- a/apps/web/src/modules/auction/components/CurrentAuction/PlaceBid.tsx +++ b/apps/web/src/modules/auction/components/CurrentAuction/PlaceBid.tsx @@ -1,4 +1,4 @@ -import { Box, Button, Flex } from '@zoralabs/zord' +import { Box, Button, Flex, PopUp, Text } from '@zoralabs/zord' import React, { Fragment, memo, useEffect, useState } from 'react' import useSWR, { useSWRConfig } from 'swr' import { formatEther, parseEther } from 'viem' @@ -6,7 +6,9 @@ import { Address, useAccount, useBalance, useContractReads, useNetwork } from 'w import { prepareWriteContract, waitForTransaction, writeContract } from 'wagmi/actions' import { ContractButton } from 'src/components/ContractButton' +import { Icon } from 'src/components/Icon/Icon' import AnimatedModal from 'src/components/Modal/AnimatedModal' +import { PUBLIC_IS_TESTNET } from 'src/constants/defaultChains' import SWR_KEYS from 'src/constants/swrKeys' import { auctionAbi } from 'src/data/contract/abis' import { averageWinningBid } from 'src/data/subgraph/requests/averageWinningBid' @@ -69,7 +71,7 @@ export const PlaceBid = ({ addresses.token ? [SWR_KEYS.AVERAGE_WINNING_BID, chain.id, addresses.token] : undefined, - () => averageWinningBid(chain.id, addresses.token as Address) + () => averageWinningBid(chain.id, addresses.token as Address), ) const isMinBid = Number(bidAmount) >= minBidAmount @@ -122,11 +124,11 @@ export const PlaceBid = ({ if (tx?.hash) await waitForTransaction({ hash: tx.hash }) await mutate([SWR_KEYS.AUCTION_BIDS, chain.id, addresses.token, tokenId], () => - getBids(chain.id, addresses.token!, tokenId) + getBids(chain.id, addresses.token!, tokenId), ) await mutate([SWR_KEYS.AVERAGE_WINNING_BID, chain.id, addresses.token], () => - averageWinningBid(chain.id, addresses.token as Address) + averageWinningBid(chain.id, addresses.token as Address), ) } catch (error) { console.error(error) @@ -142,6 +144,8 @@ export const PlaceBid = ({ const isValidBid = bidAmount && isMinBid const isValidChain = wagmiChain?.id === chain.id + const [showTooltip, setShowTooltip] = useState(false) + const [copied, setCopied] = useState(false) return ( +
- - - Place bid - - + + + Place bid + + {chain.id !== 1 ? ( + + setShowTooltip(true)} + onMouseLeave={() => { + setShowTooltip(false) + setTimeout(() => { + setCopied(false) + }, 500) + }} + > + { + const network = PUBLIC_IS_TESTNET + ? 'https://testnet.nouns.build' + : 'https://nouns.build' + const baseUrl = `${network}/dao/${chain.name.toLowerCase()}/${addresses.token}` + if (address === undefined) { + await navigator.clipboard.writeText(baseUrl) + return + } + const params = new URLSearchParams({ + referral: address.toString(), + }) + const fullUrl = `${baseUrl}?${params}` + + await navigator.clipboard.writeText(fullUrl) + setCopied(true) + }} + > + + + + } placement="top"> + {copied ? 'Copied' : 'Copy Referral Link'} + + + ) : null} + +
) : (