Unify labels, byte units, snapshot numbers and spelling

This commit is contained in:
Ian Gulliver
2026-10-23 10:33:47 -07:00
parent 68e0cc3063
commit eba85a6a1a
27 changed files with 54 additions and 65 deletions
+1 -12
View File
@@ -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)
}