Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-14 19:51:58 +05:00
parent 86dc859a67
commit 006669ae0d
26 changed files with 281 additions and 87 deletions

View file

@ -3,6 +3,7 @@ package com.tangem.features.nft.component
import com.tangem.core.decompose.factory.ComponentFactory
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.nft.models.NFTAsset
@ -12,7 +13,9 @@ interface NFTDetailsBlockComponent : ComposableContentComponent {
val userWalletId: UserWalletId,
val nftAsset: NFTAsset,
val nftCollectionName: String,
val title: TextReference,
val account: Account.CryptoPortfolio?,
val isAccountsMode: Boolean,
val walletTitle: TextReference,
val isSuccessScreen: Boolean,
)

View file

@ -2,11 +2,15 @@ package com.tangem.features.nft.details.block
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.tangem.common.ui.account.AccountTitleUM
import com.tangem.common.ui.account.toUM
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.ui.extensions.getActiveIconRes
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.stringReference
import com.tangem.features.nft.component.NFTDetailsBlockComponent
import com.tangem.features.nft.details.block.ui.NFTDetailsBlock
import com.tangem.features.nft.impl.R
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
@ -16,13 +20,23 @@ class DefaultNFTDetailsBlockComponent @AssistedInject constructor(
@Assisted private val params: NFTDetailsBlockComponent.Params,
) : NFTDetailsBlockComponent, AppComponentContext by context {
private val account = params.account
@Composable
override fun Content(modifier: Modifier) {
NFTDetailsBlock(
assetName = stringReference(params.nftAsset.name.orEmpty()),
collectionName = stringReference(params.nftCollectionName),
assetImage = params.nftAsset.media?.imageUrl,
title = params.title,
accountTitleUM = if (account != null && params.isAccountsMode) {
AccountTitleUM.Account(
prefixText = resourceReference(R.string.common_from),
name = account.accountName.toUM().value,
icon = account.icon.toUM(),
)
} else {
AccountTitleUM.Text(params.walletTitle)
},
isSuccessScreen = params.isSuccessScreen,
networkIconRes = getActiveIconRes(params.nftAsset.network.rawId),
)

View file

@ -11,6 +11,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tangem.common.ui.account.AccountTitle
import com.tangem.common.ui.account.AccountTitleUM
import com.tangem.core.ui.components.SpacerWMax
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resolveReference
@ -23,7 +25,7 @@ import com.tangem.features.nft.impl.R
@Suppress("LongParameterList")
@Composable
internal fun NFTDetailsBlock(
title: TextReference,
accountTitleUM: AccountTitleUM,
assetName: TextReference,
collectionName: TextReference,
assetImage: String?,
@ -38,11 +40,7 @@ internal fun NFTDetailsBlock(
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
Text(
text = title.resolveReference(),
style = TangemTheme.typography.subtitle2,
color = TangemTheme.colors.text.tertiary,
)
AccountTitle(accountTitleUM)
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
@ -91,7 +89,7 @@ private fun NFTDetailsBlock_Preview() {
collectionName = stringReference("NFT Collection"),
assetImage = null,
networkIconRes = R.drawable.img_polygon_22,
title = stringReference("From My Wallet"),
accountTitleUM = AccountTitleUM.Text(stringReference("From My Wallet")),
isSuccessScreen = false,
)
}