Updated on 2026-08-14
This commit is contained in:
parent
0d30d25bad
commit
2892c0b6a8
8 changed files with 51 additions and 59 deletions
|
|
@ -18,7 +18,7 @@ internal class StakingAnalyticSender(
|
|||
fun initialInfoScreen(value: StakingUiState) {
|
||||
val initialInfoState = value.initialInfoState as? StakingStates.InitialInfoState.Data
|
||||
val validatorState = initialInfoState?.yieldBalance as? InnerYieldBalanceState.Data
|
||||
val validatorCount = validatorState?.balance
|
||||
val validatorCount = validatorState?.balances
|
||||
?.filterNot { it.validator?.address.isNullOrBlank() }
|
||||
?.distinctBy { it.validator?.address }
|
||||
?.size ?: 0
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ internal sealed class InnerYieldBalanceState {
|
|||
val rewardsFiat: String,
|
||||
val rewardBlockType: RewardBlockType,
|
||||
val isActionable: Boolean,
|
||||
val balance: ImmutableList<BalanceState>,
|
||||
val balances: ImmutableList<BalanceState>,
|
||||
) : InnerYieldBalanceState()
|
||||
|
||||
data object Empty : InnerYieldBalanceState()
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ internal class YieldBalancesConverter(
|
|||
},
|
||||
rewardBlockType = type,
|
||||
isActionable = isActionable,
|
||||
balance = balanceToShowItems.mapBalances(),
|
||||
balances = balanceToShowItems.mapBalances(),
|
||||
)
|
||||
} else {
|
||||
InnerYieldBalanceState.Empty
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ internal object InitialStakingStatePreview {
|
|||
rewardsCrypto = "100 SOL",
|
||||
rewardBlockType = RewardBlockType.RewardUnavailable,
|
||||
isActionable = true,
|
||||
balance = persistentListOf(
|
||||
balances = persistentListOf(
|
||||
BalanceState(
|
||||
groupId = "groupId",
|
||||
title = stringReference("Binance"),
|
||||
|
|
|
|||
|
|
@ -128,18 +128,20 @@ private fun LazyListScope.activeStakingBlock(
|
|||
clickIntents: StakingClickIntents,
|
||||
isBalanceHidden: Boolean,
|
||||
) {
|
||||
val balances = (state.yieldBalance as? InnerYieldBalanceState.Data)?.balance
|
||||
if (!balances.isNullOrEmpty()) {
|
||||
item(key = STAKING_REWARD_BLOCK_KEY) {
|
||||
Column(modifier = Modifier.animateItem()) {
|
||||
StakingRewardBlock(
|
||||
yieldBalanceState = state.yieldBalance,
|
||||
onRewardsClick = clickIntents::openRewardsValidators,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
)
|
||||
SpacerH12()
|
||||
}
|
||||
val innerYieldBalanceState = state.yieldBalance as? InnerYieldBalanceState.Data ?: return
|
||||
|
||||
item(key = STAKING_REWARD_BLOCK_KEY) {
|
||||
Column(modifier = Modifier.animateItem()) {
|
||||
StakingRewardBlock(
|
||||
yieldBalanceState = state.yieldBalance,
|
||||
onRewardsClick = clickIntents::openRewardsValidators,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
)
|
||||
SpacerH12()
|
||||
}
|
||||
}
|
||||
|
||||
if (innerYieldBalanceState.balances.isNotEmpty()) {
|
||||
item(ACTIVE_STAKING_BLOCK_KEY) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.staking_your_stakes),
|
||||
|
|
@ -148,7 +150,7 @@ private fun LazyListScope.activeStakingBlock(
|
|||
modifier = Modifier
|
||||
.roundedShapeItemDecoration(
|
||||
currentIndex = 0,
|
||||
lastIndex = 1 + state.yieldBalance.balance.lastIndex,
|
||||
lastIndex = 1 + state.yieldBalance.balances.lastIndex,
|
||||
addDefaultPadding = false,
|
||||
)
|
||||
.fillMaxWidth()
|
||||
|
|
@ -162,7 +164,7 @@ private fun LazyListScope.activeStakingBlock(
|
|||
)
|
||||
}
|
||||
itemsIndexed(
|
||||
items = state.yieldBalance.balance,
|
||||
items = state.yieldBalance.balances,
|
||||
key = { _, balance ->
|
||||
// Staked balance does not have unique identifier.
|
||||
balance.toString()
|
||||
|
|
@ -177,7 +179,7 @@ private fun LazyListScope.activeStakingBlock(
|
|||
.animateItem()
|
||||
.roundedShapeItemDecoration(
|
||||
currentIndex = index + 1,
|
||||
lastIndex = state.yieldBalance.balance.lastIndex + 1,
|
||||
lastIndex = state.yieldBalance.balances.lastIndex + 1,
|
||||
addDefaultPadding = false,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue