Watch: activity line on working cards, All threads browsing, a thread's subagents, Load earlier, and markdown messages
This commit is contained in:
1 parent
abd2fd0e13
commit
d916bfbab5
21 files changed
+928
-46
No files matched your search
@@ -22,6 +22,11 @@ extension Phase {
|
||||
}
|
||||
}
|
||||
|
||||
extension ThreadRow {
|
||||
/// The status dot: amber waiting, teal working, red failed, grey otherwise.
|
||||
var color: Color { phase == .failed ? Theme.bad : phase?.color ?? Theme.done }
|
||||
}
|
||||
|
||||
/// A dark rounded card with a 4 pt colored left edge.
|
||||
struct Card<Content: View>: View {
|
||||
var edge: Color
|
||||
@@ -135,6 +140,16 @@ enum Format {
|
||||
return "\(hours / 24) d"
|
||||
}
|
||||
|
||||
/// A compact time since a date, such as "42s", "3m", "1h" or "2d", for an activity's elapsed time
|
||||
/// and a thread row's age.
|
||||
static func elapsed(since date: Date, now: Date = .now) -> String {
|
||||
let seconds = max(0, Int(now.timeIntervalSince(date)))
|
||||
if seconds < 60 { return "\(seconds)s" }
|
||||
if seconds < 3600 { return "\(seconds / 60)m" }
|
||||
if seconds < 86_400 { return "\(seconds / 3600)h" }
|
||||
return "\(seconds / 86_400)d"
|
||||
}
|
||||
|
||||
/// How long until a date, such as "40 s", "3 min" or "2 h".
|
||||
static func countdown(to date: Date, now: Date = .now) -> String {
|
||||
let seconds = max(0, Int(date.timeIntervalSince(now).rounded()))
|
||||
|
||||
Reference in new issue
Block a user