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,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
)
|
)
|
||||||
Button(
|
if (!isOnOtherInstance) {
|
||||||
modifier = Modifier
|
Button(
|
||||||
.align(Alignment.CenterHorizontally)
|
modifier = Modifier
|
||||||
.padding(top = Spacing.m),
|
.align(Alignment.CenterHorizontally)
|
||||||
onClick = {
|
.padding(top = Spacing.m),
|
||||||
when (community.subscribed) {
|
onClick = {
|
||||||
true -> model.reduce(CommunityDetailMviModel.Intent.Unsubscribe)
|
when (community.subscribed) {
|
||||||
false -> model.reduce(CommunityDetailMviModel.Intent.Subscribe)
|
true -> model.reduce(CommunityDetailMviModel.Intent.Unsubscribe)
|
||||||
else -> Unit
|
false -> model.reduce(CommunityDetailMviModel.Intent.Subscribe)
|
||||||
}
|
else -> Unit
|
||||||
},
|
}
|
||||||
) {
|
},
|
||||||
Row(
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
) {
|
||||||
Image(
|
Row(
|
||||||
imageVector = when (community.subscribed) {
|
horizontalArrangement = Arrangement.spacedBy(Spacing.s),
|
||||||
true -> Icons.Default.Check
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
false -> Icons.Default.AddCircle
|
) {
|
||||||
else -> Icons.Default.MoreHoriz
|
Image(
|
||||||
},
|
imageVector = when (community.subscribed) {
|
||||||
contentDescription = null,
|
true -> Icons.Default.Check
|
||||||
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary),
|
false -> Icons.Default.AddCircle
|
||||||
)
|
else -> Icons.Default.MoreHoriz
|
||||||
Text(
|
},
|
||||||
text = when (community.subscribed) {
|
contentDescription = null,
|
||||||
true -> stringResource(MR.strings.community_button_subscribed)
|
colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary),
|
||||||
false -> stringResource(MR.strings.community_button_subscribe)
|
)
|
||||||
else -> stringResource(MR.strings.community_button_pending)
|
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(
|
val items = communityRepository.getSubscribed(
|
||||||
auth = auth,
|
auth = auth,
|
||||||
).filter {
|
).filter {
|
||||||
it.name.contains(searchText)
|
if (searchText.isNotBlank()) {
|
||||||
|
it.name.contains(searchText)
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
currentPage++
|
currentPage++
|
||||||
mvi.updateState {
|
mvi.updateState {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user