Skip to content

Commit dcc4a8e

Browse files
committed
fix: fee display on small screens
1 parent ea745d9 commit dcc4a8e

File tree

1 file changed

+50
-11
lines changed

1 file changed

+50
-11
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
3232
import androidx.compose.ui.res.painterResource
3333
import androidx.compose.ui.res.stringResource
3434
import androidx.compose.ui.text.style.TextOverflow
35+
import androidx.compose.ui.tooling.preview.Devices
3536
import androidx.compose.ui.tooling.preview.Preview
3637
import androidx.compose.ui.unit.dp
3738
import androidx.lifecycle.SavedStateHandle
@@ -54,12 +55,12 @@ import to.bitkit.ui.components.BottomSheetPreview
5455
import to.bitkit.ui.components.ButtonSize
5556
import to.bitkit.ui.components.Caption13Up
5657
import to.bitkit.ui.components.FillHeight
57-
import to.bitkit.ui.components.MoneySSB
5858
import to.bitkit.ui.components.PrimaryButton
5959
import to.bitkit.ui.components.SwipeToConfirm
6060
import to.bitkit.ui.components.TagButton
6161
import to.bitkit.ui.components.TextInput
6262
import to.bitkit.ui.components.VerticalSpacer
63+
import to.bitkit.ui.components.rememberMoneyText
6364
import to.bitkit.ui.scaffold.AppAlertDialog
6465
import to.bitkit.ui.scaffold.SheetTopBar
6566
import to.bitkit.ui.settingsViewModel
@@ -69,6 +70,7 @@ import to.bitkit.ui.shared.util.gradientBackground
6970
import to.bitkit.ui.theme.AppThemeSurface
7071
import to.bitkit.ui.theme.Colors
7172
import to.bitkit.ui.utils.rememberBiometricAuthSupported
73+
import to.bitkit.ui.utils.withAccent
7274
import to.bitkit.viewmodels.AmountWarning
7375
import to.bitkit.viewmodels.LnurlParams
7476
import 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
510513
private 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
527566
private fun PreviewLightning() {

0 commit comments

Comments
 (0)