-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TransactionStatusModal): handle TX timeout
- Loading branch information
1 parent
d4e64af
commit 5ba5762
Showing
7 changed files
with
100 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 34 additions & 14 deletions
48
...rements/components/GuildCheckout/components/TransactionStatusModal/components/TxError.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
import { DialogBody, DialogFooter } from "@/components/ui/Dialog" | ||
import { XCircle } from "@phosphor-icons/react/dist/ssr" | ||
import { Timer, XCircle } from "@phosphor-icons/react/dist/ssr" | ||
import { PropsWithChildren } from "react" | ||
import { WaitForTransactionReceiptTimeoutError } from "viem" | ||
import { useTransactionStatusContext } from "../../TransactionStatusContext" | ||
import { TransactionModalCloseButton } from "./TransactionModalCloseButton" | ||
|
||
const TxError = ({ children }: PropsWithChildren<unknown>): JSX.Element => ( | ||
<> | ||
<DialogBody> | ||
<div className="mb-10 flex items-center justify-center"> | ||
<XCircle className="size-36 text-destructive [&>*]:stroke-[6px]" /> | ||
</div> | ||
const TxError = ({ children }: PropsWithChildren<unknown>): JSX.Element => { | ||
const { txError } = useTransactionStatusContext() | ||
|
||
{children} | ||
</DialogBody> | ||
const isTimeout = txError instanceof WaitForTransactionReceiptTimeoutError | ||
|
||
<DialogFooter> | ||
<TransactionModalCloseButton /> | ||
</DialogFooter> | ||
</> | ||
) | ||
return ( | ||
<> | ||
<DialogBody> | ||
<div className="mb-10 flex items-center justify-center"> | ||
{isTimeout ? ( | ||
<Timer className="size-36 text-muted-foreground [&>*]:stroke-[6px]" /> | ||
) : ( | ||
<XCircle className="size-36 text-destructive [&>*]:stroke-[6px]" /> | ||
)} | ||
</div> | ||
|
||
{isTimeout ? ( | ||
<p> | ||
Your transaction is processing. Due to high network traffic, it may take | ||
longer than usual. Check your wallet later for status updates. For | ||
persistent issues, please contact our support. | ||
</p> | ||
) : ( | ||
children | ||
)} | ||
</DialogBody> | ||
|
||
<DialogFooter> | ||
<TransactionModalCloseButton /> | ||
</DialogFooter> | ||
</> | ||
) | ||
} | ||
|
||
export { TxError } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters