Add emptyPollsText in the view model

This commit is contained in:
Alfonso Grillo
2023-01-24 09:47:50 +01:00
parent 562928507f
commit 22cca234be
3 changed files with 26 additions and 19 deletions
@@ -101,3 +101,20 @@ private extension PollHistoryViewModel {
state.polls = renderedPolls?.sorted(by: { $0.startDate > $1.startDate })
}
}
extension PollHistoryViewModel.Context {
var emptyPollsText: String {
let days = PollHistoryConstants.chunkSizeInDays
switch (viewState.bindings.mode, viewState.canLoadMoreContent) {
case (.active, true):
return VectorL10n.pollHistoryNoActivePollPeriodText("\(days)")
case (.active, false):
return VectorL10n.pollHistoryNoActivePollText
case (.past, true):
return VectorL10n.pollHistoryNoPastPollPeriodText("\(days)")
case (.past, false):
return VectorL10n.pollHistoryNoPastPollText
}
}
}