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:
37
macos/Sources/FailWell/Views/Router.swift
Normal file
37
macos/Sources/FailWell/Views/Router.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
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]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user