Updated on 2026-08-14
This commit is contained in:
parent
5a09e48a53
commit
e7f862423d
11 changed files with 52 additions and 16 deletions
|
|
@ -62,6 +62,7 @@ private fun getTextColorByType(type: AuditLabelUM.Type): Color {
|
|||
AuditLabelUM.Type.Warning -> TangemTheme.colors.text.attention
|
||||
AuditLabelUM.Type.Permit -> TangemTheme.colors.text.accent
|
||||
AuditLabelUM.Type.Info -> TangemTheme.colors.text.primary2
|
||||
AuditLabelUM.Type.General -> TangemTheme.colors.text.secondary
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +74,7 @@ private fun getBackgroundColorByType(type: AuditLabelUM.Type): Color {
|
|||
AuditLabelUM.Type.Warning -> TangemTheme.colors.text.attention.copy(alpha = 0.1f)
|
||||
AuditLabelUM.Type.Permit -> TangemTheme.colors.text.accent.copy(alpha = 0.1f)
|
||||
AuditLabelUM.Type.Info -> TangemTheme.colors.text.accent
|
||||
AuditLabelUM.Type.General -> TangemTheme.colors.control.default
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +85,7 @@ private fun getPaddingByType(type: AuditLabelUM.Type): PaddingValues {
|
|||
AuditLabelUM.Type.Prohibition,
|
||||
AuditLabelUM.Type.Warning,
|
||||
AuditLabelUM.Type.Permit,
|
||||
AuditLabelUM.Type.General,
|
||||
-> PaddingValues(horizontal = 4.dp)
|
||||
AuditLabelUM.Type.Info -> PaddingValues(horizontal = 6.dp, vertical = 1.dp)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,5 +25,8 @@ data class AuditLabelUM(val text: TextReference, val type: Type) {
|
|||
|
||||
/** Blue with white text. Like, "best rate" */
|
||||
Info,
|
||||
|
||||
/** Gray. Like, "info" */
|
||||
General,
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ fun Label(state: LabelUM, modifier: Modifier = Modifier) {
|
|||
val backgroundColor by animateColorAsState(
|
||||
targetValue = when (state.style) {
|
||||
LabelStyle.ACCENT -> TangemTheme.colors.text.accent.copy(alpha = 0.1f)
|
||||
LabelStyle.REGULAR -> TangemTheme.colors.control.unchecked
|
||||
LabelStyle.REGULAR -> TangemTheme.colors.control.default
|
||||
LabelStyle.WARNING -> TangemTheme.colors.text.warning.copy(alpha = 0.1f)
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ private fun YieldSupplyApyLabel(apy: TextReference?, isActive: Boolean, modifier
|
|||
color = if (isActive) {
|
||||
TangemTheme.colors.text.accent.copy(alpha = 0.1f)
|
||||
} else {
|
||||
TangemTheme.colors.control.unchecked
|
||||
TangemTheme.colors.control.default
|
||||
},
|
||||
shape = TangemTheme.shapes.roundedCornersSmall2,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ internal fun YieldSupplyPromoBanner(state: PromoBannerState.Content, modifier: M
|
|||
LaunchedEffect(state) {
|
||||
state.onPromoShown()
|
||||
}
|
||||
val bgColor = TangemTheme.colors.control.unchecked
|
||||
val bgColor = TangemTheme.colors.control.default
|
||||
Column(modifier = modifier) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -169,19 +169,19 @@ class TangemColors internal constructor(
|
|||
@Stable
|
||||
class Control internal constructor(
|
||||
checked: Color,
|
||||
unchecked: Color,
|
||||
default: Color,
|
||||
key: Color,
|
||||
) {
|
||||
var checked by mutableStateOf(checked)
|
||||
private set
|
||||
var unchecked by mutableStateOf(unchecked)
|
||||
var default by mutableStateOf(default)
|
||||
private set
|
||||
var key by mutableStateOf(key)
|
||||
private set
|
||||
|
||||
fun update(other: Control) {
|
||||
checked = other.checked
|
||||
unchecked = other.unchecked
|
||||
default = other.default
|
||||
key = other.key
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ internal fun lightThemeColors(redesign: Boolean = false): TangemColors {
|
|||
),
|
||||
control = TangemColors.Control(
|
||||
checked = TangemColorPalette.Dark6,
|
||||
unchecked = TangemColorPalette.Light2,
|
||||
default = TangemColorPalette.Light2,
|
||||
key = TangemColorPalette.White,
|
||||
),
|
||||
stroke = TangemColors.Stroke(
|
||||
|
|
@ -314,7 +314,7 @@ internal fun darkThemeColors(): TangemColors {
|
|||
),
|
||||
control = TangemColors.Control(
|
||||
checked = TangemColorPalette.Azure,
|
||||
unchecked = TangemColorPalette.Dark4,
|
||||
default = TangemColorPalette.Dark4,
|
||||
key = TangemColorPalette.White,
|
||||
),
|
||||
stroke = TangemColors.Stroke(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.tangem.core.decompose.model.getOrCreateModel
|
|||
import com.tangem.core.ui.extensions.conditional
|
||||
import com.tangem.features.send.v2.api.FeeSelectorBlockComponent
|
||||
import com.tangem.features.send.v2.api.FeeSelectorComponent
|
||||
import com.tangem.features.send.v2.api.SendFeatureToggles
|
||||
import com.tangem.features.send.v2.api.entity.FeeSelectorUM
|
||||
import com.tangem.features.send.v2.api.params.FeeSelectorParams
|
||||
import com.tangem.features.send.v2.feeselector.model.FeeSelectorModel
|
||||
|
|
@ -31,6 +32,7 @@ internal class DefaultFeeSelectorBlockComponent @AssistedInject constructor(
|
|||
@Assisted private val params: FeeSelectorParams.FeeSelectorBlockParams,
|
||||
@Assisted onResult: (feeSelectorUM: FeeSelectorUM) -> Unit,
|
||||
private val feeSelectorComponentFactory: FeeSelectorComponent.Factory,
|
||||
private val sendFeatureToggles: SendFeatureToggles,
|
||||
) : FeeSelectorBlockComponent, AppComponentContext by appComponentContext {
|
||||
|
||||
private val model: FeeSelectorModel = getOrCreateModel(params = params)
|
||||
|
|
@ -80,6 +82,7 @@ internal class DefaultFeeSelectorBlockComponent @AssistedInject constructor(
|
|||
FeeSelectorBlockContent(
|
||||
state = state,
|
||||
onReadMoreClick = model::onReadMoreClicked,
|
||||
isGaslessFeatureEnabled = sendFeatureToggles.isGaslessTransactionsEnabled,
|
||||
modifier = modifier
|
||||
.conditional(isScreenSource && isNotSingleFee) {
|
||||
Modifier.clickable {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@ import com.tangem.blockchain.common.transaction.TransactionFee
|
|||
import com.tangem.common.ui.amountScreen.utils.getFiatString
|
||||
import com.tangem.core.ui.components.TextShimmer
|
||||
import com.tangem.core.ui.components.atoms.text.EllipsisText
|
||||
import com.tangem.core.ui.components.audits.AuditLabel
|
||||
import com.tangem.core.ui.components.audits.AuditLabelUM
|
||||
import com.tangem.core.ui.components.tooltip.TangemTooltip
|
||||
import com.tangem.core.ui.extensions.annotatedReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.format.bigdecimal.BigDecimalFormatConstants.EMPTY_BALANCE_SIGN
|
||||
import com.tangem.core.ui.format.bigdecimal.crypto
|
||||
|
|
@ -51,6 +54,7 @@ private const val READ_MORE_TAG = "READ_MORE"
|
|||
@Composable
|
||||
internal fun FeeSelectorBlockContent(
|
||||
state: FeeSelectorUM,
|
||||
isGaslessFeatureEnabled: Boolean,
|
||||
onReadMoreClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -69,16 +73,25 @@ internal fun FeeSelectorBlockContent(
|
|||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
)
|
||||
FeeSelectorDescription(state = state, onReadMoreClick = onReadMoreClick)
|
||||
FeeSelectorDescription(
|
||||
state = state,
|
||||
isGaslessFeatureEnabled = isGaslessFeatureEnabled,
|
||||
onReadMoreClick = onReadMoreClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun FeeSelectorDescription(state: FeeSelectorUM, onReadMoreClick: () -> Unit, modifier: Modifier = Modifier) {
|
||||
private fun FeeSelectorDescription(
|
||||
state: FeeSelectorUM,
|
||||
isGaslessFeatureEnabled: Boolean,
|
||||
onReadMoreClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(modifier = modifier, horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
FeeSelectorStaticPart(modifier = Modifier.weight(1f), onReadMoreClick = onReadMoreClick)
|
||||
when (state) {
|
||||
is FeeSelectorUM.Content -> FeeContent(state)
|
||||
is FeeSelectorUM.Content -> FeeContent(state, isGaslessFeatureEnabled)
|
||||
is FeeSelectorUM.Loading -> FeeLoading()
|
||||
is FeeSelectorUM.Error -> FeeError()
|
||||
}
|
||||
|
|
@ -161,9 +174,18 @@ private fun FeeLoading() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun FeeContent(state: FeeSelectorUM.Content, modifier: Modifier = Modifier) {
|
||||
private fun FeeContent(state: FeeSelectorUM.Content, isGaslessFeatureEnabled: Boolean, modifier: Modifier = Modifier) {
|
||||
val fiatRate = state.feeFiatRateUM
|
||||
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
|
||||
if (isGaslessFeatureEnabled) {
|
||||
AuditLabel(
|
||||
state = AuditLabelUM(
|
||||
text = stringReference(state.selectedFeeItem.fee.amount.currencySymbol),
|
||||
type = AuditLabelUM.Type.General,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
EllipsisText(
|
||||
text = if (state.feeExtraInfo.isFeeConvertibleToFiat && fiatRate != null) {
|
||||
getFiatString(
|
||||
|
|
@ -206,13 +228,18 @@ private fun FeeContent(state: FeeSelectorUM.Content, modifier: Modifier = Modifi
|
|||
@Composable
|
||||
private fun FeeSelectorBlockContent_Preview(@PreviewParameter(FeeSelectorUMProvider::class) state: FeeSelectorUM) {
|
||||
TangemThemePreview {
|
||||
FeeSelectorBlockContent(modifier = Modifier.fillMaxWidth(), state = state, onReadMoreClick = {})
|
||||
FeeSelectorBlockContent(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
isGaslessFeatureEnabled = true,
|
||||
state = state,
|
||||
onReadMoreClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class FeeSelectorUMProvider : PreviewParameterProvider<FeeSelectorUM> {
|
||||
private val maxFeeItem = FeeItem.Market(
|
||||
fee = Fee.Common(amount = Amount(value = BigDecimal("100000000"), blockchain = Blockchain.Ethereum)),
|
||||
fee = Fee.Common(amount = Amount(value = BigDecimal("100000000"), blockchain = Blockchain.Hedera)),
|
||||
)
|
||||
private val lowFeeItem =
|
||||
FeeItem.Market(Fee.Common(amount = Amount(value = BigDecimal("0.0002876"), blockchain = Blockchain.Ethereum)))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ private fun SendConvertTokenButton(onConvertToAnother: () -> Unit) {
|
|||
tint = TangemTheme.colors.icon.informative,
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.background(TangemTheme.colors.control.unchecked, CircleShape)
|
||||
.background(TangemTheme.colors.control.default, CircleShape)
|
||||
.padding(2.dp),
|
||||
)
|
||||
Text(
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ private fun EnvironmentButtons(uiModel: EnvironmentTogglesScreenUM.ApiInfoUM, on
|
|||
colors = SegmentedButtonDefaults.colors(
|
||||
activeContainerColor = TangemTheme.colors.control.checked,
|
||||
activeContentColor = TangemTheme.colors.text.primary2,
|
||||
inactiveContainerColor = TangemTheme.colors.control.unchecked,
|
||||
inactiveContainerColor = TangemTheme.colors.control.default,
|
||||
inactiveContentColor = TangemTheme.colors.text.primary1,
|
||||
),
|
||||
border = BorderStroke(0.dp, TangemTheme.colors.background.tertiary),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue