Skip to content

Commit

Permalink
quality of life on the checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
mykcryptodev committed Oct 3, 2024
1 parent ef206cc commit 85c4d4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function Home({ searchParams }: { searchParams: any }) {
const { provider, account, connectWallet, switchWallet } = useWallet();
const [address, setAddress] = useState(searchParams.address || account || '');
const [amount, setAmount] = useState('');
const [isRedirecting, setIsRedirecting] = useState(false);

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

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

const goToCheckout = () => {
if (checkoutUrl) {
setIsRedirecting(true);
window.location.href = checkoutUrl;
}
}
Expand Down Expand Up @@ -106,17 +108,20 @@ export default function Home({ searchParams }: { searchParams: any }) {
<span className="label-text">Amount</span>
</div>
<input
type="text"
type="number"
placeholder=""
className="input input-bordered input-lg w-full max-w-xs"
onChange={handleAmountChange}
/>
</label>
<button
onClick={goToCheckout}
disabled={!isAddress(resolvedAddress) || !amount}
disabled={!isAddress(resolvedAddress) || !amount || isRedirecting}
className="btn btn-primary btn-lg mt-4"
>
{isRedirecting && (
<div className="loading loading-spinner" />
)}
Check out
</button>
</div>
Expand Down

0 comments on commit 85c4d4d

Please sign in to comment.