Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-07 20:23:54 +05:00
parent 0c55931ddc
commit 7f17dfa2e3
6 changed files with 15 additions and 45 deletions

View file

@ -21,10 +21,10 @@ import com.tangem.core.ui.components.ResizableText
import com.tangem.core.ui.components.currency.icon.CurrencyIcon import com.tangem.core.ui.components.currency.icon.CurrencyIcon
import com.tangem.core.ui.format.bigdecimal.anyDecimals import com.tangem.core.ui.format.bigdecimal.anyDecimals
import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.crypto
import com.tangem.core.ui.format.bigdecimal.fiat
import com.tangem.core.ui.format.bigdecimal.format import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.utils.BigDecimalFormatter
import java.math.BigDecimal import java.math.BigDecimal
@Composable @Composable
@ -33,15 +33,11 @@ fun AmountBlock(amountState: AmountState, isClickDisabled: Boolean, isEditingDis
val amount = amountState.amountTextField val amount = amountState.amountTextField
val cryptoAmount = formatWithSymbol(amount.value, amount.cryptoAmount.currencySymbol) val cryptoAmount = formatWithSymbol(amount.value, amount.cryptoAmount.currencySymbol)
val fiatAmount = BigDecimalFormatter.formatFiatAmount( val fiatAmount = amount.fiatAmount.value.format {
fiatAmount = amount.fiatAmount.value, fiat(
fiatCurrencySymbol = amount.fiatAmount.currencySymbol, fiatCurrencySymbol = amount.fiatAmount.currencySymbol,
fiatCurrencyCode = amountState.appCurrencyCode, fiatCurrencyCode = amountState.appCurrencyCode,
) )
val backgroundColor = if (isEditingDisabled) {
TangemTheme.colors.button.disabled
} else {
TangemTheme.colors.background.action
} }
val (firstAmount, secondAmount) = if (amount.isFiatValue) { val (firstAmount, secondAmount) = if (amount.isFiatValue) {
@ -54,7 +50,7 @@ fun AmountBlock(amountState: AmountState, isClickDisabled: Boolean, isEditingDis
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier modifier = Modifier
.clip(TangemTheme.shapes.roundedCornersXMedium) .clip(TangemTheme.shapes.roundedCornersXMedium)
.background(backgroundColor) .background(TangemTheme.colors.background.action)
.clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick) .clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick)
.padding(TangemTheme.dimens.spacing16), .padding(TangemTheme.dimens.spacing16),
) { ) {

View file

@ -23,19 +23,13 @@ internal fun DestinationBlock(
isEditingDisabled: Boolean, isEditingDisabled: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
val destinationUM = destinationUM as? DestinationUM.Content ?: return if (destinationUM !is DestinationUM.Content) return
val backgroundColor = if (isEditingDisabled) {
TangemTheme.colors.button.disabled
} else {
TangemTheme.colors.background.action
}
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(TangemTheme.shapes.roundedCornersXMedium) .clip(TangemTheme.shapes.roundedCornersXMedium)
.background(backgroundColor) .background(TangemTheme.colors.background.action)
.clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick) .clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick)
.padding(TangemTheme.dimens.spacing12), .padding(TangemTheme.dimens.spacing12),
) { ) {

View file

@ -32,17 +32,11 @@ internal fun FeeBlock(feeUM: FeeUM, isClickEnabled: Boolean, onClick: () -> Unit
val feeSelectorUM = feeUM.feeSelectorUM as? FeeSelectorUM.Content val feeSelectorUM = feeUM.feeSelectorUM as? FeeSelectorUM.Content
val isEditingDisabled = feeSelectorUM?.fees is TransactionFee.Single val isEditingDisabled = feeSelectorUM?.fees is TransactionFee.Single
val backgroundColor = if (isEditingDisabled) {
TangemTheme.colors.button.disabled
} else {
TangemTheme.colors.background.action
}
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(TangemTheme.shapes.roundedCornersXMedium) .clip(TangemTheme.shapes.roundedCornersXMedium)
.background(backgroundColor) .background(TangemTheme.colors.background.action)
.clickable(enabled = isClickEnabled && !isEditingDisabled, onClick = onClick) .clickable(enabled = isClickEnabled && !isEditingDisabled, onClick = onClick)
.padding(12.dp), .padding(12.dp),
) { ) {

View file

@ -29,17 +29,11 @@ internal fun RecipientBlock(
isEditingDisabled: Boolean, isEditingDisabled: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
val backgroundColor = if (isEditingDisabled) {
TangemTheme.colors.button.disabled
} else {
TangemTheme.colors.background.action
}
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(TangemTheme.shapes.roundedCornersXMedium) .clip(TangemTheme.shapes.roundedCornersXMedium)
.background(backgroundColor) .background(TangemTheme.colors.background.action)
.clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick) .clickable(enabled = !isClickDisabled && !isEditingDisabled, onClick = onClick)
.padding(TangemTheme.dimens.spacing12), .padding(TangemTheme.dimens.spacing12),
) { ) {

View file

@ -71,7 +71,7 @@ internal fun StakingConfirmationContent(
isClickable = !isTransactionInProgress, isClickable = !isTransactionInProgress,
onClick = clickIntents::openValidators, onClick = clickIntents::openValidators,
) )
StakingFeeBlock(feeState = state.feeState, isTransactionSent = isTransactionSent) StakingFeeBlock(feeState = state.feeState)
NotificationsBlock(notifications = state.notifications) NotificationsBlock(notifications = state.notifications)
Spacer(Modifier) Spacer(Modifier)
} }

View file

@ -32,17 +32,12 @@ import com.tangem.features.staking.impl.presentation.state.FeeState
import java.math.BigDecimal import java.math.BigDecimal
@Composable @Composable
internal fun StakingFeeBlock(feeState: FeeState, isTransactionSent: Boolean) { internal fun StakingFeeBlock(feeState: FeeState) {
val backgroundColor = if (isTransactionSent) {
TangemTheme.colors.background.action
} else {
TangemTheme.colors.button.disabled
}
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(TangemTheme.shapes.roundedCornersXMedium) .clip(TangemTheme.shapes.roundedCornersXMedium)
.background(backgroundColor) .background(TangemTheme.colors.background.action)
.padding(TangemTheme.dimens.spacing12), .padding(TangemTheme.dimens.spacing12),
) { ) {
Text( Text(
@ -144,10 +139,7 @@ private fun BoxScope.FeeError(feeState: FeeState) {
@Composable @Composable
private fun FeeBlockPreview(@PreviewParameter(FeeBlockPreviewProvider::class) value: FeeState) { private fun FeeBlockPreview(@PreviewParameter(FeeBlockPreviewProvider::class) value: FeeState) {
TangemThemePreview { TangemThemePreview {
StakingFeeBlock( StakingFeeBlock(feeState = value)
feeState = value,
isTransactionSent = false,
)
} }
} }