From 6eb17a18e901e2d7faa219d7e5a79083a5891dc9 Mon Sep 17 00:00:00 2001 From: ivar Date: Thu, 7 May 2026 01:24:28 +0200 Subject: Refactors --- Solsnu.Widget/Views/MediumWidgetView.swift | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'Solsnu.Widget/Views/MediumWidgetView.swift') diff --git a/Solsnu.Widget/Views/MediumWidgetView.swift b/Solsnu.Widget/Views/MediumWidgetView.swift index 69bbbe2..f6fdbd9 100644 --- a/Solsnu.Widget/Views/MediumWidgetView.swift +++ b/Solsnu.Widget/Views/MediumWidgetView.swift @@ -7,20 +7,30 @@ struct MediumWidgetView: View { var body: some View { HStack(spacing: 12) { VStack(alignment: .leading, spacing: 8) { - Text("Season Event") - .font(.headline) - .lineLimit(1) + if let next = entry.nextEvent { + Text(next.shortName) + .font(.headline) + .lineLimit(1) - Text("\(entry.def.daysUntilNext()) days") - .font(.system(.title3, design: .default).weight(.semibold)) + Text("\(next.daysUntil(from: entry.date)) dager") + .font(.system(.title3, design: .default).weight(.semibold)) + } - ProgressView(value: Double(entry.def.progressRatio())) + ProgressView(value: entry.progressRatio) - if !entry.def.sunriseFormatted.isEmpty && !entry.def.sunsetFormatted.isEmpty { + if let sunrise = entry.sunriseTime, let sunset = entry.sunsetTime { HStack { - Text("Sunrise: \(entry.def.sunriseFormatted)") + Label { + Text(sunrise, style: .time) + } icon: { + Image(systemName: "sunrise.fill") + } Spacer() - Text("Sunset: \(entry.def.sunsetFormatted)") + Label { + Text(sunset, style: .time) + } icon: { + Image(systemName: "sunset.fill") + } } .font(.system(size: 12, weight: .regular)) .foregroundStyle(Color(red: 0.152, green: 0.136, blue: 0.056)) @@ -32,6 +42,6 @@ struct MediumWidgetView: View { Spacer() } .padding() + .containerBackground(.fill.tertiary, for: .widget) } } - -- cgit v1.3