Mp 2227 assetselect search (#782)
* feat: split perps into active and non active positions * fix: fixed the search of assets selector * fix: according to feedback
This commit is contained in:
parent
6ac7708ca5
commit
413f8c43c8
@ -87,18 +87,16 @@ export default function AssetOverlay(props: Props) {
|
||||
)
|
||||
|
||||
const [activePerpsPositions, availablePerpsMarkets] = useMemo(() => {
|
||||
const activePerpsPositions =
|
||||
account?.perps.length === 0
|
||||
? []
|
||||
: props.buyAssets.filter((assets) =>
|
||||
account?.perps.find((perp) => perp.denom === assets.denom),
|
||||
)
|
||||
const availablePerpsMarkets = props.buyAssets.filter(
|
||||
if (!account) return [[], []]
|
||||
const activePerpsPositions = assets.filter((assets) =>
|
||||
account?.perps.find((perp) => perp.denom === assets.denom),
|
||||
)
|
||||
const availablePerpsMarkets = assets.filter(
|
||||
(assets) => !activePerpsPositions.find((perp) => perp.denom === assets.denom),
|
||||
)
|
||||
|
||||
return [activePerpsPositions, availablePerpsMarkets]
|
||||
}, [props.buyAssets, account])
|
||||
}, [assets, account])
|
||||
|
||||
return (
|
||||
<Overlay
|
||||
|
Loading…
Reference in New Issue
Block a user