Skip to content

Commit 85c4d4d

Browse files
committed
quality of life on the checkout page
1 parent ef206cc commit 85c4d4d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function Home({ searchParams }: { searchParams: any }) {
1212
const { provider, account, connectWallet, switchWallet } = useWallet();
1313
const [address, setAddress] = useState(searchParams.address || account || '');
1414
const [amount, setAmount] = useState('');
15+
const [isRedirecting, setIsRedirecting] = useState(false);
1516

1617
const { resolvedAddress } = useEnsResolver(address, provider);
1718

@@ -35,6 +36,7 @@ export default function Home({ searchParams }: { searchParams: any }) {
3536

3637
const goToCheckout = () => {
3738
if (checkoutUrl) {
39+
setIsRedirecting(true);
3840
window.location.href = checkoutUrl;
3941
}
4042
}
@@ -106,17 +108,20 @@ export default function Home({ searchParams }: { searchParams: any }) {
106108
<span className="label-text">Amount</span>
107109
</div>
108110
<input
109-
type="text"
111+
type="number"
110112
placeholder=""
111113
className="input input-bordered input-lg w-full max-w-xs"
112114
onChange={handleAmountChange}
113115
/>
114116
</label>
115117
<button
116118
onClick={goToCheckout}
117-
disabled={!isAddress(resolvedAddress) || !amount}
119+
disabled={!isAddress(resolvedAddress) || !amount || isRedirecting}
118120
className="btn btn-primary btn-lg mt-4"
119121
>
122+
{isRedirecting && (
123+
<div className="loading loading-spinner" />
124+
)}
120125
Check out
121126
</button>
122127
</div>

0 commit comments

Comments
 (0)