From 8ed75761ae0a13a04fe0a79c8fb741e3385f93e6 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 5 Oct 2026 15:19:13 -0400 Subject: [PATCH] fix(ui): give EmptyState side padding and centred text The shared empty state had no horizontal padding and left-aligned its description, so multi-line text ran into the screen edges (seen on the Cordn groups list). Pads 24dp and centres title and description for all 48 callers; the wallet's own extra 24dp drops to vertical only so it is not padded twice. Co-Authored-By: Claude Opus 5.5 --- .../amethyst/commons/ui/components/LoadingState.kt | 6 +++++- .../ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/LoadingState.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/LoadingState.kt index 0ca8bb4748..fee7cb3219 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/LoadingState.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/components/LoadingState.kt @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material3.Button import androidx.compose.material3.CircularProgressIndicator @@ -34,6 +35,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.action_refresh @@ -84,7 +86,7 @@ fun EmptyState( val actualRefreshLabel = refreshLabel ?: stringResource(Res.string.action_refresh) Column( - modifier = modifier.fillMaxSize(), + modifier = modifier.fillMaxSize().padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { @@ -92,6 +94,7 @@ fun EmptyState( title, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center, ) if (description != null) { Spacer(Modifier.height(8.dp)) @@ -100,6 +103,7 @@ fun EmptyState( description, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), + textAlign = TextAlign.Center, ) } } diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt index 90cc9e89ea..23e6d41345 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/screen/loggedIn/wallet/WalletTransactionsScreen.kt @@ -172,7 +172,7 @@ fun WalletTransactionsScreen( // branch the screen would claim "no transactions yet" and hide the reason. EmptyState( title = stringRes(Res.string.wallet_transactions_load_failed), - modifier = Modifier.padding(padding).padding(24.dp), + modifier = Modifier.padding(padding).padding(vertical = 24.dp), description = currentError, onRefresh = { walletViewModel.fetchTransactions() }, refreshLabel = stringRes(Res.string.wallet_refresh),