Generalize List counters

This commit is contained in:
Vitor Pamplona
2025-11-05 16:39:37 -05:00
parent 1eb2309952
commit 558d952a00
@@ -206,18 +206,34 @@ fun PeopleListItem(
contentDescription = stringRes(R.string.follow_set_icon_description), contentDescription = stringRes(R.string.follow_set_icon_description),
modifier = Size50ModifierOffset10, modifier = Size50ModifierOffset10,
) )
DisplayParticipantNumberAndStatus(
modifier = Modifier.align(Alignment.BottomCenter),
privateMembersSize = peopleList.privateMembersList.size,
publicMembersSize = peopleList.publicMembersList.size,
)
}
},
)
}
@Composable
fun DisplayParticipantNumberAndStatus(
modifier: Modifier,
privateMembersSize: Int,
publicMembersSize: Int,
) {
Row( Row(
modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-5).dp), modifier = modifier.offset(y = (-5).dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = SpacedBy5dp, horizontalArrangement = SpacedBy5dp,
) { ) {
if (peopleList.publicMembers.isEmpty() && peopleList.privateMembers.isEmpty()) { if (privateMembersSize <= 0 && publicMembersSize <= 0) {
Text( Text(
text = stringRes(R.string.follow_set_empty_label2), text = stringRes(R.string.follow_set_empty_label2),
fontSize = Font10SP, fontSize = Font10SP,
) )
} else { } else {
if (peopleList.privateMembers.isNotEmpty()) { if (privateMembersSize > 0) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = SpacedBy2dp, horizontalArrangement = SpacedBy2dp,
@@ -228,12 +244,12 @@ fun PeopleListItem(
contentDescription = null, contentDescription = null,
) )
Text( Text(
text = peopleList.privateMembers.size.toString(), text = privateMembersSize.toString(),
fontSize = Font10SP, fontSize = Font10SP,
) )
} }
} }
if (peopleList.publicMembers.isNotEmpty()) { if (publicMembersSize > 0) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = SpacedBy2dp, horizontalArrangement = SpacedBy2dp,
@@ -244,7 +260,7 @@ fun PeopleListItem(
contentDescription = null, contentDescription = null,
) )
Text( Text(
text = peopleList.publicMembers.size.toString(), text = publicMembersSize.toString(),
fontSize = Font10SP, fontSize = Font10SP,
) )
} }
@@ -252,9 +268,6 @@ fun PeopleListItem(
} }
} }
} }
},
)
}
@Composable @Composable
private fun PeopleListOptionsButton( private fun PeopleListOptionsButton(