diff --git a/src/pages/developer-nft/coming-soon/CheckElegbility/index.tsx b/src/pages/developer-nft/coming-soon/CheckElegbility/index.tsx deleted file mode 100644 index f790cfd55..000000000 --- a/src/pages/developer-nft/coming-soon/CheckElegbility/index.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useEffect, useState } from "react" -import ReactGA from "react-ga4" - -import { Collapse, Stack, Typography } from "@mui/material" - -import Alert from "@/components/Alert/NFTAlert" -import Button from "@/components/Button" -import Link from "@/components/Link" -import { MintableDate } from "@/constants" -import { useRainbowContext } from "@/contexts/RainbowProvider" -import useCheckViewport from "@/hooks/useCheckViewport" -import { formatDate, requireEnv } from "@/utils" - -const L2_SCAN_URI = requireEnv("REACT_APP_L2_SCAN_URI") -const UNIFRA_API_KEY = requireEnv("REACT_APP_UNIFRA_API_KEY") - -const CheckElegbility = () => { - const { connect, walletCurrentAddress } = useRainbowContext() - - const { isMobile } = useCheckViewport() - - const [isEligible, setIsEligible] = useState(0) - const [loading, setLoading] = useState(false) - - useEffect(() => { - if (walletCurrentAddress) { - setIsEligible(0) - } - }, [walletCurrentAddress]) - - const handleCheck = async () => { - setLoading(true) - scrollRequest(`${L2_SCAN_URI}/api/beta/contracts?creator=${walletCurrentAddress}`, { - headers: { - Authorization: `Bearer ${UNIFRA_API_KEY}`, - }, - }) - .then(({ items }) => { - if (items.length) { - setIsEligible(1) - } else { - setIsEligible(-1) - } - ReactGA.event("check_eligibility", { - contractsNumber: items.length, - }) - }) - .catch(e => { - setIsEligible(-2) - }) - .finally(() => { - setLoading(false) - }) - } - - const renderCheck = () => { - if (isEligible === -1) { - return Selected account is not eligible yet to mint. Deploy a project to be qualified. - } else if (isEligible === -2) { - return Network error. Please try again later - } else if (isEligible === 1) { - return You are eligible to mint the NFT. Come back on {formatDate(MintableDate)} to claim it. - } - return null - } - - return ( - - {isEligible ? ( - {renderCheck()} - ) : ( - <> - {walletCurrentAddress ? ( - - ) : ( - - )} - - )} - - Service provided by{" "} - - L2SCAN team - - . - - - ) -} - -export default CheckElegbility diff --git a/src/pages/developer-nft/mint/home/ReadyToMint.tsx b/src/pages/developer-nft/mint/home/ReadyToMint.tsx deleted file mode 100644 index 55f460259..000000000 --- a/src/pages/developer-nft/mint/home/ReadyToMint.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import { useState } from "react" -import Countdown, { zeroPad } from "react-countdown" -import ReactGA from "react-ga4" - -import { Box, Stack, Typography } from "@mui/material" -import { styled } from "@mui/material/styles" - -import { fetchParamsByAddressURL } from "@/apis/nft" -import Alert from "@/components/Alert/NFTAlert" -import Button from "@/components/Button" -import Link from "@/components/Link" -import RequestWarning from "@/components/RequestWarning" -import { ANNOUNCING_SCROLL_ORIGINS_NFT, ContractReleaseDate, DESIGNING_SCROLL_ORIGINS } from "@/constants" -import { CHAIN_ID, L2_NAME, MintableEndDate, SCROLL_ORIGINS_NFT } from "@/constants" -import { useRainbowContext } from "@/contexts/RainbowProvider" -import useCheckViewport from "@/hooks/useCheckViewport" -import useNFTStore from "@/stores/nftStore" -import { formatDate, switchNetwork } from "@/utils" - -import NFTCard from "../../components/NFTCard" -import Statistic from "../../components/Statistic" -import MintFlowDialog from "./MintFlowDialog" - -const CustomLink = styled(Link)(({ theme }) => ({ - color: `${theme.palette.primary.main} !important`, - fontSize: "inherit", - textUnderlineOffset: "2px", - textDecorationThickness: "1px", - fontWeight: 700, -})) - -const MintHome = props => { - const { total } = props - const { chainId, connect, walletCurrentAddress } = useRainbowContext() - - const { isMobile, isPortrait, isLandscape } = useCheckViewport() - const { isEligible, isMinting, changeIsEligible } = useNFTStore() - const [loading, setLoading] = useState(false) - const [errorMessage, setErrorMessage] = useState("") - - const handleCheckEligibility = async () => { - setLoading(true) - scrollRequest(fetchParamsByAddressURL(walletCurrentAddress)) - .then(data => { - if (data.proof) { - changeIsEligible(1) - ReactGA.event("mint_now", { - walletAddress: walletCurrentAddress, - isEligible: 1, - }) - } else if (!data.error) { - changeIsEligible(-1) - ReactGA.event("mint_now", { - walletAddress: walletCurrentAddress, - isEligible: -1, - }) - } else { - throw new Error("Netword error, try again later") - } - }) - .catch(e => { - setErrorMessage(e.message.slice(0, 120)) - }) - .finally(() => { - setLoading(false) - }) - } - - const renderAction = (end = false) => { - if (chainId === CHAIN_ID.L2) { - if (end) { - return ( - - ) - } - return ( - - ) - } else if (walletCurrentAddress) { - return ( - - ) - } - return ( - - ) - } - - const handleCloseFlow = () => { - changeIsEligible(0) - } - - const handleCloseWarning = () => { - setErrorMessage("") - } - - const renderCountDown = ({ hours, days, minutes, seconds, completed }) => { - return ( - <> - - {completed ? "" : ` Mint ends in ${zeroPad(days)}:${zeroPad(hours)}:${zeroPad(minutes)}:${zeroPad(seconds)}`} - - - {!isEligible && <>{renderAction(completed)}} - {isEligible === -1 && ( - - The wallet address is not eligible. Please reach out to Scroll Discord, ‘scroll-origins-support,’ if you have any questions about{" "} - {SCROLL_ORIGINS_NFT}. - - )} - - - ) - } - - return ( - theme.palette.primary.contrastText, - }, - "@media (max-width: 1280px)": { - gap: "2rem", - display: "grid", - gridTemplateColumns: "minmax(min-content, 1fr) 1fr", - justifyItems: "center", - }, - - "@media (max-width: 900px)": { - gridTemplateColumns: "1fr", - }, - "@media (max-width: 600px)": { - gap: "2.4rem", - }, - }} - > - - - - {SCROLL_ORIGINS_NFT} - - - Scroll Origins - {" "} - is a{" "} - - specially designed NFT - {" "} - program to celebrate alongside early developers building on Scroll within 60 days of Genesis Block (Before December 9, 2023 10:59PM GMT). - - - - {typeof total === "bigint" ? total.toString() : "-"} - {formatDate(ContractReleaseDate)} - - - - - - {errorMessage} - - - ) -} - -export default MintHome diff --git a/src/pages/developer-nft/mint/mock/index.tsx b/src/pages/developer-nft/mint/mock/index.tsx deleted file mode 100644 index 5e756f330..000000000 --- a/src/pages/developer-nft/mint/mock/index.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { useState } from "react" - -import { generateParamsByAddressURL } from "@/apis/nft" -import Button from "@/components/Button" -import Link from "@/components/Link" -import SectionWrapper from "@/components/SectionWrapper" -import { CHAIN_ID, L2_NAME } from "@/constants" -import { useRainbowContext } from "@/contexts/RainbowProvider" -import { switchNetwork } from "@/utils" - -const Mock = () => { - const { walletCurrentAddress, chainId, connect } = useRainbowContext() - - const [isReady, setIsReady] = useState(false) - const [loading, setLoading] = useState(false) - - const handleGenerateProof = () => { - setLoading(true) - scrollRequest(generateParamsByAddressURL(walletCurrentAddress)) - .then(data => { - setIsReady(true) - }) - .finally(() => { - setLoading(false) - }) - } - - const renderAction = () => { - if (chainId === CHAIN_ID.L2) { - return ( - <> - {isReady ? ( - - Go to Mint - - ) : ( - - )} - - ) - } else if (walletCurrentAddress) { - return ( - - ) - } - return ( - - ) - } - - return ( - - {renderAction()} - - ) -} - -export default Mock