feat(macos): add native menu bar app with notch overlay

Introduces a SwiftUI companion app for the Fail Well PWA: menu bar
status item, popover with task list / record / history views, command
palette, and a Dynamic Island-style notch overlay that shows the active
step and timer beside the hardware notch and expands on hover to reveal
pause/next controls.
This commit is contained in:
Julien Calixte
2026-05-15 11:27:51 +02:00
parent 0c0d555ac1
commit 29a71a73b2
33 changed files with 2602 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import Foundation
enum TimeFormat {
/// "MM:SS" or "H:MM:SS" depending on magnitude.
static func clock(_ seconds: TimeInterval) -> String {
let total = max(0, Int(seconds))
let h = total / 3600
let m = (total % 3600) / 60
let s = total % 60
if h > 0 { return String(format: "%d:%02d:%02d", h, m, s) }
return String(format: "%d:%02d", m, s)
}
/// Rounded to minutes. Returns "0m" for sub-minute durations.
static func minutes(_ seconds: TimeInterval) -> String {
"\(Int((seconds / 60).rounded()))m"
}
/// Compact relative-date string, e.g. "today", "yesterday", "Mar 14".
static func date(_ date: Date, relativeTo reference: Date = Date()) -> String {
let cal = Calendar.current
if cal.isDateInToday(date) { return "today" }
if cal.isDateInYesterday(date) { return "yesterday" }
let f = DateFormatter()
f.dateFormat = cal.component(.year, from: date) == cal.component(.year, from: reference) ? "MMM d" : "MMM d yyyy"
return f.string(from: date)
}
}