// ── ChronoMind macOS Menu Bar App ───────────────────────────── // Native macOS menu bar app sharing 90%+ code with iOS via Shared/ import SwiftUI @main struct ChronoMindMacApp: App { @StateObject private var menuBarState = MenuBarState.shared @StateObject private var timerStore = MacTimerStore.shared var body: some Scene { // Menu bar extra — always visible MenuBarExtra { MenuBarPopover() .environmentObject(timerStore) .environmentObject(menuBarState) .sheet(isPresented: $menuBarState.showCreateSheet) { CreateTimerSheet() .environmentObject(timerStore) } } label: { menuBarLabel } .menuBarExtraStyle(.window) // Settings window Settings { MacSettingsView() .environmentObject(timerStore) } } private var menuBarLabel: some View { HStack(spacing: 4) { Image(systemName: "clock.fill") if let next = timerStore.nextFiringTimer { let remaining = getRemainingSeconds(next, now: timerStore.now) Text(formatDurationCompact(remaining)) .monospacedDigit() } } } }