Skip to content

Commit

Permalink
fix: update check for price button rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelxuwu authored May 18, 2023
1 parent be60493 commit 468a462
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions app/src/components/trade/TradeChainTable/TradeChainPriceButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,24 @@ export default function TradeChainPriceButton({
onSelected = emptyFunction,
...styleProps
}: Props): ButtonElement {
return quote ? (
return quote && (!quote.disabledReason || (quote.disabledReason && !getIsQuoteHidden(quote.disabledReason))) ? (
<Button
width={getPriceColumnWidth(quote.market())}
variant={quote?.isBuy ? 'primary' : 'error'}
size="small"
isOutline={!isSelected}
isDisabled={!quote ? true : quote.disabledReason ? getIsQuoteHidden(quote.disabledReason) : false}
isDisabled={quote.disabledReason ? getIsQuoteHidden(quote.disabledReason) : false}
label={
quote && !quote?.disabledReason ? (
<Box p="1px">
<Text variant="body" textAlign="left">
{formatUSD(quote.premium)}
</Text>
<Text textAlign="left" variant="small" color={!quote || isSelected ? 'inherit' : 'secondaryText'}>
{formatPercentage(fromBigNumber(quote.iv), true)}
</Text>
</Box>
) : null
<Box p="1px">
<Text variant="body" textAlign="left">
{formatUSD(quote.premium)}
</Text>
<Text textAlign="left" variant="small" color={!quote || isSelected ? 'inherit' : 'secondaryText'}>
{formatPercentage(fromBigNumber(quote.iv), true)}
</Text>
</Box>
}
rightIcon={quote && !quote.disabledReason ? (!isSelected ? IconType.Plus : IconType.Check) : null}
rightIcon={!isSelected ? IconType.Plus : IconType.Check}
rightIconSpacing={1}
showRightIconSeparator
onClick={() => onSelected(!isSelected)}
Expand Down

0 comments on commit 468a462

Please sign in to comment.