adds nice git interface
This commit is contained in:
@@ -2,7 +2,8 @@ import AppKit
|
||||
import HelderCore
|
||||
import SwiftUI
|
||||
|
||||
/// The launcher without a project; with one, the title bar, four columns and status bar, overlays above.
|
||||
/// The launcher without a project; with one, the title bar, three columns and status bar, then the Git view
|
||||
/// over all of them, overlays above.
|
||||
struct WorkspaceView: View {
|
||||
let model: WorkspaceModel
|
||||
|
||||
@@ -29,20 +30,27 @@ struct WorkspaceView: View {
|
||||
.zIndex(1)
|
||||
StatusBarView(model: model)
|
||||
}
|
||||
.overlay {
|
||||
// An overlay over the Git view takes the pointer from it, as from the columns.
|
||||
if model.layout.isGitViewOpen {
|
||||
GitView(model: model)
|
||||
.environment(\.pointerLayer, model.overlay.isPresented ? .workspace : .overlay)
|
||||
}
|
||||
}
|
||||
.overlay { OverlayHost(model: model) }
|
||||
.overlay {
|
||||
if model.overlay.current == .launcher { RecentProjectsOverlay(model: model).environment(\.pointerLayer, .overlay) }
|
||||
}
|
||||
.background(PointerRefresher(trigger: PointerRefresher.Trigger(
|
||||
overlay: model.overlay.current, activePath: model.editor?.activePath, visibility: model.layout.visibility,
|
||||
scale: model.layout.textScale)))
|
||||
overlay: model.overlay.current, gitViewOpen: model.layout.isGitViewOpen, activePath: model.editor?.activePath,
|
||||
visibility: model.layout.visibility, scale: model.layout.textScale)))
|
||||
.onAppear { model.layout.windowResized(width: proxy.size.width) }
|
||||
.onChange(of: proxy.size.width) { _, width in model.layout.windowResized(width: width) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The four columns and their splitters. Every column stays mounted: a pane toggle only hides it, so the
|
||||
/// The three columns and their splitters. Every column stays mounted: a pane toggle only hides it, so the
|
||||
/// terminals, the editor buffer and the tree keep their state. The editor is the flex column; with the editor
|
||||
/// hidden the agent column fills. The agent column is keyed by the project so its terminals respawn on a switch.
|
||||
private struct Columns: View {
|
||||
@@ -56,12 +64,6 @@ private struct Columns: View {
|
||||
let agentFills = v.agent && !v.editor
|
||||
let hiddenEditorWidth = max(editorWidth, Metrics.minEditorWidth)
|
||||
HStack(spacing: 0) {
|
||||
SourceControlColumn(model: model)
|
||||
.frame(width: layout.widths.sourceControl)
|
||||
.refreshFlash(model.refreshTick)
|
||||
.pane(shown: v.sourceControl)
|
||||
Splitter(onDrag: { layout.dragSourceControl(by: $0) }, onEnd: layout.endDrag)
|
||||
.pane(shown: v.sourceControl && (v.explorer || v.editor || v.agent))
|
||||
ExplorerColumn(model: model)
|
||||
.frame(width: layout.widths.explorer)
|
||||
.refreshFlash(model.refreshTick)
|
||||
@@ -114,7 +116,7 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
/// When a column is hidden while it holds the keyboard (a terminal, the code, the commit box), the window
|
||||
/// When a column is hidden while it holds the keyboard (a terminal, the code), the window
|
||||
/// takes the keyboard back, so typing never lands in a pane nobody can see.
|
||||
private struct HiddenPaneFocusGuard: NSViewRepresentable {
|
||||
let visibility: ColumnVisibility
|
||||
@@ -145,10 +147,12 @@ private struct HiddenPaneFocusGuard: NSViewRepresentable {
|
||||
}
|
||||
}
|
||||
|
||||
/// Re-reads the pointer when what lies under a still mouse changes: an overlay, the open file, a column shown or hidden.
|
||||
/// Re-reads the pointer when what lies under a still mouse changes: an overlay, the Git view, the open file,
|
||||
/// a column shown or hidden.
|
||||
private struct PointerRefresher: NSViewRepresentable {
|
||||
struct Trigger: Equatable {
|
||||
var overlay: Overlay
|
||||
var gitViewOpen: Bool
|
||||
var activePath: String?
|
||||
var visibility: ColumnVisibility
|
||||
var scale: Double
|
||||
|
||||
Reference in New Issue
Block a user