Skip to content

Commit

Permalink
Show dividers in swap confirm fields
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrasulov committed Apr 1, 2024
1 parent 002c0cc commit 508d40e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah

@Composable
fun QuoteInfoRow(
borderTop: Boolean = false,
title: @Composable() (RowScope.() -> Unit),
value: @Composable() (RowScope.() -> Unit),
) {
CellUniversal(borderTop = false) {
CellUniversal(borderTop = borderTop) {
title.invoke(this)
HSpacer(width = 16.dp)
Row(modifier = Modifier.weight(1f), horizontalArrangement = Arrangement.End) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fun SwapConfirmScreen(navController: NavController) {
)
}
uiState.fields.forEach {
it.GetContent(navController)
it.GetContent(navController, true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private fun SwapScreenInner(
PriceField(quote.tokenIn, quote.tokenOut, quote.amountIn, quote.amountOut)
PriceImpactField(uiState.priceImpact, uiState.priceImpactLevel, navController)
quote.fields.forEach {
it.GetContent(navController)
it.GetContent(navController, false)
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import androidx.navigation.NavController

interface SwapDataField {
@Composable
fun GetContent(navController: NavController)
fun GetContent(navController: NavController, borderTop: Boolean)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import java.math.BigDecimal

data class SwapDataFieldAllowance(val allowance: BigDecimal, val token: Token) : SwapDataField {
@Composable
override fun GetContent(navController: NavController) {
override fun GetContent(navController: NavController, borderTop: Boolean) {
val infoTitle = stringResource(id = R.string.SwapInfo_AllowanceTitle)
val infoText = stringResource(id = R.string.SwapInfo_AllowanceDescription)

QuoteInfoRow(
borderTop = borderTop,
title = {
subhead2_grey(text = stringResource(R.string.Swap_Allowance))

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah

data class SwapDataFieldRecipient(val address: Address) : SwapDataField {
@Composable
override fun GetContent(navController: NavController) {
override fun GetContent(navController: NavController, borderTop: Boolean) {
QuoteInfoRow(
borderTop = borderTop,
title = {
subhead2_grey(text = stringResource(R.string.Swap_Recipient))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ data class SwapDataFieldRecipientExtended(
val blockchainType: BlockchainType
) : SwapDataField {
@Composable
override fun GetContent(navController: NavController) {
override fun GetContent(navController: NavController, borderTop: Boolean) {
QuoteInfoRow(
borderTop = borderTop,
title = {
subhead2_grey(text = stringResource(R.string.Swap_Recipient))
},
Expand Down Expand Up @@ -58,6 +59,7 @@ data class SwapDataFieldRecipientExtended(

contact?.name?.let { name ->
QuoteInfoRow(
borderTop = borderTop,
title = {
subhead2_grey(text = stringResource(R.string.TransactionInfo_ContactName))
},
Expand All @@ -80,6 +82,6 @@ fun SwapDataFieldRecipientExtendedPreview() {
SwapDataFieldRecipientExtended(
Address("0x1234567890abcdef1234567890abcdef12345678"),
BlockchainType.Bitcoin
).GetContent(navController = navController)
).GetContent(navController = navController, borderTop = true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import java.math.BigDecimal

data class SwapDataFieldSlippage(val slippage: BigDecimal) : SwapDataField {
@Composable
override fun GetContent(navController: NavController) {
override fun GetContent(navController: NavController, borderTop: Boolean) {
QuoteInfoRow(
borderTop = borderTop,
title = {
subhead2_grey(text = stringResource(R.string.Swap_Slippage))
},
Expand Down

0 comments on commit 508d40e

Please sign in to comment.