Updated on 2026-08-14
This commit is contained in:
parent
a09cc82bb8
commit
5ddc091e56
7 changed files with 34 additions and 35 deletions
|
|
@ -1,20 +1,17 @@
|
|||
package com.tangem.features.walletconnect.transaction.entity.approve
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionRequestInfoUM
|
||||
|
||||
@Immutable
|
||||
internal data class WcApproveTransactionUM(
|
||||
val transaction: WcApproveTransactionItemUM,
|
||||
val transactionRequestInfo: WcTransactionRequestInfoUM,
|
||||
val customAllowance: WcCustomAllowanceUM,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
internal data class WcApproveTransactionItemUM(
|
||||
val onDismiss: () -> Unit,
|
||||
val onSend: () -> Unit,
|
||||
|
|
@ -26,7 +23,6 @@ internal data class WcApproveTransactionItemUM(
|
|||
val isLoading: Boolean = false,
|
||||
) : TangemBottomSheetConfigContent
|
||||
|
||||
@Immutable
|
||||
internal data class WcCustomAllowanceUM(
|
||||
@DrawableRes val networkIconRes: Int,
|
||||
val tokenIconUrl: String,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package com.tangem.features.walletconnect.transaction.entity.common
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
internal data class WcNetworkInfoUM(
|
||||
val name: String,
|
||||
@DrawableRes val iconRes: Int,
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
package com.tangem.features.walletconnect.transaction.entity.common
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Immutable
|
||||
internal data class WcTransactionRequestInfoUM(
|
||||
val blocks: ImmutableList<WcTransactionRequestBlockUM>,
|
||||
val onCopy: () -> Unit,
|
||||
) : TangemBottomSheetConfigContent
|
||||
|
||||
@Immutable
|
||||
internal data class WcTransactionRequestBlockUM(
|
||||
val info: ImmutableList<WcTransactionRequestInfoItemUM>,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
internal data class WcTransactionRequestInfoItemUM(
|
||||
val title: TextReference,
|
||||
val description: String = "",
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
package com.tangem.features.walletconnect.transaction.entity.sign
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM
|
||||
import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionRequestInfoUM
|
||||
|
||||
@Immutable
|
||||
internal data class WcSignTransactionUM(
|
||||
val transaction: WcSignTransactionItemUM,
|
||||
val transactionRequestInfo: WcTransactionRequestInfoUM,
|
||||
)
|
||||
|
||||
@Immutable
|
||||
internal data class WcSignTransactionItemUM(
|
||||
val onDismiss: () -> Unit,
|
||||
val onSign: () -> Unit,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.features.walletconnect.transaction.ui.approve
|
||||
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
|
|
@ -12,8 +13,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import com.tangem.features.walletconnect.impl.R
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import coil.compose.AsyncImage
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.features.walletconnect.transaction.entity.approve.WcSpendAllowanceUM
|
||||
import com.tangem.features.walletconnect.transaction.ui.common.WcSmallTitleItem
|
||||
|
|
@ -52,11 +53,16 @@ internal fun WcSpendAllowanceItem(spendAllowance: WcSpendAllowanceUM, modifier:
|
|||
|
||||
Spacer(modifier = Modifier.width(TangemTheme.dimens.spacing12))
|
||||
|
||||
Text(
|
||||
text = spendAllowance.amountText,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
)
|
||||
AnimatedContent(
|
||||
targetState = spendAllowance.amountText,
|
||||
label = "Animate Spend allowance text",
|
||||
) { amount ->
|
||||
Text(
|
||||
text = amount,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.primary1,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
|
|
@ -64,7 +70,7 @@ internal fun WcSpendAllowanceItem(spendAllowance: WcSpendAllowanceUM, modifier:
|
|||
horizontalArrangement = Arrangement.End,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.manage_tokens_edit),
|
||||
text = stringResourceSafe(R.string.manage_tokens_edit),
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.features.walletconnect.transaction.ui.common
|
||||
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.Icon
|
||||
|
|
@ -48,11 +49,16 @@ internal fun WcNetworkFeeItem(networkFeeText: String, modifier: Modifier = Modif
|
|||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.End,
|
||||
) {
|
||||
Text(
|
||||
text = networkFeeText,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
AnimatedContent(
|
||||
targetState = networkFeeText,
|
||||
label = "Animate Network fee text",
|
||||
) { fee ->
|
||||
Text(
|
||||
text = fee,
|
||||
style = TangemTheme.typography.body1,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.width(TangemTheme.dimens.spacing6))
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ internal fun WcSignTransactionModalBottomSheetContent(
|
|||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
.padding(horizontal = 16.dp),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius14))
|
||||
.clip(RoundedCornerShape(14.dp))
|
||||
.background(color = TangemTheme.colors.background.action)
|
||||
.fillMaxWidth()
|
||||
.animateContentSize(),
|
||||
|
|
@ -60,13 +60,13 @@ internal fun WcSignTransactionModalBottomSheetContent(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { onClickTransactionRequest() }
|
||||
.padding(TangemTheme.dimens.spacing12),
|
||||
.padding(12.dp),
|
||||
)
|
||||
}
|
||||
Column(modifier = Modifier.padding(top = TangemTheme.dimens.spacing16)) {
|
||||
Column(modifier = Modifier.padding(top = 16.dp)) {
|
||||
WcSignTransactionItems(state)
|
||||
WcTransactionRequestButtons(
|
||||
modifier = Modifier.padding(vertical = TangemTheme.dimens.spacing16),
|
||||
modifier = Modifier.padding(vertical = 16.dp),
|
||||
onDismiss = state.onDismiss,
|
||||
onClickActiveButton = state.onSign,
|
||||
activeButtonText = resourceReference(R.string.common_sign),
|
||||
|
|
@ -80,27 +80,27 @@ internal fun WcSignTransactionModalBottomSheetContent(
|
|||
private fun WcSignTransactionItems(state: WcSignTransactionItemUM) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(TangemTheme.dimens.radius14))
|
||||
.clip(RoundedCornerShape(14.dp))
|
||||
.background(color = TangemTheme.colors.background.action)
|
||||
.fillMaxWidth()
|
||||
.animateContentSize(),
|
||||
) {
|
||||
val itemsModifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(TangemTheme.dimens.spacing12)
|
||||
.padding(12.dp)
|
||||
|
||||
DividerWithPadding(start = 0.dp, end = 0.dp)
|
||||
WcWalletItem(
|
||||
modifier = itemsModifier,
|
||||
walletName = state.walletName,
|
||||
)
|
||||
DividerWithPadding(start = TangemTheme.dimens.spacing40, end = TangemTheme.dimens.spacing12)
|
||||
DividerWithPadding(start = 40.dp, end = 12.dp)
|
||||
WcNetworkItem(
|
||||
modifier = itemsModifier,
|
||||
networkInfo = state.networkInfo,
|
||||
)
|
||||
if (!state.addressText.isNullOrEmpty()) {
|
||||
DividerWithPadding(start = TangemTheme.dimens.spacing40, end = TangemTheme.dimens.spacing12)
|
||||
DividerWithPadding(start = 40.dp, end = 12.dp)
|
||||
WcAddressItem(
|
||||
modifier = itemsModifier,
|
||||
addressText = state.addressText,
|
||||
|
|
@ -116,7 +116,7 @@ internal fun DividerWithPadding(start: Dp, end: Dp) {
|
|||
start = start,
|
||||
end = end,
|
||||
),
|
||||
thickness = TangemTheme.dimens.size1,
|
||||
thickness = 1.dp,
|
||||
color = TangemTheme.colors.stroke.primary,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue