File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export default function Home({ searchParams }: { searchParams: any }) {
12
12
const { provider, account, connectWallet, switchWallet } = useWallet ( ) ;
13
13
const [ address , setAddress ] = useState ( searchParams . address || account || '' ) ;
14
14
const [ amount , setAmount ] = useState ( '' ) ;
15
+ const [ isRedirecting , setIsRedirecting ] = useState ( false ) ;
15
16
16
17
const { resolvedAddress } = useEnsResolver ( address , provider ) ;
17
18
@@ -35,6 +36,7 @@ export default function Home({ searchParams }: { searchParams: any }) {
35
36
36
37
const goToCheckout = ( ) => {
37
38
if ( checkoutUrl ) {
39
+ setIsRedirecting ( true ) ;
38
40
window . location . href = checkoutUrl ;
39
41
}
40
42
}
@@ -106,17 +108,20 @@ export default function Home({ searchParams }: { searchParams: any }) {
106
108
< span className = "label-text" > Amount</ span >
107
109
</ div >
108
110
< input
109
- type = "text "
111
+ type = "number "
110
112
placeholder = ""
111
113
className = "input input-bordered input-lg w-full max-w-xs"
112
114
onChange = { handleAmountChange }
113
115
/>
114
116
</ label >
115
117
< button
116
118
onClick = { goToCheckout }
117
- disabled = { ! isAddress ( resolvedAddress ) || ! amount }
119
+ disabled = { ! isAddress ( resolvedAddress ) || ! amount || isRedirecting }
118
120
className = "btn btn-primary btn-lg mt-4"
119
121
>
122
+ { isRedirecting && (
123
+ < div className = "loading loading-spinner" />
124
+ ) }
120
125
Check out
121
126
</ button >
122
127
</ div >
You can’t perform that action at this time.
0 commit comments