-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tidy up quote, fix quote errors
- Loading branch information
1 parent
73951fd
commit fe1978f
Showing
34 changed files
with
580 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import Alert from '@lyra/ui/components/Alert' | ||
import { IconType } from '@lyra/ui/components/Icon' | ||
import { MarginProps } from '@lyra/ui/types' | ||
import formatTruncatedDuration from '@lyra/ui/utils/formatTruncatedDuration' | ||
import { Board } from '@lyrafinance/lyra-js' | ||
import React from 'react' | ||
|
||
import { MAX_UTILIZATION, OptionQuotesNullable, StrikeQuotesNullable } from '@/app/constants/contracts' | ||
import { TRADING_CUTOFF_DOC_URL } from '@/app/constants/links' | ||
|
||
type Props = { | ||
board: Board | ||
isGlobalPaused: boolean | ||
quotes: (StrikeQuotesNullable | OptionQuotesNullable)[] | ||
} & MarginProps | ||
|
||
export default function TradeBoardNoticeSection({ board, isGlobalPaused, quotes, ...marginProps }: Props) { | ||
const market = board.market() | ||
if (board.isTradingCutoff || board.isExpired) { | ||
return ( | ||
<Alert | ||
icon={IconType.AlertTriangle} | ||
title="Trading Cutoff" | ||
variant="default" | ||
description={`Trading ends ${formatTruncatedDuration( | ||
board.expiryTimestamp - board.tradingCutoffTimestamp | ||
)} before | ||
expiration. Traders can still close their positions for this expiry.`} | ||
linkHref={TRADING_CUTOFF_DOC_URL} | ||
{...marginProps} | ||
/> | ||
) | ||
} else if (isGlobalPaused || board.isPaused) { | ||
return ( | ||
<Alert | ||
icon={IconType.AlertTriangle} | ||
title="Trading Paused" | ||
variant="warning" | ||
description={isGlobalPaused ? 'Trading is paused.' : `Trading for the ${market.name} market is paused.`} | ||
{...marginProps} | ||
/> | ||
) | ||
} else if (market.liquidity.utilization >= MAX_UTILIZATION) { | ||
return ( | ||
<Alert | ||
icon={IconType.AlertTriangle} | ||
title="High Utilization" | ||
variant="warning" | ||
description={`The ${market.name} market is ${ | ||
market.liquidity.utilization === 1 ? 'fully utilized' : 'almost fully utilized' | ||
}. When a vault is fully utilized new positions can be opened. Traders can still close their ${ | ||
market.name | ||
} positions.`} | ||
{...marginProps} | ||
/> | ||
) | ||
} else if (!quotes.length) { | ||
return ( | ||
<Alert | ||
icon={IconType.Info} | ||
title="No Available Strikes" | ||
description="This expiry has no available strikes in delta range. Traders can still close their positions for this expiry." | ||
linkHref={TRADING_CUTOFF_DOC_URL} | ||
{...marginProps} | ||
/> | ||
) | ||
} else { | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.