diff --git a/src/app/api/getDelegationsV2.ts b/src/app/api/getDelegationsV2.ts index 18a50972..b91f81ea 100644 --- a/src/app/api/getDelegationsV2.ts +++ b/src/app/api/getDelegationsV2.ts @@ -148,14 +148,14 @@ export const getDelegationsV2 = async ( unbondingTime: apiDelegation.delegation_unbonding.unbonding_time, unbondingTxHex: apiDelegation.delegation_unbonding.unbonding_tx, unbondingSlashingTxHex: - apiDelegation.delegation_unbonding.slashing_tx_hex, + apiDelegation.delegation_unbonding.slashing_tx_hex, covenantUnbondingSignatures: - apiDelegation.delegation_unbonding.covenant_unbonding_signatures?.map( - (signature) => ({ - covenantBtcPkHex: signature.covenant_btc_pk_hex, - signatureHex: signature.signature_hex, - }), - ), + apiDelegation.delegation_unbonding.covenant_unbonding_signatures?.map( + (signature) => ({ + covenantBtcPkHex: signature.covenant_btc_pk_hex, + signatureHex: signature.signature_hex, + }), + ), slashingTxHex: apiDelegation.delegation_staking.slashing_tx_hex, }; }, diff --git a/src/app/components/Modals/CongratModal.tsx b/src/app/components/Modals/CongratModal.tsx index b6cccd17..c9c654fd 100644 --- a/src/app/components/Modals/CongratModal.tsx +++ b/src/app/components/Modals/CongratModal.tsx @@ -1,7 +1,14 @@ -import { Button, Heading } from "@babylonlabs-io/bbn-core-ui"; +import { + Button, + Dialog, + DialogBody, + DialogFooter, + Heading, + MobileDialog, +} from "@babylonlabs-io/bbn-core-ui"; import { LuPartyPopper } from "react-icons/lu"; -import { GeneralModal } from "./GeneralModal"; +import { useIsMobileView } from "@/app/hooks/useBreakpoint"; interface CongratModalProps { open: boolean; @@ -9,16 +16,16 @@ interface CongratModalProps { } export function CongratModal({ open, onClose }: CongratModalProps) { + const isMobileView = useIsMobileView(); + const DialogComponent = isMobileView ? MobileDialog : Dialog; + return ( - -
+ +
- +
+ +
Conratulations

Share feedback or report issues on our{" "} @@ -43,10 +50,16 @@ export function CongratModal({ open, onClose }: CongratModalProps) { community!

- -
-
+ + ); } diff --git a/src/app/components/Modals/TransitionModal/StageEnd.tsx b/src/app/components/Modals/TransitionModal/StageEnd.tsx new file mode 100644 index 00000000..dc1fde9a --- /dev/null +++ b/src/app/components/Modals/TransitionModal/StageEnd.tsx @@ -0,0 +1,41 @@ +import { + Button, + DialogBody, + DialogFooter, + Heading, +} from "@babylonlabs-io/bbn-core-ui"; +import { IoMdCheckmark } from "react-icons/io"; + +interface StageEndProps { + onClose: () => void; +} + +export function StageEnd({ onClose }: StageEndProps) { + return ( + <> + +
+
+ +
+ Transition Submitted +

+ Your phase-1 staking transaction has been successfully submitted to + the Babylon blockchain and should be activated and receive voting + power in a few blocks. Please monitor the Activity tab for the + activation status. +

+
+
+ + + + + ); +} diff --git a/src/app/components/Modals/TransitionModal/StageStart.tsx b/src/app/components/Modals/TransitionModal/StageStart.tsx new file mode 100644 index 00000000..32acb024 --- /dev/null +++ b/src/app/components/Modals/TransitionModal/StageStart.tsx @@ -0,0 +1,45 @@ +import { + Button, + DialogBody, + DialogFooter, + Heading, +} from "@babylonlabs-io/bbn-core-ui"; +import { MdLooksTwo } from "react-icons/md"; + +interface StageStartProps { + onClose: () => void; +} + +export function StageStart({ onClose }: StageStartProps) { + return ( + <> + +
+
+ +
+ Transition to Phase 2 +

+ You are about to transition your phase-1 stake delegation to secure + the phase-2 Babylon PoS blockchain. The transition requires the + association of your Babylon testnet rewards account with your BTC + key as well as your consent to slashing in the case of equivocation. +

+
+
+ + + + + + ); +} diff --git a/src/app/components/Modals/TransitionModal/StageStepping.tsx b/src/app/components/Modals/TransitionModal/StageStepping.tsx new file mode 100644 index 00000000..ed4f4ba5 --- /dev/null +++ b/src/app/components/Modals/TransitionModal/StageStepping.tsx @@ -0,0 +1,109 @@ +import { + Button, + DialogBody, + DialogFooter, + DialogHeader, + Loader, + Text, +} from "@babylonlabs-io/bbn-core-ui"; +import { twMerge } from "tailwind-merge"; + +import { Tick } from "./Tick"; + +const stepContent = [ + "Step 1: Consent to slashing", + "Step 2: Consent to slashing during unbonding ", + "Step 3: BTC-BBN address binding for receiving staking rewards", + "Step 4: Staking transaction registration", +]; + +interface StageSteppingProps { + onClose: () => void; + onSign: () => void; + step: number; + awaitingResponse?: boolean; +} +const Step = ({ + active, + completed, + current, + content, +}: { + active: boolean; + completed: boolean; + current: number; + content: string; +}) => ( +
+ {completed ? ( + + ) : ( +
+ + {current} + +
+ )} + + {content} + +
+); +export function StageStepping({ + onClose, + onSign, + step, + awaitingResponse = false, +}: StageSteppingProps) { + return ( + <> + + + + Please sign the following messages + +
+ {stepContent.map((content, index) => ( + index + 1} + active={step === index + 1} + current={index + 1} + content={content} + /> + ))} +
+
+ + + + + + ); +} diff --git a/src/app/components/Modals/TransitionModal/Tick.tsx b/src/app/components/Modals/TransitionModal/Tick.tsx new file mode 100644 index 00000000..9b3900db --- /dev/null +++ b/src/app/components/Modals/TransitionModal/Tick.tsx @@ -0,0 +1,9 @@ +import { IoCheckmarkSharp } from "react-icons/io5"; + +export function Tick() { + return ( +
+ +
+ ); +} diff --git a/src/app/components/Modals/TransitionModal/TransitionModal.tsx b/src/app/components/Modals/TransitionModal/TransitionModal.tsx new file mode 100644 index 00000000..5ad0d722 --- /dev/null +++ b/src/app/components/Modals/TransitionModal/TransitionModal.tsx @@ -0,0 +1,75 @@ +import { Dialog, MobileDialog } from "@babylonlabs-io/bbn-core-ui"; + +import { useIsMobileView } from "@/app/hooks/useBreakpoint"; + +import { StageEnd } from "./StageEnd"; +import { StageStart } from "./StageStart"; +import { StageStepping } from "./StageStepping"; + +interface TransitionModalProps { + open: boolean; + onClose: () => void; + onSign: () => void; + stage: + | "start" + | "step-1" + | "step-2" + | "step-3" + | "step-4" + | "pre-end" + | "end"; +} +const stageUIMapping = { + start: ({ onClose }: TransitionModalProps) => ( + + ), + "step-1": ({ onClose, onSign }: TransitionModalProps) => ( + + ), + "step-2": ({ onClose, onSign }: TransitionModalProps) => ( + + ), + "step-3": ({ onClose, onSign }: TransitionModalProps) => ( + + ), + "step-4": ({ onClose, onSign }: TransitionModalProps) => ( + + ), + "pre-end": ({ onClose, onSign }: TransitionModalProps) => ( + + ), + end: ({ onClose }: TransitionModalProps) => , +} as const; +export function TransitionModal(props: TransitionModalProps) { + const { open, onClose, stage } = props; + const isMobileView = useIsMobileView(); + const DialogComponent = isMobileView ? MobileDialog : Dialog; + + const Content = stageUIMapping[stage]; + + return ( + + + + ); +}