mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-09 12:48:42 +01:00
fix(community): improvements to community list and detail
This commit is contained in:
parent
9787bc533f
commit
2b9dfa799b
@ -299,38 +299,40 @@ class CommunityDetailScreen(
|
||||
},
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(top = Spacing.m),
|
||||
onClick = {
|
||||
when (community.subscribed) {
|
||||
true -> model.reduce(CommunityDetailMviModel.Intent.Unsubscribe)
|
||||
false -> model.reduce(CommunityDetailMviModel.Intent.Subscribe)
|
||||
else -> Unit
|
||||
}
|
||||
},
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
if (!isOnOtherInstance) {
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(top = Spacing.m),
|
||||
onClick = {
|
||||
when (community.subscribed) {
|
||||
true -> model.reduce(CommunityDetailMviModel.Intent.Unsubscribe)
|
||||
false -> model.reduce(CommunityDetailMviModel.Intent.Subscribe)
|
||||
else -> Unit
|
||||
}
|
||||
},
|
||||
) {
|
||||
Image(
|
||||
imageVector = when (community.subscribed) {
|
||||
true -> Icons.Default.Check
|
||||
false -> Icons.Default.AddCircle
|
||||
else -> Icons.Default.MoreHoriz
|
||||
},
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary),
|
||||
)
|
||||
Text(
|
||||
text = when (community.subscribed) {
|
||||
true -> stringResource(MR.strings.community_button_subscribed)
|
||||
false -> stringResource(MR.strings.community_button_subscribe)
|
||||
else -> stringResource(MR.strings.community_button_pending)
|
||||
},
|
||||
)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Image(
|
||||
imageVector = when (community.subscribed) {
|
||||
true -> Icons.Default.Check
|
||||
false -> Icons.Default.AddCircle
|
||||
else -> Icons.Default.MoreHoriz
|
||||
},
|
||||
contentDescription = null,
|
||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary),
|
||||
)
|
||||
Text(
|
||||
text = when (community.subscribed) {
|
||||
true -> stringResource(MR.strings.community_button_subscribed)
|
||||
false -> stringResource(MR.strings.community_button_subscribe)
|
||||
else -> stringResource(MR.strings.community_button_pending)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,11 @@ class CommunityListViewModel(
|
||||
val items = communityRepository.getSubscribed(
|
||||
auth = auth,
|
||||
).filter {
|
||||
it.name.contains(searchText)
|
||||
if (searchText.isNotBlank()) {
|
||||
it.name.contains(searchText)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
currentPage++
|
||||
mvi.updateState {
|
||||
|
Loading…
x
Reference in New Issue
Block a user