-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Pending verification modal (#335)
* pending verification modal * clean unused
- Loading branch information
1 parent
adf9a49
commit 5c8943f
Showing
1 changed file
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { FaCheckCircle } from "react-icons/fa"; | ||
|
||
import { getNetworkConfig } from "@/config/network.config"; | ||
|
||
import { GeneralModal } from "./GeneralModal"; | ||
|
||
interface PendingVerificationModalProps { | ||
open: boolean; | ||
onClose: (value: boolean) => void; | ||
verified: boolean; | ||
onStake?: () => void; | ||
awaitingWalletResponse: boolean; | ||
} | ||
|
||
const Verified = () => ( | ||
<> | ||
<FaCheckCircle className="text-5xl text-success" /> | ||
<h3 className="text-xl text-center">Verified</h3> | ||
<p className="text-sm text-center"> | ||
Your request has been verified by the babylon blockchain. You can now | ||
stake | ||
</p> | ||
</> | ||
); | ||
|
||
const NotVerified = () => ( | ||
<> | ||
<span className="loading loading-spinner loading-lg text-primary" /> | ||
<h3 className="text-xl text-center">Pending Verification</h3> | ||
<p className="text-sm text-center"> | ||
The babylon blockchain has received your request. Please wait while we | ||
confirm the neseccary amount of signatures | ||
</p> | ||
</> | ||
); | ||
|
||
export function PendingVerificationModal({ | ||
open, | ||
onClose, | ||
verified, | ||
onStake, | ||
awaitingWalletResponse, | ||
}: PendingVerificationModalProps) { | ||
const { networkName } = getNetworkConfig(); | ||
|
||
return ( | ||
<GeneralModal | ||
open={open} | ||
onClose={onClose} | ||
closeOnOverlayClick={false} | ||
closeOnEsc={false} | ||
> | ||
<div className="flex flex-col gap-8 md:max-w-[34rem]"> | ||
<div className="py-4 flex flex-col items-center gap-4"> | ||
{verified ? <Verified /> : <NotVerified />} | ||
</div> | ||
<button | ||
className="btn btn-primary" | ||
disabled={!verified || awaitingWalletResponse} | ||
onClick={onStake} | ||
> | ||
{awaitingWalletResponse ? ( | ||
<span className="loading loading-spinner"></span> | ||
) : ( | ||
<span>Stake on {networkName}</span> | ||
)} | ||
</button> | ||
</div> | ||
</GeneralModal> | ||
); | ||
} |