Updated on 2026-08-14
This commit is contained in:
parent
3f55454b65
commit
61d5ef1dc0
44 changed files with 798 additions and 341 deletions
|
|
@ -117,7 +117,7 @@ internal class SetInitialDataStateTransformer(
|
|||
startText = TextReference.Res(R.string.staking_details_annual_percentage_rate),
|
||||
endText = getAprRange(validators),
|
||||
iconClick = { clickIntents.onInfoClick(InfoType.ANNUAL_PERCENTAGE_RATE) },
|
||||
isEndTextHighlighted = true,
|
||||
isEndTextHighlighted = false,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ import com.tangem.core.ui.format.bigdecimal.format
|
|||
import com.tangem.core.ui.format.bigdecimal.percent
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.features.staking.impl.R
|
||||
import com.tangem.features.staking.impl.presentation.state.StakingStates
|
||||
import com.tangem.features.staking.impl.presentation.model.StakingClickIntents
|
||||
import com.tangem.features.staking.impl.presentation.state.BalanceState
|
||||
import com.tangem.features.staking.impl.presentation.state.StakingStates
|
||||
import com.tangem.utils.extensions.orZero
|
||||
|
||||
@Composable
|
||||
|
|
@ -37,16 +38,7 @@ internal fun StakingClaimRewardsValidatorContent(
|
|||
key(item.title.resolveReference() + index) {
|
||||
InputRowImageInfo(
|
||||
subtitle = item.title,
|
||||
caption = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
annotatedReference {
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = item.validator?.apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
),
|
||||
caption = item.getAprTextNeutral(),
|
||||
infoTitle = item.formattedFiatAmount,
|
||||
infoSubtitle = item.formattedCryptoAmount,
|
||||
imageUrl = item.validator?.image.orEmpty(),
|
||||
|
|
@ -64,4 +56,26 @@ internal fun StakingClaimRewardsValidatorContent(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For FCA fixes remove coloring for now
|
||||
*/
|
||||
@Suppress("UnusedPrivateMember")
|
||||
@Composable
|
||||
private fun BalanceState.getAprTextColored() = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
annotatedReference {
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = validator?.apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun BalanceState.getAprTextNeutral() = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
stringReference(" " + validator?.apr.orZero().format { percent() }),
|
||||
)
|
||||
|
|
@ -264,7 +264,7 @@ private fun ActiveStakingBlock(
|
|||
val (icon, iconTint) = balance.type.getIcon()
|
||||
InputRowImageInfo(
|
||||
subtitle = balance.title,
|
||||
caption = balance.subtitle ?: balance.getAprText(),
|
||||
caption = balance.subtitle ?: balance.getAprTextNeutral(),
|
||||
infoTitle = balance.formattedFiatAmount.orMaskWithStars(isBalanceHidden),
|
||||
infoSubtitle = balance.formattedCryptoAmount.orMaskWithStars(isBalanceHidden),
|
||||
imageUrl = balance.getImage(),
|
||||
|
|
@ -301,8 +301,12 @@ private fun StakeButtonBlock(buttonState: NavigationButtonsState) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For FCA fixes remove coloring for now
|
||||
*/
|
||||
@Suppress("UnusedPrivateMember")
|
||||
@Composable
|
||||
private fun BalanceState.getAprText() = combinedReference(
|
||||
private fun BalanceState.getAprTextColored() = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
annotatedReference {
|
||||
appendSpace()
|
||||
|
|
@ -313,6 +317,12 @@ private fun BalanceState.getAprText() = combinedReference(
|
|||
},
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun BalanceState.getAprTextNeutral() = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
stringReference(" " + validator?.apr.orZero().format { percent() }),
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun BalanceType.getIcon() = when (this) {
|
||||
BalanceType.UNSTAKING -> R.drawable.ic_connection_18 to TangemTheme.colors.icon.accent
|
||||
|
|
|
|||
|
|
@ -27,11 +27,12 @@ import com.tangem.core.ui.format.bigdecimal.format
|
|||
import com.tangem.core.ui.format.bigdecimal.percent
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.domain.staking.model.stakekit.Yield
|
||||
import com.tangem.features.staking.impl.R
|
||||
import com.tangem.features.staking.impl.presentation.model.StakingClickIntents
|
||||
import com.tangem.features.staking.impl.presentation.state.StakingStates
|
||||
import com.tangem.features.staking.impl.presentation.state.previewdata.ValidatorStatePreviewData
|
||||
import com.tangem.features.staking.impl.presentation.state.stub.StakingClickIntentsStub
|
||||
import com.tangem.features.staking.impl.presentation.model.StakingClickIntents
|
||||
import com.tangem.utils.extensions.orZero
|
||||
|
||||
/**
|
||||
|
|
@ -62,16 +63,7 @@ internal fun StakingValidatorListContent(
|
|||
|
||||
InputRowImageSelector(
|
||||
subtitle = stringReference(item.name),
|
||||
caption = combinedReference(
|
||||
resourceReference(R.string.staking_details_annual_percentage_rate),
|
||||
annotatedReference {
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = item.apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
),
|
||||
caption = item.getAprTextNeutral(),
|
||||
imageUrl = item.image.orEmpty(),
|
||||
isSelected = item == state.chosenValidator,
|
||||
onSelect = { clickIntents.onValidatorSelect(item) },
|
||||
|
|
@ -108,6 +100,28 @@ internal fun StakingValidatorListContent(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For FCA fixes remove coloring for now
|
||||
*/
|
||||
@Suppress("UnusedPrivateMember")
|
||||
@Composable
|
||||
private fun Yield.Validator.getAprTextColored() = combinedReference(
|
||||
resourceReference(R.string.staking_details_annual_percentage_rate),
|
||||
annotatedReference {
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun Yield.Validator.getAprTextNeutral() = combinedReference(
|
||||
resourceReference(R.string.staking_details_annual_percentage_rate),
|
||||
stringReference(" " + apr.orZero().format { percent() }),
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun RowScope.ValidatorLabel(isStrategicPartner: Boolean) {
|
||||
if (isStrategicPartner) {
|
||||
|
|
|
|||
|
|
@ -40,16 +40,30 @@ internal fun ValidatorBlock(validatorState: StakingStates.ValidatorState, isClic
|
|||
InputRowImageInfo(
|
||||
title = resourceReference(R.string.staking_validator),
|
||||
subtitle = stringReference(state.chosenValidator.name),
|
||||
infoTitle = annotatedReference {
|
||||
append(resourceReference(R.string.staking_details_apr).resolveReference())
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = state.chosenValidator.apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
infoTitle = state.getInfoTitleNeutral(),
|
||||
imageUrl = state.chosenValidator.image.orEmpty(),
|
||||
onImageError = { ValidatorImagePlaceholder() },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For FCA fixes remove coloring for now
|
||||
*/
|
||||
@Suppress("UnusedPrivateMember")
|
||||
@Composable
|
||||
private fun StakingStates.ValidatorState.Data.getInfoTitleColored() = combinedReference(
|
||||
annotatedReference {
|
||||
append(resourceReference(R.string.staking_details_apr).resolveReference())
|
||||
appendSpace()
|
||||
appendColored(
|
||||
text = chosenValidator.apr.orZero().format { percent() },
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
private fun StakingStates.ValidatorState.Data.getInfoTitleNeutral() = combinedReference(
|
||||
resourceReference(R.string.staking_details_apr),
|
||||
stringReference(" " + chosenValidator.apr.orZero().format { percent() }),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue