diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt index 88604ae38d..af3a79e9be 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/embed/BottomConsoleSheet.kt @@ -128,43 +128,8 @@ fun BottomConsoleSheet( .verticalScroll(scrollState) .padding(horizontal = 8.dp, vertical = 4.dp), ) { - val dimColor = MaterialTheme.colorScheme.onSurfaceVariant logs.forEach { entry -> - val levelColor = consoleLevelColor(entry.level) - val srcShort = - entry.source - .substringAfterLast("/") - .substringAfterLast("\\") - .let { if (it.isBlank()) entry.source.takeLast(20) else it } - Row( - Modifier.fillMaxWidth().padding(vertical = 1.dp), - verticalAlignment = Alignment.Top, - ) { - Text( - consoleLevelChar(entry.level), - color = levelColor, - fontFamily = FontFamily.Monospace, - fontSize = 11.sp, - modifier = Modifier.width(14.dp), - ) - Spacer(Modifier.width(4.dp)) - Text( - buildAnnotatedString { - withStyle(SpanStyle(color = levelColor)) { - append(entry.message) - } - if (srcShort.isNotBlank()) { - withStyle(SpanStyle(color = dimColor)) { - append(" $srcShort:${entry.lineNumber}") - } - } - }, - fontFamily = FontFamily.Monospace, - fontSize = 11.sp, - modifier = Modifier.weight(1f), - overflow = TextOverflow.Visible, - ) - } + ConsoleLogRow(entry) } } } @@ -203,6 +168,46 @@ fun BottomConsoleSheet( } } +@Composable +private fun ConsoleLogRow(entry: ConsoleLogEntry) { + val levelColor = consoleLevelColor(entry.level) + val dimColor = MaterialTheme.colorScheme.onSurfaceVariant + val srcShort = + entry.source + .substringAfterLast("/") + .substringAfterLast("\\") + .let { if (it.isBlank()) entry.source.takeLast(20) else it } + Row( + Modifier.fillMaxWidth().padding(vertical = 1.dp), + verticalAlignment = Alignment.Top, + ) { + Text( + consoleLevelChar(entry.level), + color = levelColor, + fontFamily = FontFamily.Monospace, + fontSize = 11.sp, + modifier = Modifier.width(14.dp), + ) + Spacer(Modifier.width(4.dp)) + Text( + buildAnnotatedString { + withStyle(SpanStyle(color = levelColor)) { + append(entry.message) + } + if (srcShort.isNotBlank()) { + withStyle(SpanStyle(color = dimColor)) { + append(" $srcShort:${entry.lineNumber}") + } + } + }, + fontFamily = FontFamily.Monospace, + fontSize = 11.sp, + modifier = Modifier.weight(1f), + overflow = TextOverflow.Visible, + ) + } +} + @Composable private fun consoleLevelColor(level: String): Color { val warningAmber = if (isSystemInDarkTheme()) Color(0xFFFFB74D) else Color(0xFFE65100) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt index 0bd1784621..9c11e7369d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/CashuWalletScreen.kt @@ -1234,17 +1234,25 @@ private fun MintPicker( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { mints.forEach { m -> - DropdownMenuItem( - text = { Text(m) }, - onClick = { - onPick(m) - expanded = false - }, - ) + MintPickerItem(m) { + onPick(m) + expanded = false + } } } } +@Composable +private fun MintPickerItem( + mint: String, + onClick: () -> Unit, +) { + DropdownMenuItem( + text = { Text(mint) }, + onClick = onClick, + ) +} + // ============================================================================ // Send LN (melt) // ============================================================================