before the great git rework
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
/// ⌘N: the project's plain-text note. Closing it in any way saves it.
|
||||
struct NoteOverlay: View {
|
||||
let note: NoteStore
|
||||
var onPassOn: () -> Void
|
||||
var onClose: () -> Void
|
||||
|
||||
var body: some View {
|
||||
OverlayShell(.sized(width: 780), onDismiss: onClose) {
|
||||
VStack(spacing: 0) {
|
||||
OverlayHeader(systemImage: "note.text", title: "Note", detail: NoteStore.fileName) {
|
||||
Button(action: onPassOn) {
|
||||
HStack(spacing: 8) {
|
||||
Text("To the agent")
|
||||
Keycap("⌘P", style: .onAmber, small: true)
|
||||
}
|
||||
}
|
||||
.buttonStyle(.primary)
|
||||
}
|
||||
OverlayTextEditor(text: Binding(get: { note.text }, set: { note.text = $0 }),
|
||||
placeholder: "Anything you want to keep next to this project…", onKey: handle)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
Text("saved on focus loss · \(note.characterCount) characters")
|
||||
.typeRole(Typography.meta)
|
||||
.foregroundStyle(Palette.text4)
|
||||
.padding(.horizontal, 20)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.frame(height: 34)
|
||||
.hairline(.top)
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
}
|
||||
.onDisappear { Task { await note.save() } }
|
||||
}
|
||||
|
||||
private func handle(_ key: OverlayKey) -> Bool {
|
||||
switch key {
|
||||
case .commandP: onPassOn()
|
||||
case .escape: onClose()
|
||||
default: return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,6 @@ public struct OverlayHost: View {
|
||||
}
|
||||
case .shortcuts:
|
||||
ShortcutsOverlay(onClose: dismiss)
|
||||
case .note:
|
||||
if let note = model.note {
|
||||
NoteOverlay(note: note, onPassOn: { model.perform(.passNote) }, onClose: dismiss)
|
||||
}
|
||||
case .cleanCopy:
|
||||
if let cleanCopy = model.cleanCopy {
|
||||
CleanCopyOverlay(store: cleanCopy, onCopy: { model.perform(.copyCleanCopy) }, onClose: dismiss)
|
||||
|
||||
@@ -28,8 +28,6 @@ public enum ShortcutCatalog {
|
||||
]),
|
||||
ShortcutGroup(title: "Agent", rows: [
|
||||
ShortcutRow(keys: ["⌘", "→"], label: "Pass the selection to the agent"),
|
||||
ShortcutRow(keys: ["⌘", "N"], label: "Open the project note"),
|
||||
ShortcutRow(keys: ["⌘", "P"], label: "Pass on the whole note"),
|
||||
]),
|
||||
ShortcutGroup(title: "Git", rows: [
|
||||
ShortcutRow(keys: ["⌘", "C"], label: "Focus the commit message"),
|
||||
|
||||
Reference in New Issue
Block a user