Skip to content

Commit 1c71ab2

Browse files
committed
Update host app UI
1 parent 7301c75 commit 1c71ab2

12 files changed

+478
-39
lines changed

Core/Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ let package = Package(
125125
"Client",
126126
"GitHubCopilotService",
127127
"SuggestionModel",
128+
"LaunchAgentManager"
128129
]
129130
),
130131

Core/Sources/HostApp/CustomCommandView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct CustomCommandView: View {
5858

5959
VStack(alignment: .leading) {
6060
Text(command.name)
61+
.foregroundStyle(.primary)
6162

6263
Group {
6364
switch command.feature {

Core/Sources/HostApp/DebugView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct DebugSettingsView: View {
1313
@StateObject var settings = DebugSettings()
1414

1515
var body: some View {
16-
Section {
16+
ScrollView {
1717
Form {
1818
Toggle(isOn: $settings.disableLazyVStack) {
1919
Text("Disable LazyVStack")
@@ -28,6 +28,7 @@ struct DebugSettingsView: View {
2828
Text("Trigger action with AccessibilityAPI")
2929
}
3030
}
31+
.padding()
3132
}
3233
}
3334
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import SwiftUI
2+
3+
struct ChatSettingsView: View {
4+
class Settings: ObservableObject {
5+
@AppStorage(\.chatFontSize) var chatFontSize
6+
@AppStorage(\.chatCodeFontSize) var chatCodeFontSize
7+
init() {}
8+
}
9+
10+
@StateObject var settings = Settings()
11+
12+
var body: some View {
13+
Form {
14+
HStack {
15+
TextField(text: .init(get: {
16+
"\(Int(settings.chatFontSize))"
17+
}, set: {
18+
settings.chatFontSize = Double(Int($0) ?? 0)
19+
})) {
20+
Text("Font size of chat message")
21+
}
22+
.textFieldStyle(.roundedBorder)
23+
24+
Text("pt")
25+
}
26+
27+
HStack {
28+
TextField(text: .init(get: {
29+
"\(Int(settings.chatCodeFontSize))"
30+
}, set: {
31+
settings.chatCodeFontSize = Double(Int($0) ?? 0)
32+
})) {
33+
Text("Font size of code block in chat")
34+
}
35+
.textFieldStyle(.roundedBorder)
36+
37+
Text("pt")
38+
}
39+
}
40+
}
41+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import SwiftUI
2+
3+
struct PromptToCodeSettingsView: View {
4+
final class Settings: ObservableObject {
5+
@AppStorage(\.hideCommonPrecedingSpacesInSuggestion)
6+
var hideCommonPrecedingSpacesInSuggestion
7+
@AppStorage(\.suggestionCodeFontSize)
8+
var suggestionCodeFontSize
9+
@AppStorage(\.acceptSuggestionWithAccessibilityAPI)
10+
var acceptSuggestionWithAccessibilityAPI
11+
init() {}
12+
}
13+
14+
@StateObject var settings = Settings()
15+
16+
var body: some View {
17+
VStack(alignment: .center) {
18+
Text("Mirroring Settings of Suggestions")
19+
.foregroundColor(.white)
20+
.padding(.vertical, 2)
21+
.padding(.horizontal, 8)
22+
.background(
23+
Color.accentColor,
24+
in: RoundedRectangle(cornerRadius: 20)
25+
)
26+
27+
Form {
28+
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
29+
Text("Hide Common Preceding Spaces")
30+
}.disabled(true)
31+
32+
HStack {
33+
TextField(text: .init(get: {
34+
"\(Int(settings.suggestionCodeFontSize))"
35+
}, set: {
36+
settings.suggestionCodeFontSize = Double(Int($0) ?? 0)
37+
})) {
38+
Text("Font size of suggestion code")
39+
}
40+
.textFieldStyle(.roundedBorder)
41+
42+
Text("pt")
43+
}.disabled(true)
44+
45+
Toggle(isOn: $settings.acceptSuggestionWithAccessibilityAPI) {
46+
Text("Use accessibility API to accept suggestion in widget")
47+
}.disabled(true)
48+
}
49+
}
50+
}
51+
}
52+
53+
struct PromptToCodeSettingsView_Previews: PreviewProvider {
54+
static var previews: some View {
55+
PromptToCodeSettingsView()
56+
}
57+
}
58+

Core/Sources/HostApp/FeatureSettings/SuggestionSettingsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ struct SuggestionFeatureEnabledProjectListView: View {
207207
}
208208
}
209209
}
210+
.focusable(false)
210211
.frame(width: 300, height: 400)
211212
.sheet(isPresented: $isAddingNewProject) {
212213
SuggestionFeatureAddEnabledProjectView(isOpen: $isAddingNewProject, settings: settings)

Core/Sources/HostApp/FeatureSettingsView.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,35 @@ struct FeatureSettingsView: View {
44
@State var tag = 0
55

66
var body: some View {
7-
SidebarTabView(tag: $tag) { tag in
7+
SidebarTabView(tag: $tag) {
88
ScrollView {
99
SuggestionSettingsView()
1010
}
1111
.padding()
1212
.sidebarItem(
1313
tag: 0,
14-
currentTag: tag,
1514
title: "Suggestion",
1615
subtitle: "Generate suggestions for your code",
1716
image: "lightbulb.circle.fill"
1817
)
1918

2019
ScrollView {
21-
SuggestionSettingsView()
20+
ChatSettingsView()
2221
}
2322
.padding()
2423
.sidebarItem(
2524
tag: 1,
26-
currentTag: tag,
2725
title: "Chat",
2826
subtitle: "Chat about your code",
2927
image: "bubble.right.circle.fill"
3028
)
3129

3230
ScrollView {
33-
SuggestionSettingsView()
31+
PromptToCodeSettingsView()
3432
}
3533
.padding()
3634
.sidebarItem(
3735
tag: 2,
38-
currentTag: tag,
3936
title: "Prompt to Code",
4037
subtitle: "Write code with natural language",
4138
image: "square.and.pencil.circle.fill"

0 commit comments

Comments
 (0)