Poll history : add empty state
This commit is contained in:
@@ -123,6 +123,7 @@ fun PollHistoryView(
|
||||
val filter = PollHistoryFilter.entries[page]
|
||||
val pollHistoryItems = state.pollHistoryForFilter(filter)
|
||||
PollHistoryList(
|
||||
filter = filter,
|
||||
pollHistoryItems = pollHistoryItems,
|
||||
hasMoreToLoad = state.hasMoreToLoad,
|
||||
isLoading = state.isLoading,
|
||||
@@ -160,6 +161,7 @@ private fun PollHistoryFilterButtons(
|
||||
|
||||
@Composable
|
||||
private fun PollHistoryList(
|
||||
filter: PollHistoryFilter,
|
||||
pollHistoryItems: ImmutableList<PollHistoryItem>,
|
||||
hasMoreToLoad: Boolean,
|
||||
isLoading: Boolean,
|
||||
@@ -184,6 +186,21 @@ private fun PollHistoryList(
|
||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp)
|
||||
)
|
||||
}
|
||||
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)
|
||||
}
|
||||
Text(
|
||||
text = emptyStringResource,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
color = ElementTheme.colors.textSecondary,
|
||||
modifier = Modifier.padding(vertical = 24.dp, horizontal = 16.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
if (hasMoreToLoad) {
|
||||
item {
|
||||
Button(
|
||||
|
||||
Reference in New Issue
Block a user