Skip to content

Commit b894967

Browse files
committed
Update UI
1 parent 68ccf69 commit b894967

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

Core/Sources/Service/GUI/RealtimeSuggestionIndicatorController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ final class RealtimeSuggestionIndicatorController {
4848
var body: some View {
4949
Circle()
5050
.fill(Color.accentColor.opacity(opacityA))
51+
.opacity(0.7)
5152
.scaleEffect(.init(width: scaleA, height: scaleA))
5253
.frame(width: 8, height: 8)
5354
.overlay {

Core/Sources/SuggestionWidget/SuggestionPanelView.swift

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,31 @@ struct SuggestionPanelView: View {
3636
ScrollView {
3737
CodeBlock(viewModel: viewModel)
3838
}
39+
.background(Color(red: 31 / 255, green: 31 / 255, blue: 36 / 255))
3940

4041
ToolBar(viewModel: viewModel)
4142
}
4243
}
4344
.frame(maxWidth: .infinity, maxHeight: Style.panelHeight)
4445
.fixedSize(horizontal: false, vertical: true)
45-
.background(Color(red: 31 / 255, green: 31 / 255, blue: 36 / 255))
4646
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
4747
.overlay(
4848
RoundedRectangle(cornerRadius: 8, style: .continuous)
4949
.stroke(Color.black.opacity(0.3), style: .init(lineWidth: 1))
5050
)
51+
.overlay(
52+
RoundedRectangle(cornerRadius: 7, style: .continuous)
53+
.stroke(Color.white.opacity(0.2), style: .init(lineWidth: 1))
54+
.padding(2)
55+
)
5156

5257
.onHover { yes in
5358
withAnimation(.easeInOut(duration: 0.2)) {
5459
isHovering = yes
5560
}
5661
}
5762
.allowsHitTesting(viewModel.isPanelDisplayed && !viewModel.suggestion.isEmpty)
63+
.preferredColorScheme(.dark)
5864

5965
Spacer()
6066
.frame(minHeight: 0, maxHeight: .infinity)
@@ -101,35 +107,52 @@ struct CodeBlock: View {
101107
}))
102108
}
103109
}
104-
110+
105111
struct ToolBar: View {
106112
@ObservedObject var viewModel: SuggestionPanelViewModel
107113

108114
var body: some View {
109115
HStack {
110-
Text("\(viewModel.currentSuggestionIndex + 1)/\(viewModel.suggestionCount)")
116+
Button(action: {
117+
Task {
118+
try await Environment.triggerAction("Previous Suggestion")
119+
}
120+
}) {
121+
Image(systemName: "chevron.left")
122+
}.buttonStyle(.plain)
123+
124+
Text("\(viewModel.currentSuggestionIndex + 1) / \(viewModel.suggestionCount)")
111125
.monospacedDigit()
126+
127+
Button(action: {
128+
Task {
129+
try await Environment.triggerAction("Next Suggestion")
130+
}
131+
}) {
132+
Image(systemName: "chevron.right")
133+
}.buttonStyle(.plain)
112134

113135
Spacer()
114136

115137
Button(action: {
116138
Task {
117-
try await Environment.triggerAction("Accept Suggestion")
139+
try await Environment.triggerAction("Reject Suggestion")
118140
}
119141
}) {
120-
Text("Accept")
121-
}.buttonStyle(CommandButtonStyle(color: .green))
142+
Text("Reject")
143+
}.buttonStyle(CommandButtonStyle(color: .gray))
144+
122145
Button(action: {
123146
Task {
124-
try await Environment.triggerAction("Reject Suggestion")
147+
try await Environment.triggerAction("Accept Suggestion")
125148
}
126149
}) {
127-
Text("Reject")
128-
}.buttonStyle(CommandButtonStyle(color: .red))
150+
Text("Accept")
151+
}.buttonStyle(CommandButtonStyle(color: .indigo))
129152
}
130153
.padding()
131-
.foregroundColor(.white)
132-
.background(Color.white.opacity(0.1))
154+
.foregroundColor(.secondary)
155+
.background(.thickMaterial)
133156
}
134157
}
135158

@@ -171,5 +194,12 @@ struct SuggestionPanelView_Preview: PreviewProvider {
171194
isPanelDisplayed: true
172195
))
173196
.frame(width: 450, height: 400)
197+
.background {
198+
HStack {
199+
Color.red
200+
Color.green
201+
Color.blue
202+
}
203+
}
174204
}
175205
}

0 commit comments

Comments
 (0)