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.
38 lines
725 B
Swift
38 lines
725 B
Swift
import Foundation
|
|
import Observation
|
|
|
|
@MainActor
|
|
@Observable
|
|
final class Router {
|
|
enum Screen: Hashable, Sendable {
|
|
case list
|
|
case detail(taskId: String)
|
|
case editor(taskId: String?)
|
|
case record(taskId: String)
|
|
case history(taskId: String)
|
|
case settings
|
|
}
|
|
|
|
var stack: [Screen] = [.list]
|
|
var showPalette: Bool = false
|
|
|
|
var current: Screen { stack.last ?? .list }
|
|
|
|
func push(_ screen: Screen) {
|
|
stack.append(screen)
|
|
}
|
|
|
|
func replace(with screen: Screen) {
|
|
stack = [screen]
|
|
}
|
|
|
|
func pop() {
|
|
guard stack.count > 1 else { return }
|
|
stack.removeLast()
|
|
}
|
|
|
|
func popToRoot() {
|
|
stack = [.list]
|
|
}
|
|
}
|