hide liquidity panel (#904)
This commit is contained in:
parent
8920241c39
commit
379e736e51
|
@ -14,6 +14,8 @@ import { Col } from './layout/col'
|
|||
import { track } from 'web/lib/service/analytics'
|
||||
import { InfoTooltip } from './info-tooltip'
|
||||
import { BETTORS, PRESENT_BET } from 'common/user'
|
||||
import { buildArray } from 'common/util/array'
|
||||
import { useAdmin } from 'web/hooks/use-admin'
|
||||
|
||||
export function LiquidityPanel(props: { contract: CPMMContract }) {
|
||||
const { contract } = props
|
||||
|
@ -28,16 +30,19 @@ export function LiquidityPanel(props: { contract: CPMMContract }) {
|
|||
setShowWithdrawal(true)
|
||||
}, [showWithdrawal, lpShares])
|
||||
|
||||
const isCreator = user?.id === contract.creatorId
|
||||
const isAdmin = useAdmin()
|
||||
|
||||
if (!showWithdrawal && !isAdmin && !isCreator) return <></>
|
||||
|
||||
return (
|
||||
<Tabs
|
||||
tabs={[
|
||||
{
|
||||
title: 'Subsidize',
|
||||
tabs={buildArray(
|
||||
(isCreator || isAdmin) && {
|
||||
title: (isAdmin ? '[Admin] ' : '') + 'Subsidize',
|
||||
content: <AddLiquidityPanel contract={contract} />,
|
||||
},
|
||||
...(showWithdrawal
|
||||
? [
|
||||
{
|
||||
showWithdrawal && {
|
||||
title: 'Withdraw',
|
||||
content: (
|
||||
<WithdrawLiquidityPanel
|
||||
|
@ -46,13 +51,11 @@ export function LiquidityPanel(props: { contract: CPMMContract }) {
|
|||
/>
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
title: 'Pool',
|
||||
content: <ViewLiquidityPanel contract={contract} />,
|
||||
},
|
||||
]}
|
||||
}
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user