From 7a86d78c50dd3cf54e8e120517e13e4edfcc9800 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Mon, 12 Aug 2024 09:05:08 -0300 Subject: [PATCH] show only 3 users in the recommended relays section --- .../relays/Kind3RelaySetupInfoProposalRow.kt | 15 +++++++++++++-- amethyst/src/main/res/values/strings.xml | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/relays/Kind3RelaySetupInfoProposalRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/relays/Kind3RelaySetupInfoProposalRow.kt index a37c9f23d..29c1211d5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/relays/Kind3RelaySetupInfoProposalRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/relays/Kind3RelaySetupInfoProposalRow.kt @@ -40,8 +40,10 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.service.Nip11CachedRetriever import com.vitorpamplona.amethyst.ui.note.AddRelayButton import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon @@ -65,7 +67,11 @@ fun Kind3RelaySetupInfoProposalRow( accountViewModel: AccountViewModel, nav: (String) -> Unit, ) { - Column(Modifier.fillMaxWidth().clickable(onClick = onClick)) { + Column( + Modifier + .fillMaxWidth() + .clickable(onClick = onClick), + ) { Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = 5.dp), @@ -107,7 +113,7 @@ fun Kind3RelaySetupInfoProposalRow( } FlowRow(verticalArrangement = Arrangement.Center) { - item.users.forEach { + item.users.take(3).forEach { UserPicture( userHex = it, size = Size25dp, @@ -115,6 +121,11 @@ fun Kind3RelaySetupInfoProposalRow( nav = nav, ) } + if (item.users.size > 3) { + Text( + text = stringResource(R.string.and_more), + ) + } } } diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 4745ce130..b758d941e 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -951,4 +951,5 @@ Add a NIP-96 Server Delete all Are you sure you want to delete all drafts? + " ... and more"