Poll history : add empty state
This commit is contained in:
parent
01ec3e85e4
commit
6020bf7b44
1 changed files with 17 additions and 0 deletions
|
|
@ -123,6 +123,7 @@ fun PollHistoryView(
|
||||||
val filter = PollHistoryFilter.entries[page]
|
val filter = PollHistoryFilter.entries[page]
|
||||||
val pollHistoryItems = state.pollHistoryForFilter(filter)
|
val pollHistoryItems = state.pollHistoryForFilter(filter)
|
||||||
PollHistoryList(
|
PollHistoryList(
|
||||||
|
filter = filter,
|
||||||
pollHistoryItems = pollHistoryItems,
|
pollHistoryItems = pollHistoryItems,
|
||||||
hasMoreToLoad = state.hasMoreToLoad,
|
hasMoreToLoad = state.hasMoreToLoad,
|
||||||
isLoading = state.isLoading,
|
isLoading = state.isLoading,
|
||||||
|
|
@ -160,6 +161,7 @@ private fun PollHistoryFilterButtons(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PollHistoryList(
|
private fun PollHistoryList(
|
||||||
|
filter: PollHistoryFilter,
|
||||||
pollHistoryItems: ImmutableList<PollHistoryItem>,
|
pollHistoryItems: ImmutableList<PollHistoryItem>,
|
||||||
hasMoreToLoad: Boolean,
|
hasMoreToLoad: Boolean,
|
||||||
isLoading: Boolean,
|
isLoading: Boolean,
|
||||||
|
|
@ -184,6 +186,21 @@ private fun PollHistoryList(
|
||||||
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp)
|
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) {
|
if (hasMoreToLoad) {
|
||||||
item {
|
item {
|
||||||
Button(
|
Button(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue