-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathReviewSummarySection.swift
More file actions
49 lines (40 loc) · 1.67 KB
/
ReviewSummarySection.swift
File metadata and controls
49 lines (40 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import SwiftUI
import ConversationServiceProvider
import SharedUIComponents
struct ReviewSummarySection: View {
var round: CodeReviewRound
@AppStorage(\.chatFontSize) var chatFontSize
var body: some View {
HStack {
if round.status == .error, let errorMessage = round.error {
Text(errorMessage)
.scaledFont(size: chatFontSize)
} else if round.status == .completed, let request = round.request, let response = round.response {
CompletedSummary(request: request, response: response)
} else {
Text("Oops, failed to review changes.")
.font(.system(size: chatFontSize))
}
Spacer()
}
}
}
struct CompletedSummary: View {
var request: CodeReviewRequest
var response: CodeReviewResponse
@AppStorage(\.chatFontSize) var chatFontSize
var body: some View {
let changedFileUris = request.changedFileUris
let selectedFileUris = request.selectedFileUris
let allComments = response.allComments
VStack(alignment: .leading, spacing: 8) {
Text("Total comments: \(allComments.count)")
if allComments.count > 0 {
Text("Review complete! We found \(allComments.count) comment(s) in your selected file(s). Click a file name to see details in the editor.")
} else {
Text("Copilot reviewed \(selectedFileUris.count) out of \(changedFileUris.count) changed files, and no comments were found.")
}
}
.scaledFont(size: chatFontSize)
}
}