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 <noreply@anthropic.com>
This commit is contained in:
Vitor Pamplona
2026-10-05 15:19:13 -04:00
co-authored by Claude Opus 5.5
parent 02dd54f80d
commit 8ed75761ae
2 changed files with 6 additions and 2 deletions
@@ -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,
)
}
}
@@ -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),