Merge pull request #2442 from vitorpamplona/claude/hide-payment-targets-button-tDYK9
Simplify payment button logic and handle empty targets earlier
This commit is contained in:
+2
-9
@@ -64,8 +64,10 @@ fun PaymentButton(
|
|||||||
remember(note) {
|
remember(note) {
|
||||||
(note?.event as? PaymentTargetsEvent)?.paymentTargets() ?: emptyList()
|
(note?.event as? PaymentTargetsEvent)?.paymentTargets() ?: emptyList()
|
||||||
}
|
}
|
||||||
|
if (targets.isNotEmpty()) {
|
||||||
PaymentButtonWithTargets(targets)
|
PaymentButtonWithTargets(targets)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -94,14 +96,6 @@ fun PaymentButtonWithTargets(targets: List<PaymentTarget>) {
|
|||||||
onDismiss = { expanded = false },
|
onDismiss = { expanded = false },
|
||||||
) {
|
) {
|
||||||
M3ActionSection {
|
M3ActionSection {
|
||||||
if (targets.isEmpty()) {
|
|
||||||
M3ActionRow(
|
|
||||||
icon = Icons.Outlined.AccountBalanceWallet,
|
|
||||||
text = stringRes(R.string.no_payment_targets_message),
|
|
||||||
enabled = false,
|
|
||||||
onClick = {},
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
targets.forEach { target ->
|
targets.forEach { target ->
|
||||||
M3ActionRow(
|
M3ActionRow(
|
||||||
icon = Icons.Outlined.AccountBalanceWallet,
|
icon = Icons.Outlined.AccountBalanceWallet,
|
||||||
@@ -122,7 +116,6 @@ fun PaymentButtonWithTargets(targets: List<PaymentTarget>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
errorMessage?.let { msg ->
|
errorMessage?.let { msg ->
|
||||||
ErrorMessageDialog(
|
ErrorMessageDialog(
|
||||||
|
|||||||
Reference in New Issue
Block a user