adds nice git interface
This commit is contained in:
@@ -107,31 +107,30 @@ private struct Breadcrumb: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Git · Explorer · File · Claude: one toggle per column. Hiding a column keeps everything inside it.
|
||||
/// Explorer · File · Claude: one toggle per column. Hiding a column keeps everything inside it.
|
||||
private struct PaneToggles: View {
|
||||
let model: WorkspaceModel
|
||||
|
||||
var body: some View {
|
||||
ButtonGroup([
|
||||
toggle("Git", .sourceControl, column: "Source Control"),
|
||||
toggle("Explorer", .explorer, column: "Explorer"),
|
||||
toggle("File", .editor, column: "File"),
|
||||
toggle("Claude", .terminal, column: "Claude"),
|
||||
toggle("Explorer", .explorer),
|
||||
toggle("File", .editor),
|
||||
toggle("Claude", .terminal),
|
||||
])
|
||||
}
|
||||
|
||||
private func toggle(_ label: String, _ panel: Panel, column: String) -> GroupItem {
|
||||
private func toggle(_ label: String, _ panel: Panel) -> GroupItem {
|
||||
let shown = model.layout.isVisible(panel)
|
||||
let tip = shown
|
||||
? Tooltip.stated(column + " column: ", "shown", ". Click to hide it.")
|
||||
: Tooltip.stated(column + " column: ", "hidden", ". Click to show it.")
|
||||
? Tooltip.stated(label + " column: ", "shown", ". Click to hide it.")
|
||||
: Tooltip.stated(label + " column: ", "hidden", ". Click to show it.")
|
||||
return GroupItem(label, kind: .toggle(isOn: shown), tip: tip) {
|
||||
model.perform(.togglePane(panel))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Search ⌘F · Fluid ⌘L · Hidden ⌘., then `?`. Search is an action; Fluid and Hidden toggle.
|
||||
/// Git ⌘G · Search ⌘F · Fluid ⌘L · Hidden ⌘., then `?`. Search is an action; the others toggle.
|
||||
/// While Helder reads aloud, a Stop toggle leads the group; switching it off stops the reading.
|
||||
private struct TitleToolbar: View {
|
||||
let model: WorkspaceModel
|
||||
@@ -140,6 +139,7 @@ private struct TitleToolbar: View {
|
||||
let layout = model.layout
|
||||
HStack(spacing: Metrics.toolbarIconGap) {
|
||||
ButtonGroup(stop + [
|
||||
git,
|
||||
GroupItem("Search", keys: "⌘F", kind: .action,
|
||||
tip: Text("Search the open file, the project and the file names.")) { model.perform(.showSearch(seed: "")) },
|
||||
GroupItem("Fluid", keys: "⌘L", kind: .toggle(isOn: layout.fluid),
|
||||
@@ -161,6 +161,18 @@ private struct TitleToolbar: View {
|
||||
.fixedSize()
|
||||
}
|
||||
|
||||
/// N counts changed files, a file both staged and unstaged once; the dot lights while the view is open.
|
||||
private var git: GroupItem {
|
||||
let open = model.layout.isGitViewOpen
|
||||
let count = Set(model.sourceControl?.state.changes.map(\.path) ?? []).count
|
||||
let tip = open
|
||||
? Tooltip.stated("Git view: ", "open", ". Click to close it (⌘G).")
|
||||
: Tooltip.stated("Git view: ", "closed", ". Click to open it (⌘G).")
|
||||
return GroupItem(count > 0 ? "Git \(count)" : "Git", id: "Git", keys: "⌘G", kind: .toggle(isOn: open), tip: tip) {
|
||||
model.perform(.toggleGit)
|
||||
}
|
||||
}
|
||||
|
||||
private var stop: [GroupItem] {
|
||||
guard model.readAloud.isReading else { return [] }
|
||||
return [GroupItem("Stop", kind: .toggle(isOn: true), tip: Tooltip.stated("Read aloud: ", "playing", ". Click to stop.")) {
|
||||
|
||||
Reference in New Issue
Block a user