99 lines
3.8 KiB
Swift
99 lines
3.8 KiB
Swift
// ── Watch Timer Detail View ───────────────────────────────────
|
|
// Full detail view for a timer on Apple Watch
|
|
|
|
import SwiftUI
|
|
import WatchKit
|
|
|
|
struct WatchTimerDetailView: View {
|
|
let timer: TimerSnapshot
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
VStack(spacing: 12) {
|
|
// Urgency badge
|
|
Text(timer.urgency.rawValue.uppercased())
|
|
.font(.system(size: 10, weight: .bold))
|
|
.foregroundStyle(urgencyColor(timer.urgency))
|
|
.padding(.horizontal, 8)
|
|
.padding(.vertical, 3)
|
|
.background(urgencyColor(timer.urgency).opacity(0.2))
|
|
.clipShape(Capsule())
|
|
|
|
// Timer label
|
|
Text(timer.label)
|
|
.font(.system(size: 16, weight: .semibold))
|
|
.multilineTextAlignment(.center)
|
|
|
|
// Large countdown
|
|
Text(timer.targetTime, style: .timer)
|
|
.font(.system(size: 32, weight: .bold, design: .monospaced))
|
|
.foregroundStyle(urgencyColor(timer.urgency))
|
|
.contentTransition(.numericText())
|
|
|
|
// Target time
|
|
HStack(spacing: 4) {
|
|
Image(systemName: "bell.fill")
|
|
.font(.system(size: 10))
|
|
Text(formatTime(timer.targetTime))
|
|
.font(.system(size: 13, weight: .medium))
|
|
}
|
|
.foregroundStyle(.secondary)
|
|
|
|
// Pomodoro info
|
|
if let round = timer.pomodoroCurrentRound,
|
|
let total = timer.pomodoroTotalRounds {
|
|
HStack(spacing: 4) {
|
|
Image(systemName: "target")
|
|
.font(.system(size: 10))
|
|
Text(timer.pomodoroIsBreak == true ? "Break" : "Round \(round)/\(total)")
|
|
.font(.system(size: 12, weight: .medium))
|
|
}
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
|
|
// Cascade progress
|
|
if timer.totalWarnings > 0 {
|
|
VStack(spacing: 4) {
|
|
HStack {
|
|
Text("Warnings")
|
|
.font(.system(size: 11))
|
|
.foregroundStyle(.secondary)
|
|
Spacer()
|
|
Text("\(timer.firedWarnings)/\(timer.totalWarnings)")
|
|
.font(.system(size: 11, weight: .medium, design: .monospaced))
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
ProgressView(value: Double(timer.firedWarnings), total: Double(timer.totalWarnings))
|
|
.tint(urgencyColor(timer.urgency))
|
|
}
|
|
.padding(.top, 4)
|
|
}
|
|
|
|
// Snooze info
|
|
if timer.snoozeCount > 0 {
|
|
HStack(spacing: 4) {
|
|
Image(systemName: "zzz")
|
|
.font(.system(size: 10))
|
|
Text("Snoozed \(timer.snoozeCount)x")
|
|
.font(.system(size: 11))
|
|
}
|
|
.foregroundStyle(.orange)
|
|
}
|
|
}
|
|
.padding()
|
|
}
|
|
.navigationTitle(timer.type.rawValue.capitalized)
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
|
|
private func urgencyColor(_ urgency: UrgencyLevel) -> Color {
|
|
switch urgency {
|
|
case .critical: return .red
|
|
case .important: return .orange
|
|
case .standard: return .yellow
|
|
case .gentle: return .green
|
|
case .passive: return .blue
|
|
}
|
|
}
|
|
}
|