Skip to content

Commit

Permalink
added enable to buy with crypto btn
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisZerbib committed Jun 4, 2024
1 parent 9ca5a4e commit 59592cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/PayWithCrypto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ type PayWithCryptoProps = {
amount: string;
onClick: () => void;
currency: string;
enabled: boolean;
};
import { CHAIN } from "@tonconnect/protocol";

export function BuyWithCrypto({
amount,
onClick,
currency,
enabled,
}: PayWithCryptoProps) {
const { sender, connected, network } = useTonConnect();
const tonRecipient =
Expand Down Expand Up @@ -42,7 +44,11 @@ export function BuyWithCrypto({
parseFloat(amount) <= 0 ||
tonRecipient === "" ||
tonRecipient === undefined ||
tonRecipient === null
tonRecipient === null ||
currency === "" ||
currency === undefined ||
currency === null ||
!enabled
}
onClick={async () => {
onClick();
Expand Down
4 changes: 4 additions & 0 deletions src/pages/CheckoutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ function CheckoutPage({ open, onClose }: any) {
</h2>
<div style={{ marginTop: "20px", marginBottom: "20px" }}>
<BuyWithCrypto
enabled={
parseInt(totalPriceFeesIncluded) > 0 &&
selectedAddress.length > 0
}
amount={totalPriceFeesIncluded}
onClick={closeDrawer}
currency={selectedCurrency}
Expand Down

0 comments on commit 59592cf

Please sign in to comment.