Updated on 2026-08-14
This commit is contained in:
parent
0bd68de818
commit
546a9decb0
7 changed files with 42 additions and 20 deletions
|
|
@ -96,21 +96,33 @@ internal class DefaultNFTRuntimeStore(
|
|||
|
||||
private fun NFTCollections.Content.Collections.mergeWithPrices(prices: Map<NFTAsset.Identifier, NFTSalePrice>) =
|
||||
copy(
|
||||
collections = this.collections?.map { data ->
|
||||
data.copy(
|
||||
assets = when (val assets = data.assets) {
|
||||
collections = this.collections
|
||||
?.map { data ->
|
||||
val assets = when (val assets = data.assets) {
|
||||
is NFTCollection.Assets.Empty,
|
||||
is NFTCollection.Assets.Loading,
|
||||
is NFTCollection.Assets.Failed,
|
||||
-> assets
|
||||
is NFTCollection.Assets.Value -> assets.copy(
|
||||
items = assets.items.map { asset ->
|
||||
asset.mergeWithPrice(prices[asset.id] ?: NFTSalePrice.Empty(asset.id))
|
||||
},
|
||||
items = assets.items
|
||||
.filter { !it.name.isNullOrEmpty() }
|
||||
.sortedBy { it.name }
|
||||
.map { asset ->
|
||||
asset.mergeWithPrice(prices[asset.id] ?: NFTSalePrice.Empty(asset.id))
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
}
|
||||
val assetsCount = when (assets) {
|
||||
is NFTCollection.Assets.Value -> assets.items.size
|
||||
else -> data.count
|
||||
}
|
||||
data.copy(
|
||||
assets = assets,
|
||||
count = assetsCount,
|
||||
)
|
||||
}
|
||||
?.filter { it.count > 0 }
|
||||
?.sortedBy { it.name },
|
||||
source = this.source,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue