Updated on 2026-08-14
This commit is contained in:
parent
593f5b364c
commit
cc037ed347
3 changed files with 18 additions and 10 deletions
|
|
@ -174,10 +174,12 @@ class TokenItemStateConverter(
|
|||
wrappedList(apy),
|
||||
)
|
||||
}
|
||||
val isActive = currencyStatus.value.yieldSupplyStatus?.isActive ?: false
|
||||
TokenItemState.TitleState.Content(
|
||||
text = stringReference(currencyStatus.currency.name),
|
||||
hasPending = value.hasCurrentNetworkTransactions,
|
||||
earnApy = earnApyText,
|
||||
earnApyIsActive = isActive,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -186,10 +188,6 @@ class TokenItemStateConverter(
|
|||
private fun resolveEarnApy(cryptoCurrencyStatus: CryptoCurrencyStatus, apyMap: Map<String, String>): String? {
|
||||
if (apyMap.isEmpty()) return null
|
||||
|
||||
val isYieldSupplyActive = (cryptoCurrencyStatus.value as? CryptoCurrencyStatus.Loaded)
|
||||
?.yieldSupplyStatus?.isActive == true
|
||||
if (isYieldSupplyActive) return null
|
||||
|
||||
val token = cryptoCurrencyStatus.currency as? CryptoCurrency.Token ?: return null
|
||||
|
||||
return apyMap[token.yieldSupplyKey()]
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ private fun ContentTitle(state: TokenTitleState.Content, modifier: Modifier = Mo
|
|||
|
||||
YieldSupplyApyLabel(
|
||||
apy = state.earnApy,
|
||||
isActive = state.earnApyIsActive,
|
||||
modifier = Modifier.align(alignment = Alignment.CenterVertically),
|
||||
)
|
||||
}
|
||||
|
|
@ -81,18 +82,26 @@ private fun CurrencyNameText(name: String, isAvailable: Boolean, modifier: Modif
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun YieldSupplyApyLabel(apy: TextReference?, modifier: Modifier = Modifier) {
|
||||
private fun YieldSupplyApyLabel(apy: TextReference?, isActive: Boolean, modifier: Modifier = Modifier) {
|
||||
AnimatedVisibility(visible = apy != null, modifier = modifier) {
|
||||
Box(
|
||||
modifier = modifier.background(
|
||||
color = TangemTheme.colors.text.accent.copy(alpha = 0.1f),
|
||||
shape = TangemTheme.shapes.roundedCornersSmall2,
|
||||
),
|
||||
modifier = if (isActive) {
|
||||
modifier.background(
|
||||
color = TangemTheme.colors.text.accent.copy(alpha = 0.1f),
|
||||
shape = TangemTheme.shapes.roundedCornersSmall2,
|
||||
)
|
||||
} else {
|
||||
modifier
|
||||
},
|
||||
) {
|
||||
Text(
|
||||
text = apy?.resolveReference().orEmpty(),
|
||||
style = TangemTheme.typography.caption1,
|
||||
color = TangemTheme.colors.text.accent,
|
||||
color = if (isActive) {
|
||||
TangemTheme.colors.text.accent
|
||||
} else {
|
||||
TangemTheme.colors.text.tertiary
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ sealed class TokenItemState {
|
|||
val hasPending: Boolean = false,
|
||||
val isAvailable: Boolean = true,
|
||||
val earnApy: TextReference? = null,
|
||||
val earnApyIsActive: Boolean = false,
|
||||
) : TitleState()
|
||||
|
||||
data object Loading : TitleState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue