Skip to content

Commit

Permalink
Fix the Unmint page layout
Browse files Browse the repository at this point in the history
  • Loading branch information
r-czajkowski committed Jul 13, 2023
1 parent f70948c commit f35c091
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
18 changes: 3 additions & 15 deletions src/pages/tBTC/Bridge/Mint.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import { useEffect } from "react"
import { Outlet } from "react-router"
import { useWeb3React } from "@web3-react/core"
import { H5 } from "@threshold-network/components"
import { PageComponent } from "../../../types"
import { DepositDetails } from "./DepositDetails"
import { ResumeDepositPage } from "./ResumeDeposit"
import { MintingTimeline } from "./Minting/MintingTimeline"
import {
useFetchRecentDeposits,
useTBTCDepositDataFromLocalStorage,
} from "../../../hooks/tbtc"
import { useTBTCDepositDataFromLocalStorage } from "../../../hooks/tbtc"
import { useTbtcState } from "../../../hooks/useTbtcState"
import { isSameETHAddress } from "../../../web3/utils"
import { MintingFlowRouter } from "./Minting/MintingFlowRouter"
import { useFetchTvl } from "../../../hooks/useFetchTvl"
import { BridgeProcessCardTitle } from "./components/BridgeProcessCardTitle"
import SubmitTxButton from "../../../components/SubmitTxButton"
import {
ProtocolHistoryRecentDeposits,
ProtocolHistoryTitle,
ProtocolHistoryViewMoreLink,
TVL,
} from "../../../components/tBTC"

import {
BridgeLayout,
BridgeLayoutAsideSection,
Expand Down Expand Up @@ -88,7 +76,7 @@ const MintPageLayout: PageComponent = () => {
{active ? (
<Outlet />
) : (
<BridgeProcessEmptyState title="Ready to mint tTBC?" />
<BridgeProcessEmptyState title="Ready to mint tBTC?" />
)}
</BridgeLayoutMainSection>
<BridgeLayoutAsideSection>
Expand Down
20 changes: 17 additions & 3 deletions src/pages/tBTC/Bridge/Unmint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ UnmintFormPage.route = {
isPageEnabled: true,
}

export const UnmintPage: PageComponent = ({}) => {
export const UnmintPageLayout: PageComponent = ({}) => {
const { active } = useWeb3React()

return (
Expand All @@ -297,7 +297,10 @@ export const UnmintPage: PageComponent = ({}) => {
{active ? (
<Outlet />
) : (
<BridgeProcessEmptyState title="Ready to unmit tBTC?" />
<BridgeProcessEmptyState
title="Ready to unmit tBTC?"
bridgeProcess="unmint"
/>
)}
</BridgeLayoutMainSection>
<BridgeLayoutAsideSection>
Expand All @@ -307,11 +310,22 @@ export const UnmintPage: PageComponent = ({}) => {
)
}

UnmintPageLayout.route = {
path: "",
index: false,
isPageEnabled: true,
pages: [UnmintFormPage],
}

export const UnmintPage: PageComponent = () => {
return <Outlet />
}

UnmintPage.route = {
path: "unmint",
pathOverride: "unmint/*",
index: true,
title: "Unmint",
pages: [UnmintFormPage, UnmintDetails],
pages: [UnmintPageLayout, UnmintDetails],
isPageEnabled: true,
}
8 changes: 6 additions & 2 deletions src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import {
} from "../../../../components/tBTC"
import { useFetchRecentDeposits } from "../../../../hooks/tbtc"
import { useFetchTvl } from "../../../../hooks/useFetchTvl"
import { BridgeProcess } from "../../../../types"

export const BridgeProcessEmptyState: FC<{ title: string }> = ({ title }) => {
export const BridgeProcessEmptyState: FC<{
title: string
bridgeProcess?: BridgeProcess
}> = ({ title, bridgeProcess = "mint" }) => {
const [tvlInUSD, fetchTvl, tvl] = useFetchTvl()
const [deposits] = useFetchRecentDeposits(3)

Expand All @@ -21,7 +25,7 @@ export const BridgeProcessEmptyState: FC<{ title: string }> = ({ title }) => {

return (
<>
<BridgeProcessCardTitle />
<BridgeProcessCardTitle bridgeProcess={bridgeProcess} />
<H5 align={"center"}>{title}</H5>
<SubmitTxButton mb="6" mt="4" />
<TVL tvl={tvl.tBTC} tvlInUSD={tvlInUSD.tBTC} />
Expand Down

0 comments on commit f35c091

Please sign in to comment.