adds claude-generated commit messages and a recent commits panel to the git view - adds log tailing in the explorer, branch merging and a clean up button
This commit is contained in:
@@ -4,18 +4,19 @@ import SwiftUI
|
||||
|
||||
enum MenuCursor {
|
||||
static func first(in entries: [ContextMenuEntry]) -> Int? {
|
||||
entries.firstIndex { $0 != .separator }
|
||||
entries.firstIndex(where: \.isSelectable)
|
||||
}
|
||||
|
||||
/// The next selectable entry in `step` direction, wrapping around and skipping separators.
|
||||
static func step(_ current: Int, by step: Int, in entries: [ContextMenuEntry]) -> Int {
|
||||
guard !entries.isEmpty else { return current }
|
||||
/// The next selectable entry in `step` direction, wrapping around and skipping separators and disabled
|
||||
/// entries; nil when the menu has none.
|
||||
static func step(_ current: Int, by step: Int, in entries: [ContextMenuEntry]) -> Int? {
|
||||
guard !entries.isEmpty else { return nil }
|
||||
var index = current
|
||||
for _ in entries.indices {
|
||||
index = (index + step + entries.count) % entries.count
|
||||
if entries[index] != .separator { return index }
|
||||
if entries[index].isSelectable { return index }
|
||||
}
|
||||
return current
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +83,10 @@ struct ContextMenuOverlay: View {
|
||||
isEmphasized: action.isEmphasized)
|
||||
.onHover { inside in if inside { highlighted = index } }
|
||||
.onTapGesture { onPerform(action) }
|
||||
case let .disabled(action, label, hint):
|
||||
ContextMenuRow(label, systemImage: Self.symbol(for: action), iconTint: Self.tint(for: action).color,
|
||||
isHighlighted: false, isDisabled: true)
|
||||
.tip(hint)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,11 +115,11 @@ struct ContextMenuOverlay: View {
|
||||
nonisolated static func tint(for action: ContextAction) -> MenuIconTint {
|
||||
switch action {
|
||||
case .copyReference, .copyTerminalSelection, .pasteIntoTerminal, .readAloudFile, .readAloudText, .readAloudTerminalSelection,
|
||||
.plak, .plakTerminalSelection, .openFile, .commit: .plain
|
||||
.plak, .plakTerminalSelection, .openFile, .mergeBranch, .tailLog: .plain
|
||||
case .newFile, .newFolder: .add
|
||||
case .copyFileName, .revealInFinder: .modify
|
||||
case .passOnReference, .passOnFileName, .bouwen, .waitWhat, .showDiff, .rename: .rename
|
||||
case .gitDiscard, .delete: .danger
|
||||
case .gitDiscard, .gitCleanUp, .delete: .danger
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,16 +132,17 @@ struct ContextMenuOverlay: View {
|
||||
case .plak, .plakTerminalSelection: "note.text.badge.plus"
|
||||
case .copyReference, .copyFileName, .copyTerminalSelection: "doc.on.doc"
|
||||
case .openFile: "doc.text"
|
||||
case .commit(andPush: false): "checkmark"
|
||||
case .commit(andPush: true): "arrow.up.to.line"
|
||||
case .pasteIntoTerminal: "doc.on.clipboard"
|
||||
case .newFile: "doc.badge.plus"
|
||||
case .newFolder: "folder.badge.plus"
|
||||
case .showDiff: "arrow.left.arrow.right"
|
||||
case .gitDiscard: "arrow.uturn.backward"
|
||||
case .gitCleanUp: "eraser"
|
||||
case .rename: "pencil"
|
||||
case .revealInFinder: "folder"
|
||||
case .delete: "trash"
|
||||
case .mergeBranch: "arrow.triangle.merge"
|
||||
case .tailLog: "terminal"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user