Added empty state to banned member list (#2541)

* Added empty state to banned member list

* Center both empty states in `RoomMemberListView` and `PollHistoryView`

* Update screenshots

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
Jorge Martin Espinosa 2024-03-13 16:04:43 +01:00 committed by GitHub
parent f1730a1514
commit 4c14ac822e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 99 additions and 49 deletions

View file

@ -18,6 +18,7 @@ package io.element.android.features.poll.impl.history
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
@ -187,33 +188,46 @@ private fun PollHistoryList(
}
if (pollHistoryItems.isEmpty()) {
item {
val emptyStringResource = if (filter == PollHistoryFilter.PAST) {
stringResource(R.string.screen_polls_history_empty_past)
} else {
stringResource(R.string.screen_polls_history_empty_ongoing)
Column(
modifier = Modifier.fillParentMaxSize().padding(bottom = 24.dp),
verticalArrangement = Arrangement.Center,
) {
val emptyStringResource = if (filter == PollHistoryFilter.PAST) {
stringResource(R.string.screen_polls_history_empty_past)
} else {
stringResource(R.string.screen_polls_history_empty_ongoing)
}
Text(
text = emptyStringResource,
style = ElementTheme.typography.fontBodyLgRegular,
color = ElementTheme.colors.textSecondary,
modifier = Modifier.fillMaxWidth().padding(vertical = 24.dp, horizontal = 16.dp),
textAlign = TextAlign.Center,
)
if (hasMoreToLoad) {
LoadMoreButton(isLoading = isLoading, onClick = onLoadMore)
}
}
Text(
text = emptyStringResource,
style = ElementTheme.typography.fontBodyLgRegular,
color = ElementTheme.colors.textSecondary,
modifier = Modifier.padding(vertical = 24.dp, horizontal = 16.dp),
textAlign = TextAlign.Center,
)
}
}
if (hasMoreToLoad) {
} else if (hasMoreToLoad) {
item {
Button(
text = stringResource(CommonStrings.action_load_more),
showProgress = isLoading,
onClick = onLoadMore,
modifier = Modifier.padding(vertical = 24.dp),
)
LoadMoreButton(isLoading = isLoading, onClick = onLoadMore)
}
}
}
}
@Composable
private fun LoadMoreButton(isLoading: Boolean, onClick: () -> Unit) {
Button(
text = stringResource(CommonStrings.action_load_more),
showProgress = isLoading,
onClick = onClick,
modifier = Modifier.padding(vertical = 24.dp),
)
}
@Composable
private fun PollHistoryItemRow(
pollHistoryItem: PollHistoryItem,