Forward current composer text to the new poll form to serve as the question/topic

This commit is contained in:
Stefan Ceriu
2026-05-22 13:01:22 +03:00
parent ac20ff0fc3
commit 77c5aba326
11 changed files with 26 additions and 21 deletions
@@ -22,8 +22,8 @@ struct PollFormScreenViewState: BindableState {
self.maxNumberOfOptions = maxNumberOfOptions
switch mode {
case .new:
bindings = .init()
case .new(let topic):
bindings = .init(question: topic ?? "")
case .edit(_, let poll):
bindings = .init(poll: poll)
}
@@ -71,7 +71,7 @@ struct PollFormScreenViewState: BindableState {
}
enum PollFormMode: Hashable {
case new
case new(topic: String?)
case edit(eventID: String, poll: Poll)
}
@@ -198,7 +198,7 @@ private struct PollFormOptionRow: View {
// MARK: - Previews
struct PollFormScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = makeViewModel(mode: .new)
static let viewModel = makeViewModel(mode: .new(topic: nil))
static let editViewModel = makeViewModel(mode: .edit(eventID: "1234", poll: poll))
static let poll = Poll(question: "Cats or Dogs?",
kind: .disclosed,