Move questions and reviews into the transcript; agents answer findings
This commit is contained in:
@@ -9,35 +9,6 @@ private let delegateText = "Use your judgment for this decision and continue wit
|
||||
private let otherStop = "\u{0}other"
|
||||
private let httpURL = Re(#"^https?://"#, caseless: true)
|
||||
|
||||
struct QuestionsView: View {
|
||||
@Environment(Store.self) private var store
|
||||
|
||||
var body: some View {
|
||||
let taskId = store.selectedTaskId
|
||||
let picked = store.question.flatMap { $0.taskId == taskId ? store.questionItem($0.itemId) : nil }
|
||||
let shown = picked ?? store.inbox.filter { $0.taskId == taskId }.sorted { $0.createdAt < $1.createdAt }.first
|
||||
VStack(spacing: 0) {
|
||||
ChangesView(compact: true)
|
||||
if taskId == nil {
|
||||
EmptyText(text: "No task selected.")
|
||||
} else if let shown {
|
||||
let key = "\(shown.id)/\(shown.state.rawValue)/\(shown.responses.count)"
|
||||
ScrollView {
|
||||
QuestionCard(item: shown)
|
||||
.id(key)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.top, 12)
|
||||
.padding(.bottom, 16)
|
||||
}
|
||||
.id(shown.id)
|
||||
} else {
|
||||
EmptyText(text: "Nothing waiting on you in this task.")
|
||||
}
|
||||
}
|
||||
.frame(maxHeight: .infinity, alignment: .top)
|
||||
}
|
||||
}
|
||||
|
||||
private func numberChoices(_ blocks: [MDBlock], _ next: inout Int) -> [MDBlock] {
|
||||
blocks.map { block in
|
||||
switch block {
|
||||
@@ -179,13 +150,6 @@ private final class CardModel {
|
||||
_ = try await store.api.client.respondInbox(body: .json(.init(responses: [r]))).ok
|
||||
store.drafts?.clearAnswer(item.id)
|
||||
store.paneFocus.setDraft(key, false)
|
||||
if store.question?.itemId == item.id {
|
||||
store.question = nil
|
||||
}
|
||||
let others = store.inbox.contains { $0.taskId == item.taskId && $0.id != item.id }
|
||||
if !others && store.focus.tab == .questions && store.selectedTaskId == item.taskId {
|
||||
store.focusTab(.transcript)
|
||||
}
|
||||
} catch {
|
||||
store.images.restore(key, imgs)
|
||||
overlays.showAlert(errorText(error))
|
||||
@@ -206,7 +170,7 @@ private final class CardModel {
|
||||
}
|
||||
}
|
||||
|
||||
private struct QuestionCard: View {
|
||||
struct QuestionCard: View {
|
||||
let item: InboxItem
|
||||
@Environment(Store.self) private var store
|
||||
@Environment(Overlays.self) private var overlays
|
||||
|
||||
Reference in New Issue
Block a user