fix: auto-refresh on tray click, widen 'Just now' to 60s

- Opening the popover now triggers a fetch (via PollerService.fetchNow
  which deduplicates if already in progress)
- 'Just now' now covers 0-60s, then switches to 'Xm ago'.
  Avoids the frozen-timer look since the text only updates on re-render.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tigerenwork 2026-06-29 23:51:48 +08:00
parent 2f2a65f1f7
commit 5b1811db10
2 changed files with 3 additions and 2 deletions

View File

@ -64,6 +64,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
} else { } else {
popover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY) popover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY)
popover.contentViewController?.view.window?.makeKey() popover.contentViewController?.view.window?.makeKey()
// Refresh on open (PollerService deduplicates if already fetching)
Task { await PollerService.shared.fetchNow() }
} }
} }

View File

@ -112,8 +112,7 @@ struct BugListPopover: View {
private func formatted(_ date: Date) -> String { private func formatted(_ date: Date) -> String {
let seconds = Int(Date().timeIntervalSince(date)) let seconds = Int(Date().timeIntervalSince(date))
switch seconds { switch seconds {
case ..<5: return "Just now" case ..<60: return "Just now"
case ..<60: return "\(seconds)s ago"
case ..<3600: case ..<3600:
let m = seconds / 60 let m = seconds / 60
return m == 1 ? "1m ago" : "\(m)m ago" return m == 1 ? "1m ago" : "\(m)m ago"