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, availablePerpsMarkets] = useMemo(() => {
|
||||||
const activePerpsPositions =
|
if (!account) return [[], []]
|
||||||
account?.perps.length === 0
|
const activePerpsPositions = assets.filter((assets) =>
|
||||||
? []
|
account?.perps.find((perp) => perp.denom === assets.denom),
|
||||||
: props.buyAssets.filter((assets) =>
|
)
|
||||||
account?.perps.find((perp) => perp.denom === assets.denom),
|
const availablePerpsMarkets = assets.filter(
|
||||||
)
|
|
||||||
const availablePerpsMarkets = props.buyAssets.filter(
|
|
||||||
(assets) => !activePerpsPositions.find((perp) => perp.denom === assets.denom),
|
(assets) => !activePerpsPositions.find((perp) => perp.denom === assets.denom),
|
||||||
)
|
)
|
||||||
|
|
||||||
return [activePerpsPositions, availablePerpsMarkets]
|
return [activePerpsPositions, availablePerpsMarkets]
|
||||||
}, [props.buyAssets, account])
|
}, [assets, account])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Overlay
|
<Overlay
|
||||||
|
Loading…
Reference in New Issue
Block a user