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:
22
macos/Sources/FailWell/Services/BreakCalculator.swift
Normal file
22
macos/Sources/FailWell/Services/BreakCalculator.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Foundation
|
||||
|
||||
enum BreakCalculator {
|
||||
/// Shifts the `start` of any unfinished step records forward by the break duration.
|
||||
/// Mirrors `addBreakTimeToStepRecords` from the PWA.
|
||||
static func applyingBreakTime(to record: TaskRecord) -> TaskRecord {
|
||||
guard let breakTime = record.breakTime, let breakEnd = breakTime.end else {
|
||||
return record
|
||||
}
|
||||
|
||||
let diff = breakEnd.timeIntervalSince(breakTime.start)
|
||||
|
||||
var updated = record
|
||||
for (stepId, range) in updated.stepRecords where range.end == nil {
|
||||
updated.stepRecords[stepId] = TimeRange(
|
||||
start: range.start.addingTimeInterval(diff),
|
||||
end: nil
|
||||
)
|
||||
}
|
||||
return updated
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user