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

Always show Liquidity Pools section #2503

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
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
15 changes: 5 additions & 10 deletions centrifuge-app/src/pages/IssuerPool/Investors/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useRef } from 'react'
import { useParams } from 'react-router'
import { LoadBoundary } from '../../../components/LoadBoundary'
import { useSuitableAccounts } from '../../../utils/usePermissions'
Expand All @@ -23,19 +22,15 @@ function IssuerPoolInvestors() {
if (!poolId) throw new Error('Pool not found')

const canEditInvestors = useSuitableAccounts({ poolId, poolRole: ['InvestorAdmin'] }).length > 0
const isPoolAdmin = useSuitableAccounts({ poolId, poolRole: ['PoolAdmin'] }).length > 0

// This is a bit hacky, but when deploying a pool to a domain, the user needs to switch networks
// And when they're connected to the other network, they won't register as a pool admin anymore
const wasAdminRef = useRef(isPoolAdmin)
if (isPoolAdmin) {
wasAdminRef.current = true
}

return (
<>
{canEditInvestors && <InvestorStatus />}
{wasAdminRef.current && <LiquidityPools />}
{/*
Always render the Liquidity Pools section, because the admin needs to do actions with an EVM wallet and
won't be able to see it if we check for admin permissions.
*/}
<LiquidityPools />
</>
)
}
Loading