1
1
import { Box , Button , Flex , Icon , Text } from "@chakra-ui/react"
2
- import React , { useMemo , useState } from "react"
2
+ import React , { useEffect , useMemo , useState } from "react"
3
3
import {
4
4
RiPriceTag2Line ,
5
5
RiAuctionLine ,
6
6
RiFileTransferLine ,
7
7
} from "react-icons/ri"
8
8
import { AnimatePresence , motion } from "framer-motion"
9
- import { Slider } from "./Slider "
10
- import { Web3App } from "./Web3App "
9
+ import GatsbyImage from "../../../GatsbyImage "
10
+ import { NotificationPopover } from "../../NotificationPopover "
11
11
import { ProgressCta } from "../../ProgressCta"
12
12
import { WalletHome } from "../../WalletHome"
13
- import type { PhoneScreenProps } from "../../interfaces"
14
13
import type { TokenBalance } from "../../WalletHome/interfaces"
15
- import { defaultTokenBalances } from "../../constants"
16
- import { useEthPrice } from "../../../../hooks/useEthPrice"
17
14
import { useNFT } from "../../WalletHome/hooks/useNFT"
18
- import GatsbyImage from "../../../GatsbyImage"
19
- import { FALLBACK_ETH_PRICE , USD_RECEIVE_AMOUNT } from "../../constants"
20
- import { EXAMPLE_APP_URL } from "./constants"
21
15
import { Browser } from "./Browser"
22
- import { NotificationPopover } from "../../NotificationPopover"
16
+ import { Slider } from "./Slider"
17
+ import { Web3App } from "./Web3App"
18
+ import {
19
+ defaultTokenBalances ,
20
+ FALLBACK_ETH_PRICE ,
21
+ USD_RECEIVE_AMOUNT ,
22
+ BASE_ANIMATION_DELAY_SEC ,
23
+ } from "../../constants"
24
+ import { EXAMPLE_APP_URL } from "./constants"
25
+ import type { PhoneScreenProps } from "../../interfaces"
26
+ import { useEthPrice } from "../../../../hooks/useEthPrice"
23
27
24
28
export const ConnectWeb3 : React . FC < PhoneScreenProps > = ( { nav, ctaLabel } ) => {
25
29
const { progressStepper, step } = nav
@@ -45,6 +49,17 @@ export const ConnectWeb3: React.FC<PhoneScreenProps> = ({ nav, ctaLabel }) => {
45
49
initial : { opacity : 0 } ,
46
50
animate : { opacity : 1 } ,
47
51
}
52
+
53
+ // Enable ProgressCta button after short delay for first step
54
+ const [ ctaDisabled , setCtaDisabled ] = useState ( step === 0 )
55
+ useEffect ( ( ) => {
56
+ if ( step !== 0 ) return
57
+ const timeout = setTimeout ( ( ) => {
58
+ setCtaDisabled ( false )
59
+ } , BASE_ANIMATION_DELAY_SEC * 1000 )
60
+ return ( ) => clearTimeout ( timeout )
61
+ } , [ ] )
62
+
48
63
return (
49
64
< >
50
65
{ [ 0 ] . includes ( step ) && < Browser progressStepper = { progressStepper } /> }
@@ -173,6 +188,7 @@ export const ConnectWeb3: React.FC<PhoneScreenProps> = ({ nav, ctaLabel }) => {
173
188
{ [ 0 , 1 , 2 , 3 , 4 ] . includes ( step ) && (
174
189
< ProgressCta
175
190
isAnimated = { step === 0 }
191
+ isDisabled = { ctaDisabled }
176
192
progressStepper = { progressStepper }
177
193
mb = { step === 0 ? 16 : 0 }
178
194
>
0 commit comments