Skip to content

Open source CapCut alternative.

TypeScript

feat(app): show an elapsed-time counter on a running task

David Leb18fd48eefa5
diff --git a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
index 60fe5235..87317cf5 100644
--- a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
@@ -462,7 +462,12 @@ public struct UserQueryNotchStatusView: View {
Spacer(minLength: 0)
if isWorking {
- activityBars(color: accentColor)
+ HStack(spacing: 8) {
+ if let started = primaryTask?.createdAt {
+ elapsedTimer(since: started)
+ }
+ activityBars(color: accentColor)
+ }
}
}
.padding(.horizontal, 12)
@@ -472,6 +477,16 @@ public struct UserQueryNotchStatusView: View {
.clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
}
+ /// A count-up elapsed-time label for a running task — SwiftUI's `.timer` style ticks on its own,
+ /// no manual timer — so a long-running query visibly advances instead of looking stuck.
+ private func elapsedTimer(since start: Date) -> some View {
+ Text(start, style: .timer)
+ .font(.system(size: 11, weight: .regular).monospacedDigit())
+ .foregroundStyle(Color.white.opacity(0.5))
+ .lineLimit(1)
+ .fixedSize()
+ }
+
private func taskRow(_ task: UserQueryNotchTask) -> some View {
HStack(alignment: .top, spacing: 12) {
TaskArrowMark(color: accentColor(for: task.accentIndex))
@@ -493,7 +508,12 @@ public struct UserQueryNotchStatusView: View {
Spacer(minLength: 0)
if task.status == .running || task.status == .paused || task.status == .waitingForPermission || task.status == .interrupted {
- activeTaskControls(for: task)
+ HStack(spacing: 8) {
+ if task.status == .running {
+ elapsedTimer(since: task.createdAt)
+ }
+ activeTaskControls(for: task)
+ }
} else {
taskStatusAccessory(task)
}