-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88ffe7e
commit 1532014
Showing
14 changed files
with
286 additions
and
111 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 |
---|---|---|
@@ -1,28 +1,40 @@ | ||
import { HStack } from "@chakra-ui/react"; | ||
|
||
import { RootState } from "@store/index"; | ||
import { useSelector } from "react-redux"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { LockScreen } from "../lock-screen/lock-screen"; | ||
import { ProgressTimeline } from "../progress-timeline/progress-timeline"; | ||
import { TransactionForm } from "../transaction-form/transaction-form"; | ||
import { TransactionSummary } from "../transaction-summary/transaction-summary"; | ||
import { Walkthrough } from "../walkthrough/walkthrough"; | ||
import { MintLayout } from "./components/mint.layout"; | ||
import { StepButton } from "@components/step-button/step-button"; | ||
import { mintUnmintActions } from "@store/slices/mintunmint/mintunmint.actions"; | ||
|
||
export function Mint(): React.JSX.Element { | ||
const dispatch = useDispatch(); | ||
const { mintStep } = useSelector((state: RootState) => state.mintunmint); | ||
|
||
function handleRestart() { | ||
dispatch(mintUnmintActions.setMintStep(0)); | ||
} | ||
|
||
return ( | ||
<MintLayout> | ||
<ProgressTimeline variant={"mint"} currentStep={mintStep} /> | ||
<HStack w={"100%"} alignItems={"start"} justifyContent={"space-between"}> | ||
<Walkthrough flow={"mint"} currentStep={mintStep} /> | ||
{[0].includes(mintStep) && <TransactionForm />} | ||
{[1].includes(mintStep) && <LockScreen />} | ||
{[2].includes(mintStep) && ( | ||
<TransactionSummary flow={"mint"} blockchain={"ethereum"} /> | ||
{[2, 3].includes(mintStep) && ( | ||
<TransactionSummary | ||
currentStep={mintStep} | ||
flow={"mint"} | ||
blockchain={"ethereum"} | ||
/> | ||
)} | ||
</HStack> | ||
<StepButton handleClick={handleRestart} /> | ||
</MintLayout> | ||
); | ||
} |
74 changes: 59 additions & 15 deletions
74
src/app/components/mint-unmint/components/transaction-summary/transaction-summary.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
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
33 changes: 15 additions & 18 deletions
33
src/app/components/mint-unmint/components/unmint/unmint.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,41 +1,38 @@ | ||
import { useState } from "react"; | ||
|
||
import { HStack } from "@chakra-ui/react"; | ||
import { StepButton } from "@components/step-button/step-button"; | ||
import { VaultState } from "@models/vault"; | ||
|
||
import { exampleVaults } from "@shared/examples/example-vaults"; | ||
|
||
import { RootState } from "@store/index"; | ||
import { mintUnmintActions } from "@store/slices/mintunmint/mintunmint.actions"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { ProgressTimeline } from "../progress-timeline/progress-timeline"; | ||
import { TransactionSummary } from "../transaction-summary/transaction-summary"; | ||
import { Walkthrough } from "../walkthrough/walkthrough"; | ||
import { UnmintVaultSelector } from "./components/unmint-vault-selector"; | ||
import { UnmintLayout } from "./components/unmint.layout"; | ||
|
||
export function Unmint(): React.JSX.Element { | ||
const [currentStep, setCurrentStep] = useState(0); | ||
const exampleVault = exampleVaults.find( | ||
(vault) => vault.state === VaultState.CLOSING, | ||
); | ||
const dispatch = useDispatch(); | ||
const { unmintStep } = useSelector((state: RootState) => state.mintunmint); | ||
|
||
function handleRestart() { | ||
dispatch(mintUnmintActions.setUnmintStep(0)); | ||
} | ||
|
||
return ( | ||
<UnmintLayout> | ||
<ProgressTimeline variant={"unmint"} currentStep={currentStep} /> | ||
<ProgressTimeline variant={"unmint"} currentStep={unmintStep} /> | ||
<HStack w={"100%"} alignItems={"start"} justifyContent={"space-between"}> | ||
<Walkthrough | ||
flow={"unmint"} | ||
bitcoinAmount={exampleVault?.collateral} | ||
currentStep={currentStep} | ||
/> | ||
{[0].includes(currentStep) && <UnmintVaultSelector />} | ||
{[1].includes(currentStep) && ( | ||
<Walkthrough flow={"unmint"} currentStep={unmintStep} /> | ||
{[0].includes(unmintStep) && <UnmintVaultSelector />} | ||
{[1, 2].includes(unmintStep) && ( | ||
<TransactionSummary | ||
currentStep={unmintStep} | ||
flow={"unmint"} | ||
blockchain={"bitcoin"} | ||
/> | ||
)} | ||
</HStack> | ||
<StepButton handleClick={() => setCurrentStep((currentStep + 1) % 2)} /> | ||
<StepButton handleClick={handleRestart} /> | ||
</UnmintLayout> | ||
); | ||
} |
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
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
Oops, something went wrong.