Skip to content

Commit 118d56a

Browse files
committed
Update UI
1 parent 1c71ab2 commit 118d56a

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

Core/Sources/HostApp/FeatureSettings/PromptToCodeSettingsView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ struct PromptToCodeSettingsView: View {
1515

1616
var body: some View {
1717
VStack(alignment: .center) {
18-
Text("Mirroring Settings of Suggestions")
18+
Text("Mirroring Settings of Suggestion Feature")
1919
.foregroundColor(.white)
2020
.padding(.vertical, 2)
2121
.padding(.horizontal, 8)
2222
.background(
2323
Color.accentColor,
2424
in: RoundedRectangle(cornerRadius: 20)
2525
)
26+
.shadow(radius: 5)
2627

2728
Form {
2829
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
@@ -41,6 +42,8 @@ struct PromptToCodeSettingsView: View {
4142

4243
Text("pt")
4344
}.disabled(true)
45+
46+
Divider()
4447

4548
Toggle(isOn: $settings.acceptSuggestionWithAccessibilityAPI) {
4649
Text("Use accessibility API to accept suggestion in widget")

Core/Sources/HostApp/FeatureSettings/SuggestionSettingsView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ struct SuggestionSettingsView: View {
7474
)
7575
}
7676

77-
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
78-
Text("Hide Common Preceding Spaces")
79-
}
8077
HStack {
8178
Slider(value: $settings.realtimeSuggestionDebounce, in: 0...2, step: 0.1) {
8279
Text("Real-time Suggestion Debounce")
@@ -99,6 +96,10 @@ struct SuggestionSettingsView: View {
9996
}
10097

10198
Group {
99+
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
100+
Text("Hide Common Preceding Spaces")
101+
}
102+
102103
HStack {
103104
TextField(text: .init(get: {
104105
"\(Int(settings.suggestionCodeFontSize))"

Core/Sources/HostApp/SidebarTabView.swift

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
import SwiftUI
22

3-
struct SidebarItem: Identifiable, Equatable {
3+
private struct SidebarItem: Identifiable, Equatable {
44
var id: Int { tag }
55
var tag: Int
66
var title: String
77
var subtitle: String? = nil
88
var image: String? = nil
99
}
1010

11-
struct SidebarItemPreferenceKey: PreferenceKey {
11+
private struct SidebarItemPreferenceKey: PreferenceKey {
1212
static var defaultValue: [SidebarItem] = []
1313
static func reduce(value: inout [SidebarItem], nextValue: () -> [SidebarItem]) {
1414
value.append(contentsOf: nextValue())
1515
}
1616
}
1717

18-
struct SidebarTabTagKey: EnvironmentKey {
18+
private struct SidebarTabTagKey: EnvironmentKey {
1919
static var defaultValue: Int = 0
2020
}
2121

22-
extension EnvironmentValues {
22+
private extension EnvironmentValues {
2323
var sidebarTabTag: Int {
2424
get { self[SidebarTabTagKey.self] }
2525
set { self[SidebarTabTagKey.self] = newValue }
2626
}
2727
}
2828

29-
struct SidebarTabViewWrapper<Content: View>: View {
29+
private struct SidebarTabViewWrapper<Content: View>: View {
3030
@Environment(\.sidebarTabTag) var sidebarTabTag
3131
var tag: Int
3232
var title: String
@@ -35,12 +35,17 @@ struct SidebarTabViewWrapper<Content: View>: View {
3535
var content: () -> Content
3636

3737
var body: some View {
38-
content()
39-
.opacity(tag != sidebarTabTag ? 0 : 1)
40-
.preference(
41-
key: SidebarItemPreferenceKey.self,
42-
value: [.init(tag: tag, title: title, subtitle: subtitle, image: image)]
43-
)
38+
Group {
39+
if tag == sidebarTabTag {
40+
content()
41+
} else {
42+
Color.clear
43+
}
44+
}
45+
.preference(
46+
key: SidebarItemPreferenceKey.self,
47+
value: [.init(tag: tag, title: title, subtitle: subtitle, image: image)]
48+
)
4449
}
4550
}
4651

@@ -62,7 +67,7 @@ extension View {
6267
}
6368

6469
struct SidebarTabView<Content: View>: View {
65-
@State var sidebarItems = [SidebarItem]()
70+
@State private var sidebarItems = [SidebarItem]()
6671
@Binding var tag: Int
6772
@ViewBuilder var views: () -> Content
6873
var body: some View {
@@ -87,7 +92,7 @@ struct SidebarTabView<Content: View>: View {
8792
Text(subtitle)
8893
.lineSpacing(0)
8994
.font(.caption)
90-
.foregroundStyle(.tertiary)
95+
.foregroundStyle(.secondary)
9196
.opacity(0.5)
9297
.multilineTextAlignment(.leading)
9398
}
@@ -101,8 +106,9 @@ struct SidebarTabView<Content: View>: View {
101106
in: RoundedRectangle(cornerRadius: 4)
102107
)
103108
.padding(.horizontal, 8)
109+
.contentShape(Rectangle())
104110
}
105-
.buttonStyle(.borderless)
111+
.buttonStyle(.plain)
106112
}
107113
}
108114
.frame(width: 200)

Core/Sources/HostApp/TabContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct TabBar: View {
6868
TabBarButton(
6969
currentTab: $tab,
7070
title: "Custom Command",
71-
image: "puzzlepiece.extension",
71+
image: "command.square",
7272
tab: tab
7373
)
7474
case .debug:

0 commit comments

Comments
 (0)