Skip to content

Commit

Permalink
feat: add dashed line to indicate trigger ratio on healthbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaran- committed Sep 20, 2023
1 parent 6c9c926 commit 5b7ffdc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/components/IntentInidcator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ export const Indicator = ({
'w-3 h-3': size === 'lg',
}
)
console.log('classnames', names)
return <div className={names} data-testid="indicator" />
}
3 changes: 3 additions & 0 deletions src/hooks/use-market-liquidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const MarketLpDocument = gql`
}
}
}
liquidityMonitoringParameters {
triggeringRatio
}
}
}
${LiquidityProvisionFieldsFragmentDoc}
Expand Down
25 changes: 16 additions & 9 deletions src/pages/liquidity-provision/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ const MarketsLiquidity = () => {
)
const status = params.data.node.data.marketTradingMode
const intent = intentForStatus(status)
console.log('intentForStatus: ', intent)
return (
<div>
<Indicator variant={intent} />
Expand Down Expand Up @@ -355,22 +354,29 @@ const MarketsLiquidity = () => {
headerName={t('Market Status')}
field={'node.data.marketTradingMode'}
cellRenderer={(params) => {
const { data, loading, error } = useMarketLiquidityProviders(
const {
data: marketWithLiquidityData,
loading,
error,
} = useMarketLiquidityProviders(
params.data.node.data.market.id
)

if (loading) return null
if (data) {
if (marketWithLiquidityData) {
const targetStake = params.data.node.data.targetStake
const settlementAssetDecimals =
data.market.tradableInstrument.instrument.product
.settlementAsset.decimals
marketWithLiquidityData.market.tradableInstrument
.instrument.product.settlementAsset.decimals
const feeLevels = getFeeLevels(
data.market?.liquidityProvisionsConnection?.edges || []
marketWithLiquidityData.market
?.liquidityProvisionsConnection?.edges || []
)

const tradingMode = params.data.node.data.marketTradingMode
const auctionTrigger = params.data.node.data.auctionTrigger
const auctionTrigger =
marketWithLiquidityData.market
.liquidityMonitoringParameters.triggeringRatio
const tradingModeLabel = getStatus(
tradingMode,
auctionTrigger
Expand All @@ -385,6 +391,7 @@ const MarketsLiquidity = () => {
decimals={settlementAssetDecimals}
levels={feeLevels}
intent={intent}
triggerRatio={auctionTrigger}
/>
</div>
)
Expand All @@ -408,8 +415,8 @@ const percentageLiquidity = (suppliedStake, targetStake) => {
const display = Number.isNaN(roundedPercentage)
? 'N/A'
: roundedPercentage > 100
? '>100%'
: formatNumberPercentage(toBigNum(roundedPercentage, 0), 0)
? '>100%'
: formatNumberPercentage(toBigNum(roundedPercentage, 0), 0)
return display
}

Expand Down

0 comments on commit 5b7ffdc

Please sign in to comment.