improves the git feature by adding a conflict status
This commit is contained in:
@@ -233,8 +233,15 @@ private struct GitFileRow: View {
|
||||
GitIconView(icon: expanded ? .chevronDown : .chevronRight, size: 13)
|
||||
.foregroundStyle(expanded ? Palette.amber : Palette.text4)
|
||||
StatusBadge(status: row.status)
|
||||
path
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
HStack(spacing: 8) {
|
||||
path
|
||||
if isConflict {
|
||||
GitIconView(icon: .flag, size: 13)
|
||||
.foregroundStyle(Palette.gitConflict)
|
||||
.tip("Merge conflict — resolve, then Stage")
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
HStack(spacing: 0) {
|
||||
Text("+\(row.added)").foregroundStyle(Palette.gitNew)
|
||||
.frame(width: GitMetrics.statWidth, alignment: .trailing)
|
||||
@@ -248,9 +255,9 @@ private struct GitFileRow: View {
|
||||
}
|
||||
.padding(.horizontal, 14)
|
||||
.frame(height: GitMetrics.fileRow)
|
||||
.background(expanded ? Palette.panel : (isHovered ? Palette.gitRowHover : .clear))
|
||||
.background(expanded ? Palette.panel : (isHovered ? Palette.gitRowHover : (isConflict ? Palette.gitConflictTint : .clear)))
|
||||
.overlay(alignment: .leading) {
|
||||
Rectangle().fill(kind == .staged ? Palette.amber : .clear).frame(width: GitMetrics.accentBar)
|
||||
Rectangle().fill(accentColor).frame(width: GitMetrics.accentBar)
|
||||
}
|
||||
.hairline(.bottom)
|
||||
.contentShape(Rectangle())
|
||||
@@ -262,6 +269,13 @@ private struct GitFileRow: View {
|
||||
.tracksHover($isHovered)
|
||||
}
|
||||
|
||||
private var isConflict: Bool { row.status == .unmerged }
|
||||
|
||||
private var accentColor: Color {
|
||||
if isConflict { return Palette.gitConflict }
|
||||
return kind == .staged ? Palette.amber : .clear
|
||||
}
|
||||
|
||||
/// The folder and slash muted, the name bright; a deleted file is struck through with a muted name.
|
||||
private var path: some View {
|
||||
let dir = PathUtils.dirname(row.path)
|
||||
@@ -292,7 +306,8 @@ private struct StatusBadge: View {
|
||||
switch status {
|
||||
case .added: Palette.gitNew
|
||||
case .deleted: Palette.gitDeleted
|
||||
case .modified, .renamed, .unmerged: Palette.gitModified
|
||||
case .modified, .renamed: Palette.gitModified
|
||||
case .unmerged: Palette.gitConflict
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +317,7 @@ private struct StatusBadge: View {
|
||||
case .deleted: "Deleted"
|
||||
case .modified: "Modified"
|
||||
case .renamed: "Renamed"
|
||||
case .unmerged: "Conflict"
|
||||
case .unmerged: "Merge conflict"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user