Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(migrator): show what's next screen #130

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions apps/converter/src/components/converter/dialogue/Completed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
L1_BITDAO_TOKEN_ADDRESS,
L1_MANTLE_TOKEN,
L1_CHAIN_ID,
CTAPages,
} from "@config/constants";
import { Button, Typography } from "@mantle/ui";
import TxLink from "@components/converter/utils/TxLink";
Expand All @@ -16,6 +17,7 @@ import { useToast } from "@hooks/useToast";
import StateContext from "@providers/stateContext";
import CheckedCircle from "public/converted/check_circle.svg";
import MetamaskSvg from "public/converted/metamask.svg";
import { MdClear } from "react-icons/md";

export default function Deposited({
txHash,
Expand All @@ -28,7 +30,8 @@ export default function Deposited({
}) {
const { addToken } = useAddToken();
const { createToast } = useToast();
const { chainId, isLoadingBalances, balances } = useContext(StateContext);
const { chainId, isLoadingBalances, balances, setCTAPage } =
useContext(StateContext);

useEffect(() => {
if (typeof txHash === "string") {
Expand Down Expand Up @@ -101,11 +104,21 @@ export default function Deposited({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoadingBalances, txHash, BITBalance, hasBitBalanceRemaining]);

const openWhatsNext = () => {
setCTAPage(CTAPages.WhatsNext);
};

return (
<>
<Typography variant="modalHeading" className="text-center w-full mt-4">
Migration completed
</Typography>
<span className="flex justify-between align-middle">
<Typography variant="modalHeading" className="text-center w-full mt-4">
Migration completed
</Typography>
<Typography variant="modalHeading" className="text-white w-auto pt-1">
<MdClear onClick={openWhatsNext} className="cursor-pointer" />
</Typography>
</span>

<span className="w-full flex justify-center">
<Image src={CheckedCircle} alt="Checked" height={80} width={80} />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function WhatNextLink({
);
}

export default function Deposited({
export default function WhatsNext({
txHash,
from,
closeModal,
Expand Down
9 changes: 8 additions & 1 deletion apps/converter/src/components/converter/dialogue/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Loading from "@components/converter/dialogue/Loading";
import Error from "@components/converter/dialogue/Error";

import Converted from "@components/converter/dialogue/Completed";

import WhatsNext from "@components/converter/dialogue/WhatsNext";
import { ConvertCard } from "@components/ConvertCard";
import { formatUnits, parseUnits } from "ethers/lib/utils.js";

Expand Down Expand Up @@ -88,6 +88,13 @@ export default function Dialogue() {
closeModal={closeModalAndReset}
/>
)}
{ctaPage === CTAPages.WhatsNext && (
<WhatsNext
txHash={txHash}
from={from}
closeModal={closeModalAndReset}
/>
)}
{ctaPage === CTAPages.Loading && (
<Loading
txHash={txHash}
Expand Down
1 change: 1 addition & 0 deletions apps/converter/src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export enum CTAPages {
"Default",
"Loading",
"Converted",
"WhatsNext",
"Error",
}

Expand Down