Updated on 2026-08-14
This commit is contained in:
parent
de6683b57a
commit
8a81175461
4 changed files with 88 additions and 4 deletions
|
|
@ -115,9 +115,13 @@ internal class NFTCollectionsModel @Inject constructor(
|
|||
// TODO refresh all
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private fun onAssetClick(asset: NFTAsset) {
|
||||
// TODO move to details
|
||||
router.push(
|
||||
AppRoute.NFTDetails(
|
||||
userWalletId = params.userWalletId,
|
||||
nftAsset = asset,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun onReceiveClick() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.tangem.features.nft.details.entity
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.components.atoms.text.TextEllipsis
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class NFTAssetUM(
|
||||
val name: String,
|
||||
val salePrice: SalePrice,
|
||||
val description: String?,
|
||||
val rarity: Rarity?,
|
||||
val media: Media?,
|
||||
val traits: ImmutableList<BlockItem>,
|
||||
val baseInfoItems: ImmutableList<BlockItem>,
|
||||
) {
|
||||
data class Media(
|
||||
val mimetype: String?,
|
||||
val url: String,
|
||||
)
|
||||
|
||||
data class Rarity(
|
||||
val rank: String,
|
||||
val label: String,
|
||||
)
|
||||
|
||||
data class BlockItem(
|
||||
val title: TextReference,
|
||||
val titleTextEllipsis: TextEllipsis = TextEllipsis.End,
|
||||
val value: String,
|
||||
val valueTextEllipsis: TextEllipsis = TextEllipsis.End,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
sealed class SalePrice {
|
||||
data object Loading : SalePrice()
|
||||
data object Empty : SalePrice()
|
||||
data class Content(val value: String, val fiatValue: String) : SalePrice()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
package com.tangem.features.nft.details.entity
|
||||
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
|
||||
internal data class NFTDetailsUM(
|
||||
val nftAsset: NFTAssetUM,
|
||||
val onBackClick: () -> Unit,
|
||||
val onReadMoreClick: () -> Unit,
|
||||
val onSeeAllClick: () -> Unit,
|
||||
val onExploreClick: () -> Unit,
|
||||
val onSendClick: () -> Unit,
|
||||
val bottomSheetConfig: TangemBottomSheetConfig?,
|
||||
)
|
||||
|
|
@ -5,8 +5,10 @@ import com.tangem.core.decompose.model.Model
|
|||
import com.tangem.core.decompose.model.ParamsContainer
|
||||
import com.tangem.core.decompose.navigation.Router
|
||||
import com.tangem.features.nft.component.NFTDetailsComponent
|
||||
import com.tangem.features.nft.details.entity.NFTAssetUM
|
||||
import com.tangem.features.nft.details.entity.NFTDetailsUM
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.coroutines.flow.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -17,16 +19,46 @@ internal class NFTDetailsModel @Inject constructor(
|
|||
paramsContainer: ParamsContainer,
|
||||
) : Model() {
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private val params: NFTDetailsComponent.Params = paramsContainer.require()
|
||||
|
||||
val state: StateFlow<NFTDetailsUM> get() = _state
|
||||
|
||||
private val _state = MutableStateFlow(
|
||||
value = NFTDetailsUM(
|
||||
nftAsset = NFTAssetUM(
|
||||
name = "",
|
||||
salePrice = NFTAssetUM.SalePrice.Empty,
|
||||
description = null,
|
||||
rarity = null,
|
||||
media = null,
|
||||
traits = persistentListOf(),
|
||||
baseInfoItems = persistentListOf(),
|
||||
),
|
||||
onBackClick = ::navigateBack,
|
||||
onReadMoreClick = ::onReadMoreClick,
|
||||
onSeeAllClick = ::onSeeAllClick,
|
||||
onExploreClick = ::onExploreClick,
|
||||
onSendClick = ::onSendClick,
|
||||
bottomSheetConfig = null,
|
||||
),
|
||||
)
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private val params: NFTDetailsComponent.Params = paramsContainer.require()
|
||||
private fun onReadMoreClick() {
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
private fun onSeeAllClick() {
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
private fun onExploreClick() {
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
private fun onSendClick() {
|
||||
// TODO implement
|
||||
}
|
||||
|
||||
private fun navigateBack() {
|
||||
router.pop()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue