Skip to content

Commit

Permalink
Keep all staking-related modals in one dir
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 15, 2023
1 parent eebd8a6 commit 94c2e9c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import { Button, ModalBody, ModalFooter } from "@chakra-ui/react"
import { ModalStep } from "../../contexts"
import { TextMd } from "../shared/Typography"
import { ModalStep } from "../../../contexts"
import { TextMd } from "../../shared/Typography"

export default function StakingOverviewModal({ goNext }: ModalStep) {
export default function Overview({ goNext }: ModalStep) {
return (
<>
<ModalBody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import { Button, ModalBody } from "@chakra-ui/react"
import { ModalStep } from "../../contexts"
import { TextMd } from "../shared/Typography"
import { ModalStep } from "../../../contexts"
import { TextMd } from "../../shared/Typography"

export default function StakeModal({ goNext }: ModalStep) {
return (
Expand Down
32 changes: 32 additions & 0 deletions dapp/src/components/Modals/Staking/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react"
import { useModalFlowContext } from "../../../hooks"
import StakeForm from "./StakeForm"
import Overview from "./Overview"
import ModalBase from "../../shared/ModalBase"

function StakingSteps() {
const { activeStep, goNext } = useModalFlowContext()

switch (activeStep) {
case 1:
return <Overview goNext={goNext} />
case 2:
return <StakeForm goNext={goNext} />
default:
return null
}
}

export default function Staking({
isOpen,
onClose,
}: {
isOpen: boolean
onClose: () => void
}) {
return (
<ModalBase isOpen={isOpen} onClose={onClose} numberOfSteps={2}>
<StakingSteps />
</ModalBase>
)
}
4 changes: 2 additions & 2 deletions dapp/src/components/Overview/PositionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@chakra-ui/react"
import { BITCOIN, USD } from "../../constants"
import { Info } from "../../static/icons"
import StakingModal from "../StakingModal"
import Staking from "../Modals/Staking"

export default function PositionDetails(props: CardProps) {
const [isOpenStakingModal, stakingModal] = useBoolean()
Expand Down Expand Up @@ -44,7 +44,7 @@ export default function PositionDetails(props: CardProps) {
Unstake
</Button>
</CardFooter>
<StakingModal isOpen={isOpenStakingModal} onClose={stakingModal.off} />
<Staking isOpen={isOpenStakingModal} onClose={stakingModal.off} />
</Card>
)
}
32 changes: 0 additions & 32 deletions dapp/src/components/StakingModal/index.tsx

This file was deleted.

0 comments on commit 94c2e9c

Please sign in to comment.