Widgets: remove Event Countdown (dots) + Tasks Done Today (KC-17)

Drop the dot-grid EventCountdownWidget and TasksCompleteWidget from the
gallery: widget structs, their views, the todayTaskCompletion() helper
(only consumer), and bundle registrations. Shared event plumbing
(EventConfigIntent/Provider/Entry, CycleCountdownUnitIntent) stays for
the surviving Event Countdown (Bars); DotGrid stays for Day Progress.
Remaining widgets untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kutesir
2026-06-11 11:49:35 +03:00
parent 443fe8504f
commit 49b22b5f2f
6 changed files with 31 additions and 161 deletions

View File

@@ -102,52 +102,6 @@ struct ProgressDotView: View {
}
}
// MARK: - Tasks completed today
struct TasksCompleteView: View {
@Environment(\.widgetFamily) private var family
private let teal = WidgetTheme.accent
private var stats: (done: Int, total: Int) { todayTaskCompletion() }
private var percent: Int {
let s = stats
guard s.total > 0 else { return 0 }
return Int((Double(s.done) / Double(s.total) * 100).rounded())
}
var body: some View {
let s = stats
let isMedium = family == .systemMedium
VStack(alignment: .leading, spacing: isMedium ? 10 : 6) {
HStack(alignment: .firstTextBaseline) {
Text("Today's Tasks")
.font(.system(size: isMedium ? 22 : 14, weight: .bold))
.foregroundColor(.white)
.lineLimit(1)
Spacer()
Text("\(percent)%")
.font(.system(size: isMedium ? 22 : 13, weight: .bold))
.foregroundColor(Color(white: 0.5))
}
if s.total == 0 {
Spacer(minLength: 0)
Text("No tasks due today")
.font(.system(size: 12))
.foregroundColor(Color(white: 0.5))
Spacer(minLength: 0)
} else {
Text("\(s.done) of \(s.total) done")
.font(.system(size: 12))
.foregroundColor(teal)
Spacer(minLength: 2)
DotGrid(total: s.total, filled: s.done, color: teal)
}
}
.padding(.horizontal, isMedium ? 4 : 0)
.containerBackground(WidgetTheme.background, for: .widget)
}
}
// MARK: - Circular dot grid (event countdown motif)
struct DotGrid: View {
@@ -205,75 +159,6 @@ struct DotGrid: View {
}
}
// MARK: - Event Countdown Widget (small + medium)
struct EventCountdownView: View {
let entry: EventEntry
@Environment(\.widgetFamily) var family
private let teal = WidgetTheme.accent
private var percent: Int { Int((entry.progress * 100).rounded()) }
var body: some View {
Group {
if family == .systemSmall {
small
} else {
medium
}
}
.containerBackground(WidgetTheme.background, for: .widget)
}
private var filled: Int { Int(entry.progress * Double(entry.totalDays)) }
// Wide layout: event name + days-left countdown, then the dot-grid progress.
private var medium: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(alignment: .firstTextBaseline, spacing: 8) {
Text(LocalizedStringKey(entry.eventName))
.font(.system(size: 20, weight: .bold))
.foregroundColor(teal)
.lineLimit(1)
Spacer(minLength: 4)
VStack(alignment: .trailing, spacing: 1) {
Button(intent: CycleCountdownUnitIntent()) {
Text(entry.timeLeftLabel)
.font(.system(size: 14, weight: .semibold))
.foregroundColor(Color(white: 0.62))
.lineLimit(1)
}
.buttonStyle(.plain)
Text("\(percent)%")
.font(.system(size: 11, weight: .bold))
.foregroundColor(Color(white: 0.4))
}
}
DotGrid(total: entry.totalDays, filled: filled, color: teal)
}
.padding(.horizontal, 4)
}
private var small: some View {
VStack(alignment: .leading, spacing: 6) {
Text(LocalizedStringKey(entry.eventName))
.font(.system(size: 14, weight: .bold))
.foregroundColor(teal)
.lineLimit(2)
Button(intent: CycleCountdownUnitIntent()) {
Text(entry.timeLeftLabel)
.font(.system(size: 12, weight: .semibold))
.foregroundColor(Color(white: 0.62))
.lineLimit(1)
}
.buttonStyle(.plain)
Spacer(minLength: 2)
DotGrid(total: entry.totalDays, filled: filled, color: teal)
}
}
}
// MARK: - Event Countdown Bars style (medium)
struct EventBarsView: View {