Skip to content

Commit 7e50ff9

Browse files
committed
Adjust Branch Picker and Scheme Dropdown
1 parent f39c497 commit 7e50ff9

File tree

4 files changed

+130
-42
lines changed

4 files changed

+130
-42
lines changed

CodeEdit/Features/ActivityViewer/ActivityViewer.swift

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,34 @@ struct ActivityViewer: View {
3232
self.taskManager = taskManager
3333
}
3434
var body: some View {
35+
Group {
36+
if #available(macOS 26, *) {
37+
content
38+
.fixedSize(horizontal: false, vertical: false)
39+
.padding(.horizontal, 4)
40+
} else {
41+
content
42+
.fixedSize(horizontal: false, vertical: false)
43+
.padding(.horizontal, 5)
44+
.padding(.vertical, 1.5)
45+
.frame(height: 22)
46+
.clipped()
47+
.background {
48+
if colorScheme == .dark {
49+
RoundedRectangle(cornerRadius: 5)
50+
.opacity(0.1)
51+
} else {
52+
RoundedRectangle(cornerRadius: 5)
53+
.opacity(0.1)
54+
}
55+
}
56+
}
57+
}
58+
.accessibilityElement(children: .contain)
59+
.accessibilityLabel("Activity Viewer")
60+
}
61+
62+
@ViewBuilder private var content: some View {
3563
HStack(spacing: 0) {
3664
SchemeDropDownView(
3765
workspaceSettingsManager: workspaceSettingsManager,
@@ -45,21 +73,5 @@ struct ActivityViewer: View {
4573
TaskNotificationView(taskNotificationHandler: taskNotificationHandler)
4674
.fixedSize()
4775
}
48-
.fixedSize(horizontal: false, vertical: false)
49-
.padding(.horizontal, 5)
50-
.padding(.vertical, 1.5)
51-
.frame(height: 22)
52-
.clipped()
53-
.background {
54-
if colorScheme == .dark {
55-
RoundedRectangle(cornerRadius: 5)
56-
.opacity(0.1)
57-
} else {
58-
RoundedRectangle(cornerRadius: 5)
59-
.opacity(0.1)
60-
}
61-
}
62-
.accessibilityElement(children: .contain)
63-
.accessibilityLabel("Activity Viewer")
6476
}
6577
}

CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,11 @@ struct SchemeDropDownView: View {
3232
}
3333

3434
var body: some View {
35-
HStack(spacing: 6) {
36-
Image(systemName: "folder.badge.gearshape")
37-
.imageScale(.medium)
38-
Text(workspaceDisplayName)
39-
.frame(minWidth: 0)
40-
}
41-
.opacity(activeState == .inactive ? 0.4 : 1.0)
42-
.font(.subheadline)
43-
.padding(.trailing, 11.5)
44-
.padding(.horizontal, 2.5)
45-
.padding(.vertical, 2.5)
46-
.background {
47-
Color(nsColor: colorScheme == .dark ? .white : .black)
48-
.opacity(isHoveringScheme || isSchemePopOverPresented ? 0.05 : 0)
49-
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 4, height: 4)))
50-
HStack {
51-
Spacer()
52-
if isHoveringScheme || isSchemePopOverPresented {
53-
chevronDown
54-
.padding(.trailing, 2)
55-
} else {
56-
chevron
57-
.padding(.trailing, 4)
58-
}
35+
Group {
36+
if #available(macOS 26, *) {
37+
tahoe
38+
} else {
39+
seqouia
5940
}
6041
}
6142
.onHover(perform: { hovering in
@@ -78,15 +59,73 @@ struct SchemeDropDownView: View {
7859
}
7960
}
8061

81-
private var chevron: some View {
62+
@available(macOS 26, *)
63+
@ViewBuilder private var tahoe: some View {
64+
HStack(spacing: 4) {
65+
label
66+
chevron
67+
.padding(.leading, 1)
68+
.opacity(isHoveringScheme || isSchemePopOverPresented ? 0.0 : 1.0)
69+
}
70+
.background {
71+
if isHoveringScheme || isSchemePopOverPresented {
72+
HStack {
73+
Spacer()
74+
chevronDown
75+
}
76+
}
77+
}
78+
.padding(6)
79+
.padding(.leading, 2) // apparently this is cummulative?
80+
.background {
81+
Color(nsColor: colorScheme == .dark ? .white : .black)
82+
.opacity(isHoveringScheme || isSchemePopOverPresented ? 0.05 : 0)
83+
.clipShape(Capsule(style: .continuous))
84+
}
85+
}
86+
87+
@ViewBuilder private var seqouia: some View {
88+
label
89+
.padding(.trailing, 11.5)
90+
.padding(.horizontal, 2.5)
91+
.padding(.vertical, 2.5)
92+
.background {
93+
Color(nsColor: colorScheme == .dark ? .white : .black)
94+
.opacity(isHoveringScheme || isSchemePopOverPresented ? 0.05 : 0)
95+
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 4, height: 4)))
96+
HStack {
97+
Spacer()
98+
if isHoveringScheme || isSchemePopOverPresented {
99+
chevronDown
100+
.padding(.trailing, 2)
101+
} else {
102+
chevron
103+
.padding(.trailing, 4)
104+
}
105+
}
106+
}
107+
}
108+
109+
@ViewBuilder private var label: some View {
110+
HStack(spacing: 6) {
111+
Image(systemName: "folder.badge.gearshape")
112+
.imageScale(.medium)
113+
Text(workspaceDisplayName)
114+
.frame(minWidth: 0)
115+
}
116+
.opacity(activeState == .inactive ? 0.4 : 1.0)
117+
.font(.subheadline)
118+
}
119+
120+
@ViewBuilder private var chevron: some View {
82121
Image(systemName: "chevron.compact.right")
83122
.font(.system(size: 9, weight: .medium, design: .default))
84123
.foregroundStyle(.secondary)
85124
.scaleEffect(x: 1.30, y: 1.0, anchor: .center)
86125
.imageScale(.large)
87126
}
88127

89-
private var chevronDown: some View {
128+
@ViewBuilder private var chevronDown: some View {
90129
VStack(spacing: 1) {
91130
Image(systemName: "chevron.down")
92131
}

CodeEdit/Features/CodeEditUI/Views/ToolbarBranchPicker.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ struct ToolbarBranchPicker: View {
8989
await self.sourceControlManager?.refreshBranches()
9090
}
9191
}
92+
.if(.tahoe) {
93+
$0.padding(.leading, 10).frame(minWidth: 140)
94+
}
9295
}
9396

9497
private var inactiveColor: Color {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// View+if.swift
3+
// CodeEdit
4+
//
5+
// Created by Khan Winter on 8/28/25.
6+
//
7+
8+
import SwiftUI
9+
10+
extension View {
11+
/// Applies the given transform if the given condition evaluates to `true`.
12+
/// - Parameters:
13+
/// - condition: The condition to evaluate.
14+
/// - transform: The transform to apply to the source `View`.
15+
/// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
16+
@ViewBuilder
17+
func `if`<Content: View>(_ condition: Bool, transform: (Self) -> Content) -> some View {
18+
if condition {
19+
transform(self)
20+
} else {
21+
self
22+
}
23+
}
24+
}
25+
26+
extension Bool {
27+
static var tahoe: Bool {
28+
if #available(macOS 26, *) {
29+
return true
30+
} else {
31+
return false
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)