Tool Call Card Alignment
Nucleic-Session: FFDE42E0-22AB-4478-B2E2-FF69B2753CEE Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -477,6 +477,51 @@ private struct ToolBlock: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The leading glyph and muted one-liner for a lock line folded onto a tool card — the phone echo
|
||||||
|
/// of the Mac's `LockLineStyle`.
|
||||||
|
enum LockLineStyle {
|
||||||
|
static func icon(_ state: NoteLock.State) -> String {
|
||||||
|
switch state {
|
||||||
|
case .waiting: return "hourglass"
|
||||||
|
case .acquired: return "lock.fill"
|
||||||
|
case .released: return "lock.open"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func text(_ lock: NoteLock) -> String {
|
||||||
|
let paths = pathList(lock.paths)
|
||||||
|
switch lock.state {
|
||||||
|
case .waiting: return "Waiting for lock · \(paths)"
|
||||||
|
case .acquired: return "Locked · \(paths)"
|
||||||
|
case .released: return "Lock released · \(paths)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Up to two repo-relative paths, then a "+N more" tail.
|
||||||
|
private static func pathList(_ paths: [String]) -> String {
|
||||||
|
guard !paths.isEmpty else { return "no files" }
|
||||||
|
let shown = paths.prefix(2).joined(separator: ", ")
|
||||||
|
let extra = paths.count - min(paths.count, 2)
|
||||||
|
return extra > 0 ? "\(shown) +\(extra) more" : shown
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One folded lock line on a tool card: a small muted glyph + status, matching the card's
|
||||||
|
/// secondary detail styling. The phone echo of the Mac's `LockLineRow`.
|
||||||
|
struct LockLineRow: View {
|
||||||
|
let lock: NoteLock
|
||||||
|
var body: some View {
|
||||||
|
HStack(alignment: .firstTextBaseline, spacing: 6) {
|
||||||
|
Image(systemName: LockLineStyle.icon(lock.state))
|
||||||
|
.font(.caption2).foregroundStyle(.tertiary).frame(width: 15)
|
||||||
|
Text(LockLineStyle.text(lock))
|
||||||
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
|
.lineLimit(1).truncationMode(.middle)
|
||||||
|
Spacer(minLength: 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// SF Symbols for the common tools + file-change kinds, so a glance reads the action.
|
/// SF Symbols for the common tools + file-change kinds, so a glance reads the action.
|
||||||
enum ToolGlyph {
|
enum ToolGlyph {
|
||||||
static func icon(_ name: String) -> String {
|
static func icon(_ name: String) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user