Skip to content

Commit

Permalink
feature: Pending verification modal (#335)
Browse files Browse the repository at this point in the history
* pending verification modal

* clean unused
  • Loading branch information
gbarkhatov authored Nov 12, 2024
1 parent adf9a49 commit 5c8943f
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions src/app/components/Modals/PendingVerificationModal.tsx
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>
);
}

0 comments on commit 5c8943f

Please sign in to comment.