Skip to content

Commit

Permalink
Fix link to internal onboarding if no external URL is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
sophialittlejohn committed Oct 15, 2024
1 parent f0184db commit 616caf1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions centrifuge-app/src/pages/Pool/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useWallet } from '@centrifuge/centrifuge-react'
import { Box, Button, Card, Grid, TextWithPlaceholder } from '@centrifuge/fabric'
import Decimal from 'decimal.js-light'
import * as React from 'react'
import { useParams } from 'react-router'
import { useNavigate, useParams } from 'react-router'
import styled, { useTheme } from 'styled-components'
import { InvestRedeemContext, InvestRedeemProvider } from '../../../../src/components/InvestRedeem/InvestRedeemProvider'
import { InvestRedeemProps } from '../../../components/InvestRedeem/InvestRedeem'
Expand Down Expand Up @@ -155,6 +155,7 @@ export function InvestButton(props: InvestRedeemProps) {
const [open, setOpen] = React.useState(false)
const connectAndOpen = useConnectBeforeAction(() => setOpen(true))
const { connectedType, showNetworks } = useWallet()
const navigate = useNavigate()

const getButtonText = (state: any) => {
if (!state.isAllowedToInvest && connectedType !== null) {
Expand All @@ -181,7 +182,9 @@ export function InvestButton(props: InvestRedeemProps) {
<Button
onClick={() => {
if (!state.isAllowedToInvest && connectedType !== null) {
window.open(metadata?.onboarding?.externalOnboardingUrl)
metadata?.onboarding?.externalOnboardingUrl
? window.open(metadata?.onboarding?.externalOnboardingUrl)
: navigate(`/onboarding?poolId=${poolId}&trancheId=${trancheId}`)
} else if (connectedType === null) {
showNetworks()
} else {
Expand Down

0 comments on commit 616caf1

Please sign in to comment.