Updated on 2026-08-14
This commit is contained in:
parent
4dc4053869
commit
72cf995bd6
10 changed files with 64 additions and 50 deletions
|
|
@ -104,7 +104,7 @@ internal class AddStakingNotificationsTransformer(
|
|||
return prevState.copy(
|
||||
confirmationState = confirmationState.copy(
|
||||
notifications = notifications.toImmutableList(),
|
||||
isPrimaryButtonEnabled = !notifications.any { it is StakingNotification.Error },
|
||||
isPrimaryButtonEnabled = notifications.any { it is StakingNotification.Error },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
|
||||
import com.tangem.features.staking.impl.R
|
||||
import com.tangem.features.staking.impl.presentation.state.InnerConfirmationStakingState
|
||||
import com.tangem.features.staking.impl.presentation.state.StakingStates
|
||||
import com.tangem.features.staking.impl.presentation.state.TransactionDoneState
|
||||
import com.tangem.features.staking.impl.presentation.state.previewdata.ConfirmationStatePreviewData
|
||||
|
|
@ -38,7 +39,7 @@ internal fun StakingConfirmationContent(
|
|||
) {
|
||||
if (state !is StakingStates.ConfirmationState.Data) return
|
||||
val isEnterAction = type == StakingActionCommonType.ENTER
|
||||
|
||||
val isTransactionSent = state.innerState == InnerConfirmationStakingState.COMPLETED
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(TangemTheme.colors.background.secondary)
|
||||
|
|
@ -60,13 +61,13 @@ internal fun StakingConfirmationContent(
|
|||
AmountBlock(
|
||||
amountState = amountState,
|
||||
isClickDisabled = !isEnterAction,
|
||||
isEditingDisabled = !isEnterAction,
|
||||
isEditingDisabled = !isEnterAction || isTransactionSent,
|
||||
onClick = clickIntents::onPrevClick,
|
||||
)
|
||||
if (isEnterAction) {
|
||||
ValidatorBlock(validatorState = state.validatorState, onClick = clickIntents::openValidators)
|
||||
}
|
||||
StakingFeeBlock(feeState = state.feeState)
|
||||
StakingFeeBlock(feeState = state.feeState, isTransactionSent = isTransactionSent)
|
||||
NotificationsBlock(notifications = state.notifications)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,9 +121,7 @@ private fun StakingScreenContent(uiState: StakingUiState, modifier: Modifier = M
|
|||
snapshotFlow { isTransitionAnimationRunning }
|
||||
.withIndex()
|
||||
.map { (index, running) ->
|
||||
if (running && index != 0) {
|
||||
delay(timeMillis = 200)
|
||||
}
|
||||
if (running && index != 0) delay(timeMillis = 200)
|
||||
running
|
||||
}
|
||||
.first { !it }
|
||||
|
|
@ -169,6 +167,7 @@ private fun StakingScreenContent(uiState: StakingUiState, modifier: Modifier = M
|
|||
amountState = uiState.amountState,
|
||||
isBalanceHidden = uiState.isBalanceHidden,
|
||||
clickIntents = uiState.clickIntents,
|
||||
modifier = Modifier.background(TangemTheme.colors.background.secondary),
|
||||
)
|
||||
StakingStep.Confirmation -> StakingConfirmationContent(
|
||||
amountState = uiState.amountState,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ internal fun StakingValidatorListContent(
|
|||
|
||||
LazyColumn(
|
||||
contentPadding = PaddingValues(bottom = bottomBarHeight),
|
||||
modifier = modifier.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.secondary)
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
) {
|
||||
if (state is ValidatorState.Content) {
|
||||
val validators = state.availableValidators
|
||||
|
|
|
|||
|
|
@ -29,12 +29,18 @@ import com.tangem.features.staking.impl.presentation.state.FeeState
|
|||
import java.math.BigDecimal
|
||||
|
||||
@Composable
|
||||
internal fun StakingFeeBlock(feeState: FeeState) {
|
||||
internal fun StakingFeeBlock(feeState: FeeState, isTransactionSent: Boolean) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(TangemTheme.shapes.roundedCornersXMedium)
|
||||
.background(TangemTheme.colors.button.disabled)
|
||||
.background(
|
||||
if (isTransactionSent) {
|
||||
TangemTheme.colors.background.action
|
||||
} else {
|
||||
TangemTheme.colors.button.disabled
|
||||
},
|
||||
)
|
||||
.padding(TangemTheme.dimens.spacing12),
|
||||
) {
|
||||
Text(
|
||||
|
|
@ -128,6 +134,7 @@ private fun FeeBlockPreview(@PreviewParameter(FeeBlockPreviewProvider::class) va
|
|||
TangemThemePreview {
|
||||
StakingFeeBlock(
|
||||
feeState = value,
|
||||
isTransactionSent = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,8 @@ internal class StakingViewModel @Inject constructor(
|
|||
type = pendingAction?.type,
|
||||
),
|
||||
).getOrElse {
|
||||
stateController.update(AddStakingErrorTransformer(it))
|
||||
stateController.update(AddStakingErrorTransformer())
|
||||
updateNotifications(GetFeeError.UnknownError)
|
||||
return
|
||||
}
|
||||
stateController.update(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue