unset is luna on marketConfig change

This commit is contained in:
tjs 2022-05-12 13:52:50 -04:00
parent 9a83a22239
commit 3139c7ed95
1 changed files with 22 additions and 15 deletions

View File

@ -168,6 +168,16 @@ export default function AdvancedTradeForm({
}
}, [tradeType, set])
useEffect(() => {
if (marketConfig.baseSymbol == 'LUNA') {
setIsLuna(true)
setReduceOnly(true)
} else {
setIsLuna(false)
setReduceOnly(false)
}
}, [marketConfig])
useEffect(() => {
let condition
switch (tradeType) {
@ -224,11 +234,6 @@ export default function AdvancedTradeForm({
: availableBalance
}
if (marketConfig.baseSymbol == 'LUNA') {
setIsLuna(true)
setReduceOnly(true)
}
const {
max: maxQuote,
deposits,
@ -787,16 +792,18 @@ export default function AdvancedTradeForm({
<span className="ml-2 rounded border border-th-primary px-1 py-0.5 text-xs text-th-primary">
{initLeverage}x
</span>
{ isLuna ? (<Tooltip
content={
<div className="text-center">
LUNA is currently in reduce only mode. No new positions may be entered.
</div>
}
>
<ExclamationIcon className="ml-2 h-5 w-5 text-th-primary" />
</Tooltip>) : null }
{isLuna ? (
<Tooltip
content={
<div className="text-center">
LUNA is currently in reduce only mode. No new positions may be
entered.
</div>
}
>
<ExclamationIcon className="ml-2 h-5 w-5 text-th-primary" />
</Tooltip>
) : null}
</ElementTitle>
{insufficientSol ? (
<div className="mb-3 text-left">