mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
Merge pull request #3354 from vitorpamplona/claude/funny-clarke-nrzpq4
Extract MintPickerItem composable in CashuWalletScreen
This commit is contained in:
+41
-36
@@ -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)
|
||||
|
||||
+15
-7
@@ -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)
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user