@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
3232import androidx.compose.ui.res.painterResource
3333import androidx.compose.ui.res.stringResource
3434import androidx.compose.ui.text.style.TextOverflow
35+ import androidx.compose.ui.tooling.preview.Devices
3536import androidx.compose.ui.tooling.preview.Preview
3637import androidx.compose.ui.unit.dp
3738import androidx.lifecycle.SavedStateHandle
@@ -54,12 +55,12 @@ import to.bitkit.ui.components.BottomSheetPreview
5455import to.bitkit.ui.components.ButtonSize
5556import to.bitkit.ui.components.Caption13Up
5657import to.bitkit.ui.components.FillHeight
57- import to.bitkit.ui.components.MoneySSB
5858import to.bitkit.ui.components.PrimaryButton
5959import to.bitkit.ui.components.SwipeToConfirm
6060import to.bitkit.ui.components.TagButton
6161import to.bitkit.ui.components.TextInput
6262import to.bitkit.ui.components.VerticalSpacer
63+ import to.bitkit.ui.components.rememberMoneyText
6364import to.bitkit.ui.scaffold.AppAlertDialog
6465import to.bitkit.ui.scaffold.SheetTopBar
6566import to.bitkit.ui.settingsViewModel
@@ -69,6 +70,7 @@ import to.bitkit.ui.shared.util.gradientBackground
6970import to.bitkit.ui.theme.AppThemeSurface
7071import to.bitkit.ui.theme.Colors
7172import to.bitkit.ui.utils.rememberBiometricAuthSupported
73+ import to.bitkit.ui.utils.withAccent
7274import to.bitkit.viewmodels.AmountWarning
7375import to.bitkit.viewmodels.LnurlParams
7476import to.bitkit.viewmodels.SendEvent
@@ -340,15 +342,16 @@ private fun OnChainDescription(
340342 tint = fee.color,
341343 modifier = Modifier .size(16 .dp)
342344 )
343- Row {
344- BodySSB (stringResource(fee.title) + " (" )
345- if (uiState.fee > 0 ) {
346- MoneySSB (sats = uiState.fee, accent = Colors .White )
347- } else {
348- CircularProgressIndicator (Modifier .size(18 .dp), strokeWidth = 2 .dp)
345+ uiState.fee.takeIf { it > 0 }
346+ ?.let { rememberMoneyText(it) }
347+ ?.let {
348+ BodySSB (
349+ text = " ${stringResource(fee.title)} ($it )" .withAccent(accentColor = Colors .White ),
350+ maxLines = 1 ,
351+ overflow = TextOverflow .MiddleEllipsis ,
352+ )
349353 }
350- BodySSB (" )" )
351- }
354+ ? : CircularProgressIndicator (Modifier .size(14 .dp), Colors .White64 , 2 .dp)
352355 Icon (
353356 painterResource(R .drawable.ic_pencil_simple),
354357 contentDescription = null ,
@@ -502,10 +505,10 @@ private fun sendUiState() = SendUiState(
502505 payeeNodeId = null ,
503506 description = " Some invoice description" ,
504507 ),
505- fee = 212 ,
508+ fee = 45554 ,
506509)
507510
508- @Preview(showSystemUi = true )
511+ @Preview(showSystemUi = true , group = " onchain " )
509512@Composable
510513private fun PreviewOnChain () {
511514 AppThemeSurface {
@@ -522,6 +525,42 @@ private fun PreviewOnChain() {
522525 }
523526}
524527
528+ @Preview(showSystemUi = true , group = " onchain" , device = Devices .NEXUS_5 )
529+ @Composable
530+ private fun PreviewOnChainLongFeeSmallScreen () {
531+ AppThemeSurface {
532+ BottomSheetPreview {
533+ Content (
534+ uiState = sendUiState().copy(
535+ selectedTags = listOf (" car" , " house" , " uber" ),
536+ fee = 654321 ,
537+ ),
538+ isLoading = false ,
539+ showBiometrics = false ,
540+ modifier = Modifier .sheetHeight(),
541+ )
542+ }
543+ }
544+ }
545+
546+ @Preview(showSystemUi = true , group = " onchain" )
547+ @Composable
548+ private fun PreviewOnChainFeeLoading () {
549+ AppThemeSurface {
550+ BottomSheetPreview {
551+ Content (
552+ uiState = sendUiState().copy(
553+ selectedTags = listOf (" car" , " house" , " uber" ),
554+ fee = 0 ,
555+ ),
556+ isLoading = false ,
557+ showBiometrics = false ,
558+ modifier = Modifier .sheetHeight(),
559+ )
560+ }
561+ }
562+ }
563+
525564@Preview(showSystemUi = true )
526565@Composable
527566private fun PreviewLightning () {
0 commit comments