Skip to content

Commit

Permalink
fix: git branches dropdown (#1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
FezVrasta authored Jan 22, 2024
1 parent ec36074 commit b8c7c9d
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions CodeEdit/Features/CodeEditUI/Views/ToolbarBranchPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,24 @@ struct ToolbarBranchPicker: View {
.frame(height: 16)
.help(title)
if let currentBranch {
ZStack(alignment: .trailing) {
Text(currentBranch.name)
.padding(.trailing)
if isHovering {
Image(systemName: "chevron.down")
Menu(content: {
if let sourceControlManager = workspaceFileManager?.sourceControlManager {
PopoverView(sourceControlManager: sourceControlManager)
}
}
.font(.subheadline)
.foregroundColor(controlActive == .inactive ? inactiveColor : .secondary)
.frame(height: 11)
}, label: {
Text(currentBranch.name)
.font(.subheadline)
.foregroundColor(controlActive == .inactive ? inactiveColor : .secondary)
.frame(height: 11)
})
.buttonStyle(.borderless)
.padding(.leading, -3)
}
}
}
.contentShape(Rectangle())
.onTapGesture {
if currentBranch != nil {
displayPopover.toggle()
}
}
.onHover { active in
isHovering = active
}
.popover(isPresented: $displayPopover, arrowEdge: .bottom) {
if let sourceControlManager = workspaceFileManager?.sourceControlManager {
PopoverView(sourceControlManager: sourceControlManager)
}
}
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { (_) in
Task {
await sourceControlManager?.refreshCurrentBranch()
Expand Down

0 comments on commit b8c7c9d

Please sign in to comment.