From 379e736e514d4e5967974bb611c5e5b5c85463c9 Mon Sep 17 00:00:00 2001
From: mantikoros <95266179+mantikoros@users.noreply.github.com>
Date: Tue, 20 Sep 2022 15:57:27 -0500
Subject: [PATCH] hide liquidity panel (#904)
---
web/components/liquidity-panel.tsx | 39 ++++++++++++++++--------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/web/components/liquidity-panel.tsx b/web/components/liquidity-panel.tsx
index 58f57a8a..7e216be5 100644
--- a/web/components/liquidity-panel.tsx
+++ b/web/components/liquidity-panel.tsx
@@ -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,31 +30,32 @@ 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 (
,
},
- ...(showWithdrawal
- ? [
- {
- title: 'Withdraw',
- content: (
-
- ),
- },
- ]
- : []),
+ showWithdrawal && {
+ title: 'Withdraw',
+ content: (
+
+ ),
+ },
{
title: 'Pool',
content: ,
- },
- ]}
+ }
+ )}
/>
)
}