Skip to content

Commit ed339b6

Browse files
committed
Replace wrappers with SubSection
1 parent 966f654 commit ed339b6

File tree

4 files changed

+111
-128
lines changed

4 files changed

+111
-128
lines changed

Core/Sources/HostApp/AccountSettings/CodeiumView.swift

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct CodeiumView: View {
135135

136136
var body: some View {
137137
VStack(alignment: .leading) {
138-
VStack(alignment: .leading) {
138+
SubSection(title: Text("Codeium Language Server")) {
139139
switch viewModel.installationStatus {
140140
case .notInstalled:
141141
HStack {
@@ -185,12 +185,6 @@ struct CodeiumView: View {
185185
}
186186
}
187187
}
188-
.padding(8)
189-
.frame(maxWidth: .infinity, alignment: .leading)
190-
.overlay {
191-
RoundedRectangle(cornerRadius: 8)
192-
.stroke(Color(nsColor: .separatorColor), style: .init(lineWidth: 1))
193-
}
194188
.sheet(isPresented: $isSignInPanelPresented) {
195189
CodeiumSignInView(viewModel: viewModel, isPresented: $isSignInPanelPresented)
196190
}
@@ -209,16 +203,12 @@ struct CodeiumView: View {
209203
}
210204
}
211205

212-
Form {
213-
Toggle("Codeium Enterprise Mode", isOn: $viewModel.codeiumEnterpriseMode)
214-
TextField("Codeium Portal URL", text: $viewModel.codeiumPortalUrl)
215-
TextField("Codeium API URL", text: $viewModel.codeiumApiUrl)
216-
}
217-
.padding(8)
218-
.frame(maxWidth: .infinity, alignment: .leading)
219-
.overlay {
220-
RoundedRectangle(cornerRadius: 8)
221-
.stroke(Color(nsColor: .separatorColor), style: .init(lineWidth: 1))
206+
SubSection(title: Text("Enterprise")) {
207+
Form {
208+
Toggle("Codeium Enterprise Mode", isOn: $viewModel.codeiumEnterpriseMode)
209+
TextField("Codeium Portal URL", text: $viewModel.codeiumPortalUrl)
210+
TextField("Codeium API URL", text: $viewModel.codeiumApiUrl)
211+
}
222212
}
223213

224214
SettingsDivider("Advanced")
@@ -305,32 +295,34 @@ struct CodeiumView_Previews: PreviewProvider {
305295
}
306296

307297
static var previews: some View {
308-
VStack(alignment: .leading, spacing: 8) {
309-
CodeiumView(viewModel: TestViewModel(
310-
isSignedIn: false,
311-
installationStatus: .notInstalled,
312-
installationStep: nil
313-
))
314-
315-
CodeiumView(viewModel: TestViewModel(
316-
isSignedIn: true,
317-
installationStatus: .installed("1.2.9"),
318-
installationStep: nil
319-
))
320-
321-
CodeiumView(viewModel: TestViewModel(
322-
isSignedIn: true,
323-
installationStatus: .outdated(current: "1.2.9", latest: "1.3.0"),
324-
installationStep: .downloading
325-
))
326-
327-
CodeiumView(viewModel: TestViewModel(
328-
isSignedIn: true,
329-
installationStatus: .unsupported(current: "1.5.9", latest: "1.3.0"),
330-
installationStep: .downloading
331-
))
298+
ScrollView {
299+
VStack(alignment: .leading, spacing: 8) {
300+
CodeiumView(viewModel: TestViewModel(
301+
isSignedIn: false,
302+
installationStatus: .notInstalled,
303+
installationStep: nil
304+
))
305+
306+
CodeiumView(viewModel: TestViewModel(
307+
isSignedIn: true,
308+
installationStatus: .installed("1.2.9"),
309+
installationStep: nil
310+
))
311+
312+
CodeiumView(viewModel: TestViewModel(
313+
isSignedIn: true,
314+
installationStatus: .outdated(current: "1.2.9", latest: "1.3.0"),
315+
installationStep: .downloading
316+
))
317+
318+
CodeiumView(viewModel: TestViewModel(
319+
isSignedIn: true,
320+
installationStatus: .unsupported(current: "1.5.9", latest: "1.3.0"),
321+
installationStep: .downloading
322+
))
323+
}
324+
.padding(8)
332325
}
333-
.padding(8)
334326
}
335327
}
336328

Core/Sources/HostApp/AccountSettings/GitHubCopilotView.swift

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -142,72 +142,67 @@ struct GitHubCopilotView: View {
142142
var body: some View {
143143
HStack {
144144
VStack(alignment: .leading, spacing: 8) {
145-
Form {
146-
TextField(
147-
text: $settings.nodePath,
148-
prompt: Text(
149-
"node"
145+
SubSection(
146+
title: Text("Node Settings"),
147+
description: """
148+
You may have to restart the extension app to apply the changes. To do so, simply close the helper app by clicking on the menu bar icon that looks like a tentacle, it will automatically restart as needed.
149+
"""
150+
) {
151+
Form {
152+
TextField(
153+
text: $settings.nodePath,
154+
prompt: Text(
155+
"node"
156+
)
157+
) {
158+
Text("Path to Node (v18+)")
159+
}
160+
161+
Text(
162+
"Provide the path to the executable if it can't be found by the app, shim executable is not supported"
150163
)
151-
) {
152-
Text("Path to Node (v18+)")
153-
}
154-
155-
Text(
156-
"Provide the path to the executable if it can't be found by the app, shim executable is not supported"
157-
)
158-
.lineLimit(10)
159-
.foregroundColor(.secondary)
160-
.font(.callout)
161-
.dynamicHeightTextInFormWorkaround()
162-
163-
Picker(selection: $settings.runNodeWith) {
164-
ForEach(NodeRunner.allCases, id: \.rawValue) { runner in
165-
switch runner {
164+
.lineLimit(10)
165+
.foregroundColor(.secondary)
166+
.font(.callout)
167+
.dynamicHeightTextInFormWorkaround()
168+
169+
Picker(selection: $settings.runNodeWith) {
170+
ForEach(NodeRunner.allCases, id: \.rawValue) { runner in
171+
switch runner {
172+
case .env:
173+
Text("/usr/bin/env").tag(runner)
174+
case .bash:
175+
Text("/bin/bash -i -l").tag(runner)
176+
case .shell:
177+
Text("$SHELL -i -l").tag(runner)
178+
}
179+
}
180+
} label: {
181+
Text("Run Node with")
182+
}
183+
184+
Group {
185+
switch settings.runNodeWith {
166186
case .env:
167-
Text("/usr/bin/env").tag(runner)
187+
Text(
188+
"PATH: `/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`"
189+
)
168190
case .bash:
169-
Text("/bin/bash -i -l").tag(runner)
191+
Text("PATH inherited from bash configurations.")
170192
case .shell:
171-
Text("$SHELL -i -l").tag(runner)
193+
Text("PATH inherited from $SHELL configurations.")
172194
}
173195
}
174-
} label: {
175-
Text("Run Node with")
176-
}
177-
178-
Group {
179-
switch settings.runNodeWith {
180-
case .env:
181-
Text(
182-
"PATH: `/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`"
183-
)
184-
case .bash:
185-
Text("PATH inherited from bash configurations.")
186-
case .shell:
187-
Text("PATH inherited from $SHELL configurations.")
188-
}
196+
.lineLimit(10)
197+
.foregroundColor(.secondary)
198+
.font(.callout)
199+
.dynamicHeightTextInFormWorkaround()
189200
}
190-
.lineLimit(10)
191-
.foregroundColor(.secondary)
192-
.font(.callout)
193-
.dynamicHeightTextInFormWorkaround()
194-
195-
Spacer()
196-
197-
Text("""
198-
You may have to restart the helper app to apply the changes. To do so, simply close the helper app by clicking on the menu bar icon that looks like a tentacle, it will automatically restart as needed.
199-
""")
200-
.lineLimit(6)
201-
.dynamicHeightTextInFormWorkaround()
202-
.foregroundColor(.secondary)
203-
}
204-
.padding(8)
205-
.overlay {
206-
RoundedRectangle(cornerRadius: 8)
207-
.stroke(Color(nsColor: .separatorColor), style: .init(lineWidth: 1))
208201
}
209202

210-
VStack(alignment: .leading) {
203+
SubSection(
204+
title: Text("GitHub Copilot Language Server")
205+
) {
211206
HStack {
212207
switch viewModel.installationStatus {
213208
case .none:
@@ -263,12 +258,6 @@ struct GitHubCopilotView: View {
263258
.opacity(isRunningAction ? 0.8 : 1)
264259
.disabled(isRunningAction)
265260
}
266-
.padding(8)
267-
.frame(maxWidth: .infinity, alignment: .leading)
268-
.overlay {
269-
RoundedRectangle(cornerRadius: 8)
270-
.stroke(Color(nsColor: .separatorColor), style: .init(lineWidth: 1))
271-
}
272261

273262
SettingsDivider("Advanced")
274263

Core/Sources/HostApp/CustomCommandSettings/CustomCommandView.swift

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import ComposableArchitecture
22
import MarkdownUI
33
import PlusFeatureFlag
44
import Preferences
5-
import SwiftUI
65
import SharedUIComponents
6+
import SwiftUI
77

88
extension List {
99
@ViewBuilder
@@ -155,27 +155,29 @@ struct CustomCommandView: View {
155155
)) { store in
156156
EditCustomCommandView(store: store)
157157
} else: {
158-
CustomCommandTypeDescription(text: """
159-
# Send Message
160-
161-
This command sends a message to the active chat tab. You can provide additional context through the "Extra System Prompt" as well.
162-
163-
# Prompt to Code
164-
165-
This command opens the prompt-to-code panel and executes the provided requirements on the selected code. You can provide additional context through the "Extra Context" as well.
166-
167-
# Custom Chat
168-
169-
This command will overwrite the system prompt to let the bot behave differently.
170-
171-
# Single Round Dialog
172-
173-
This command allows you to send a message to a temporary chat without opening the chat panel.
174-
175-
It is particularly useful for one-time commands, such as running a terminal command with `/run`.
176-
177-
For example, you can set the prompt to `/run open .` to open the project in Finder.
178-
""")
158+
VStack {
159+
SubSection(title: Text("Send Message")) {
160+
Text(
161+
"This command sends a message to the active chat tab. You can provide additional context through the \"Extra System Prompt\" as well."
162+
)
163+
}
164+
SubSection(title: Text("Prompt to Code")) {
165+
Text(
166+
"This command opens the prompt-to-code panel and executes the provided requirements on the selected code. You can provide additional context through the \"Extra Context\" as well."
167+
)
168+
}
169+
SubSection(title: Text("Custom Chat")) {
170+
Text(
171+
"This command will overwrite the system prompt to let the bot behave differently."
172+
)
173+
}
174+
SubSection(title: Text("Single Round Dialog")) {
175+
Text(
176+
"This command allows you to send a message to a temporary chat without opening the chat panel. It is particularly useful for one-time commands, such as running a terminal command with `/run`. For example, you can set the prompt to `/run open .` to open the project in Finder."
177+
)
178+
}
179+
}
180+
.padding()
179181
}
180182
}
181183
}

Core/Sources/HostApp/FeatureSettings/ChatSettingsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ struct ChatSettingsView: View {
260260

261261
SubSection(
262262
title: Text("Code Scope"),
263-
description: "Enable the bot to read the code and metadata in the editing file."
263+
description: "Enable the bot to read the code and metadata of the editing file."
264264
) {
265265
Form {
266266
Toggle(isOn: $settings.enableCodeScopeByDefaultInChatContext) {

0 commit comments

Comments
 (0)