Unify labels, byte units, snapshot numbers and spelling
This commit is contained in:
@@ -369,7 +369,7 @@ private struct SnapWhere: View {
|
||||
let snaps = store.snapshots()
|
||||
let snap = snaps.first { $0.n == n }
|
||||
HStack(spacing: 0) {
|
||||
Text("snapshot \(n)")
|
||||
Text("snapshot #\(n)")
|
||||
if let snap {
|
||||
Text(" · \(snap.trigger.rawValue) · \(clockText(snap.createdAt))")
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ final class ChatModel {
|
||||
|
||||
var placeholder: String {
|
||||
if closed {
|
||||
return "Continue in a new task, started from main, whose agent picks up this conversation. Paste or drop images to attach them."
|
||||
return "Continue in a new task, started from the default branch, whose agent picks up this conversation. Paste or drop images to attach them."
|
||||
}
|
||||
if team {
|
||||
return "Post to the team's board; every agent of the team gets it."
|
||||
@@ -1654,7 +1654,7 @@ private struct ReadyBubble: View {
|
||||
}
|
||||
return AttentionCard(open: current) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
AttentionHeader(label: discard ? "suggests discarding" : "ready for merge", when: when, open: current)
|
||||
AttentionHeader(label: discard ? "suggests discarding" : "ready to merge", when: when, open: current)
|
||||
MarkdownView(blocks: blocks, ctx: ctx)
|
||||
if current, let task {
|
||||
let busy = store.taskBusy(task.id)
|
||||
@@ -1972,7 +1972,7 @@ private struct SnapshotRow: View {
|
||||
store.sheet = Sheet(owner: .task(store.selectedTaskId), view: .tab(.changes))
|
||||
}
|
||||
.buttonStyle(SmallLinkButtonStyle())
|
||||
.help("Show snapshot \(snap.n) in the Changes tab")
|
||||
.help("Show snapshot #\(snap.n) in the Changes tab")
|
||||
}
|
||||
Button("Fork") {
|
||||
guard let taskId else {
|
||||
|
||||
@@ -806,7 +806,7 @@ struct ComposerView: View {
|
||||
.buttonStyle(WebButtonStyle())
|
||||
.disabled(!shown)
|
||||
.fixedSize()
|
||||
.help(chat.closed ? "Start a new task from main whose agent continues this conversation with your message" : "Send the message")
|
||||
.help(chat.closed ? "Start a new task from the default branch whose agent continues this conversation with your message" : "Send the message")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,16 +75,6 @@ private func parent(_ path: String) -> String {
|
||||
return i == path.startIndex ? "/" : String(path[..<i])
|
||||
}
|
||||
|
||||
private func bytes(_ n: Int64) -> String {
|
||||
if n < 1024 {
|
||||
return "\(n) B"
|
||||
}
|
||||
if n < 1024 * 1024 {
|
||||
return "\((Double(n) / 1024).formatted(.number.precision(.fractionLength(1)).grouping(.never))) KiB"
|
||||
}
|
||||
return "\((Double(n) / 1024 / 1024).formatted(.number.precision(.fractionLength(1)).grouping(.never))) MiB"
|
||||
}
|
||||
|
||||
private let imageExts: Set<String> = ["png", "jpg", "jpeg", "gif", "webp", "svg"]
|
||||
|
||||
private func isImage(_ path: String) -> Bool {
|
||||
|
||||
@@ -150,6 +150,17 @@ func ago(_ date: Date) -> String {
|
||||
return "\(seconds / 86400)d ago"
|
||||
}
|
||||
|
||||
func bytes(_ n: Int64) -> String {
|
||||
let units = ["B", "KiB", "MiB", "GiB", "TiB"]
|
||||
var i = 0
|
||||
var v = Double(n)
|
||||
while v >= 1024 && i < units.count - 1 {
|
||||
v /= 1024
|
||||
i += 1
|
||||
}
|
||||
return "\(v.formatted(.number.precision(.fractionLength(i == 0 ? 0 : 1)).grouping(.never))) \(units[i])"
|
||||
}
|
||||
|
||||
func isoText(_ date: Date) -> String {
|
||||
date.formatted(Date.ISO8601FormatStyle(includingFractionalSeconds: true))
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ struct ServerPicker: View {
|
||||
.foregroundStyle(servers.current == nil ? Palette.text : Palette.muted)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 3)
|
||||
.help("Add Server")
|
||||
.help("Add server")
|
||||
}
|
||||
.font(Fonts.font(13))
|
||||
.fixedSize()
|
||||
|
||||
@@ -25,17 +25,6 @@ private func since(_ date: Date) -> String {
|
||||
return ago(date)
|
||||
}
|
||||
|
||||
private func bytes(_ n: Int64) -> String {
|
||||
let units = ["B", "KB", "MB", "GB", "TB"]
|
||||
var i = 0
|
||||
var v = Double(n)
|
||||
while v >= 1024 && i < units.count - 1 {
|
||||
v /= 1024
|
||||
i += 1
|
||||
}
|
||||
return "\(v.formatted(.number.precision(.fractionLength(i == 0 ? 0 : 1)).grouping(.never))) \(units[i])"
|
||||
}
|
||||
|
||||
private func resetText(_ at: Date) -> String {
|
||||
let time = at.formatted(Date.FormatStyle().weekday(.abbreviated).hour().minute())
|
||||
let minutes = Int((at.timeIntervalSinceNow / 60).rounded())
|
||||
@@ -487,7 +476,7 @@ private struct ClientTable: View {
|
||||
Text("\(c.login) · build \(build(c))")
|
||||
.font(Fonts.font(11))
|
||||
.foregroundStyle(Palette.muted)
|
||||
Text("Connected \(ago(c.connectedAt)) ·last action \(c.lastActionAt.map(since) ?? "—")")
|
||||
Text("Connected \(ago(c.connectedAt)) · last action \(c.lastActionAt.map(since) ?? "—")")
|
||||
.font(Fonts.font(11))
|
||||
.foregroundStyle(Palette.muted)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ private let stateTitles: [ByreTask.StatePayload: TaskState] = [
|
||||
.reviewing: TaskState(kind: .working, label: "Reviewing", title: "A review is running"),
|
||||
.discarding: TaskState(kind: .working, label: "Discarding", title: "The agent is writing the task summary, then byre removes the task"),
|
||||
.readyToMerge: TaskState(kind: .ready, label: "Ready to merge", title: "The agent says the task is ready to merge"),
|
||||
.discardSuggested: TaskState(kind: .ready, label: "Ready to discard", title: "The agent suggests discarding the task"),
|
||||
.discardSuggested: TaskState(kind: .ready, label: "Suggests discard", title: "The agent suggests discarding the task"),
|
||||
.idle: TaskState(kind: .idle, label: "Idle", title: "Waiting for a message"),
|
||||
.finished: TaskState(kind: .idle, label: "Finished", title: "The workflow stage finished"),
|
||||
.noAgent: TaskState(kind: .idle, label: "Idle", title: "Waiting for a message"),
|
||||
@@ -853,7 +853,7 @@ final class Store {
|
||||
}
|
||||
case "schedule.saved", "schedule.deleted":
|
||||
applySchedule(ev)
|
||||
case "task.created", "task.title", "task.merge_title", "task.merge_queued", "task.merge_unqueued", "task.merge_after_review", "task.merge_after_review_ended", "task.merge_after_review_cancelled", "task.parent_merge_started", "task.parent_merge_stopped", "task.merge_started", "task.merge_ended", "task.discard_started", "task.merged", "task.discarded", "task.state", "task.ready", "task.discard_suggested", "task.ready_cleared", "snapshot.created":
|
||||
case "task.created", "task.title", "task.merge_title", "task.merge_queued", "task.merge_unqueued", "task.merge_after_review", "task.merge_after_review_ended", "task.merge_after_review_canceled", "task.parent_merge_started", "task.parent_merge_stopped", "task.merge_started", "task.merge_ended", "task.discard_started", "task.merged", "task.discarded", "task.state", "task.ready", "task.discard_suggested", "task.ready_cleared", "snapshot.created":
|
||||
if let taskId = ev.taskId, ["task.merged", "task.discarded"].contains(ev.kind) || (ev.kind == "snapshot.created" && !["answer", "fork", "ask_human"].contains(str(ev.payload.value, "trigger"))) {
|
||||
clearTask(self, taskId)
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ final class TranscriptBuilder {
|
||||
if let task = rowTask, task != taskId {
|
||||
return note([.text("\(ev.actor) continued "), .task(from), .text(" as "), .task(task), .text(" here")])
|
||||
}
|
||||
return note([.text("\(ev.actor) continued "), .task(from), .text(" here in a new task, started from main; everything above happened in that task, and its agent continues that conversation")])
|
||||
return note([.text("\(ev.actor) continued "), .task(from), .text(" here in a new task, started from the default branch; everything above happened in that task, and its agent continues that conversation")])
|
||||
}
|
||||
if let from = str(p, "forked_from"), let task = rowTask, task != taskId {
|
||||
return note([.text("\(ev.actor) forked "), .task(task), .text(" here from "), .task(from), .text(" at snapshot #\(jsString(p["forked_at"]))")])
|
||||
@@ -984,7 +984,7 @@ final class TranscriptBuilder {
|
||||
n.cancelMergeAfterReview = jsString(p["id"])
|
||||
return Row(.note(n), taskId: rowTask)
|
||||
|
||||
case "task.merge_after_review_cancelled":
|
||||
case "task.merge_after_review_canceled":
|
||||
return note([.text("\(ev.actor) canceled the merge after review")])
|
||||
|
||||
case "task.merge_after_review_dropped":
|
||||
|
||||
@@ -120,10 +120,6 @@ final class Updater: NSObject, SPUUserDriver, SPUUpdaterDelegate {
|
||||
panel = nil
|
||||
}
|
||||
|
||||
private func bytes(_ n: Double) -> String {
|
||||
Int64(n).formatted(.byteCount(style: .file))
|
||||
}
|
||||
|
||||
func updater(_ updater: SPUUpdater, willInstallUpdateOnQuit item: SUAppcastItem, immediateInstallationBlock immediateInstallHandler: @escaping () -> Void) -> Bool {
|
||||
staged = (item, immediateInstallHandler)
|
||||
now = ask(item)
|
||||
@@ -184,9 +180,9 @@ final class Updater: NSObject, SPUUserDriver, SPUUpdaterDelegate {
|
||||
func showDownloadDidReceiveData(ofLength length: UInt64) {
|
||||
progress.done += Double(length)
|
||||
if let total = progress.total {
|
||||
progress.detail = "\(bytes(progress.done)) of \(bytes(total))"
|
||||
progress.detail = "\(bytes(Int64(progress.done))) of \(bytes(Int64(total)))"
|
||||
} else {
|
||||
progress.detail = bytes(progress.done)
|
||||
progress.detail = bytes(Int64(progress.done))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user