show only 3 users in the recommended relays section

This commit is contained in:
greenart7c3 2024-08-12 09:05:08 -03:00
parent 4c6842faf4
commit 7a86d78c50
No known key found for this signature in database
GPG Key ID: 885822EED3A26A6D
2 changed files with 14 additions and 2 deletions

View File

@ -40,8 +40,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.service.Nip11CachedRetriever import com.vitorpamplona.amethyst.service.Nip11CachedRetriever
import com.vitorpamplona.amethyst.ui.note.AddRelayButton import com.vitorpamplona.amethyst.ui.note.AddRelayButton
import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon import com.vitorpamplona.amethyst.ui.note.RenderRelayIcon
@ -65,7 +67,11 @@ fun Kind3RelaySetupInfoProposalRow(
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
nav: (String) -> Unit, nav: (String) -> Unit,
) { ) {
Column(Modifier.fillMaxWidth().clickable(onClick = onClick)) { Column(
Modifier
.fillMaxWidth()
.clickable(onClick = onClick),
) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(vertical = 5.dp), modifier = Modifier.padding(vertical = 5.dp),
@ -107,7 +113,7 @@ fun Kind3RelaySetupInfoProposalRow(
} }
FlowRow(verticalArrangement = Arrangement.Center) { FlowRow(verticalArrangement = Arrangement.Center) {
item.users.forEach { item.users.take(3).forEach {
UserPicture( UserPicture(
userHex = it, userHex = it,
size = Size25dp, size = Size25dp,
@ -115,6 +121,11 @@ fun Kind3RelaySetupInfoProposalRow(
nav = nav, nav = nav,
) )
} }
if (item.users.size > 3) {
Text(
text = stringResource(R.string.and_more),
)
}
} }
} }

View File

@ -951,4 +951,5 @@
<string name="add_a_nip96_server">Add a NIP-96 Server</string> <string name="add_a_nip96_server">Add a NIP-96 Server</string>
<string name="delete_all">Delete all</string> <string name="delete_all">Delete all</string>
<string name="delete_all_drafts_confirmation">Are you sure you want to delete all drafts?</string> <string name="delete_all_drafts_confirmation">Are you sure you want to delete all drafts?</string>
<string name="and_more">" ... and more"</string>
</resources> </resources>