Skip to content

Commit

Permalink
added InfoButton for fees and involved accounts
Browse files Browse the repository at this point in the history
in TransactionReviewScreen
  • Loading branch information
giannis-rdx committed Sep 6, 2024
1 parent 3712dab commit 8c33a55
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ private fun TransactionPreviewContent(

PresentingProofsContent(
badges = state.previewType.badges.toPersistentList(),
onInfoClick = onInfoClick,
onClick = { badge ->
when (val resource = badge.resource) {
is Resource.FungibleResource -> onTransferableFungibleClick(
Expand Down Expand Up @@ -386,7 +387,8 @@ private fun TransactionPreviewContent(
onFeePaddingAmountChanged = onFeePaddingAmountChanged,
onTipPercentageChanged = onTipPercentageChanged,
onViewDefaultModeClick = onViewDefaultModeClick,
onViewAdvancedModeClick = onViewAdvancedModeClick
onViewAdvancedModeClick = onViewAdvancedModeClick,
onInfoClick = onInfoClick
)
},
showDragHandle = true,
Expand Down Expand Up @@ -431,7 +433,8 @@ private fun BottomSheetContent(
onFeePaddingAmountChanged: (String) -> Unit,
onTipPercentageChanged: (String) -> Unit,
onViewDefaultModeClick: () -> Unit,
onViewAdvancedModeClick: () -> Unit
onViewAdvancedModeClick: () -> Unit,
onInfoClick: (GlossaryItem) -> Unit
) {
when (sheetState) {
is State.Sheet.CustomizeGuarantees -> {
Expand Down Expand Up @@ -459,7 +462,8 @@ private fun BottomSheetContent(
onFeePaddingAmountChanged = onFeePaddingAmountChanged,
onTipPercentageChanged = onTipPercentageChanged,
onViewDefaultModeClick = onViewDefaultModeClick,
onViewAdvancedModeClick = onViewAdvancedModeClick
onViewAdvancedModeClick = onViewAdvancedModeClick,
onInfoClick = onInfoClick
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.babylon.wallet.android.presentation.transaction.composables
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -29,11 +30,13 @@ import com.babylon.wallet.android.designsystem.composable.LabelType
import com.babylon.wallet.android.designsystem.composable.RadixTextButton
import com.babylon.wallet.android.designsystem.composable.RadixTextField
import com.babylon.wallet.android.designsystem.theme.RadixTheme
import com.babylon.wallet.android.presentation.dialogs.info.GlossaryItem
import com.babylon.wallet.android.presentation.transaction.TransactionReviewViewModel
import com.babylon.wallet.android.presentation.transaction.fees.TransactionFees
import com.babylon.wallet.android.presentation.transaction.model.AccountWithTransferableResources
import com.babylon.wallet.android.presentation.ui.RadixWalletPreviewTheme
import com.babylon.wallet.android.presentation.ui.composables.BottomDialogHeader
import com.babylon.wallet.android.presentation.ui.composables.InfoButton
import com.babylon.wallet.android.presentation.ui.composables.WarningText
import com.radixdlt.sargon.Account
import com.radixdlt.sargon.annotation.UsesSampleValues
Expand All @@ -54,7 +57,8 @@ fun FeesSheet(
onFeePaddingAmountChanged: (String) -> Unit,
onTipPercentageChanged: (String) -> Unit,
onViewDefaultModeClick: () -> Unit,
onViewAdvancedModeClick: () -> Unit
onViewAdvancedModeClick: () -> Unit,
onInfoClick: (GlossaryItem) -> Unit
) {
LazyColumn(
modifier = modifier.fillMaxSize()
Expand Down Expand Up @@ -111,6 +115,18 @@ fun FeesSheet(
textAlign = TextAlign.Center
)

Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.Center,
) {
InfoButton(
text = stringResource(id = R.string.customizeNetworkFees_howDoFeesWork),
onClick = {
onInfoClick(GlossaryItem.transactionfee)
}
)
}

HorizontalDivider(
Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -213,16 +229,28 @@ fun FeesSheet(
textStyle = RadixTheme.typography.body1Header
)
} else if (isSelectedFeePayerInvolvedInTransaction.not()) {
WarningText(
Row(
modifier = Modifier
.fillMaxWidth()
.padding(
horizontal = RadixTheme.dimensions.paddingLarge,
vertical = RadixTheme.dimensions.paddingSmall
),
text = AnnotatedString(stringResource(id = R.string.transactionReview_feePayerValidation_linksNewAccount)),
textStyle = RadixTheme.typography.body1Header
)
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(RadixTheme.dimensions.paddingSmall)
) {
WarningText(
modifier = Modifier.weight(1f),
text = AnnotatedString(stringResource(id = R.string.transactionReview_feePayerValidation_linksNewAccount)),
textStyle = RadixTheme.typography.body1Header
)
InfoButton(
text = stringResource(R.string.empty),
color = RadixTheme.colors.gray3,
onClick = {
onInfoClick(GlossaryItem.payingaccount)
}
)
}
}
}
}
Expand Down Expand Up @@ -823,7 +851,8 @@ private fun FeesSheetEmptyPreview() {
onFeePaddingAmountChanged = {},
onTipPercentageChanged = {},
onViewDefaultModeClick = {},
onViewAdvancedModeClick = {}
onViewAdvancedModeClick = {},
onInfoClick = {}
)
}
}
Expand All @@ -849,7 +878,8 @@ private fun FeesSheetNotEnoughXRDPreview() {
onFeePaddingAmountChanged = {},
onTipPercentageChanged = {},
onViewDefaultModeClick = {},
onViewAdvancedModeClick = {}
onViewAdvancedModeClick = {},
onInfoClick = {}
)
}
}
Expand All @@ -875,7 +905,8 @@ private fun FeesSheetAccountNotInvolvedPreview() {
onFeePaddingAmountChanged = {},
onTipPercentageChanged = {},
onViewDefaultModeClick = {},
onViewAdvancedModeClick = {}
onViewAdvancedModeClick = {},
onInfoClick = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.babylon.wallet.android.presentation.transaction.composables

import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -127,13 +128,24 @@ fun NetworkFeeContent(
textStyle = RadixTheme.typography.body1Header
)
} else if (isSelectedFeePayerInvolvedInTransaction.not()) {
WarningText(
modifier = Modifier
.fillMaxWidth()
.padding(top = RadixTheme.dimensions.paddingSmall),
text = AnnotatedString(stringResource(id = R.string.transactionReview_feePayerValidation_linksNewAccount)),
textStyle = RadixTheme.typography.body1Header
)
Row(
modifier = Modifier.fillMaxWidth().padding(top = RadixTheme.dimensions.paddingSmall),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(RadixTheme.dimensions.paddingSmall)
) {
WarningText(
modifier = Modifier.weight(1f),
text = AnnotatedString(stringResource(id = R.string.transactionReview_feePayerValidation_linksNewAccount)),
textStyle = RadixTheme.typography.body1Header
)
InfoButton(
text = stringResource(R.string.empty),
color = RadixTheme.colors.gray3,
onClick = {
onInfoClick(GlossaryItem.payingaccount)
}
)
}
}

RadixTextButton(
Expand Down

0 comments on commit 8c33a55

Please sign in to comment.