mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
Refine loading logic
This commit is contained in:
@@ -33,6 +33,8 @@ struct PollHistory: View {
|
||||
|
||||
if viewModel.viewState.loadingState.isLoadingOnLanding {
|
||||
loadingView
|
||||
} else if viewModel.viewState.loadingState.isLoading == false, viewModel.viewState.polls.isEmpty {
|
||||
noPollsView
|
||||
} else {
|
||||
pollListView
|
||||
}
|
||||
@@ -57,19 +59,30 @@ struct PollHistory: View {
|
||||
PollListItem(pollData: pollData)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Button {
|
||||
#warning("handle action")
|
||||
} label: {
|
||||
Text("Load more polls")
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
loadMoreButton
|
||||
}
|
||||
.padding(.top, 32)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
}
|
||||
|
||||
private var loadMoreButton: some View {
|
||||
HStack(spacing: 8) {
|
||||
if viewModel.viewState.loadingState.isLoading {
|
||||
ProgressView()
|
||||
.progressViewStyle(CircularProgressViewStyle())
|
||||
}
|
||||
|
||||
Button {
|
||||
#warning("handle action")
|
||||
} label: {
|
||||
Text("Load more polls")
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
private var noPollsView: some View {
|
||||
Text(viewModel.mode == .active ? VectorL10n.pollHistoryNoActivePollText : VectorL10n.pollHistoryNoPastPollText)
|
||||
.font(theme.fonts.body)
|
||||
|
||||
Reference in New Issue
Block a user