summaryrefslogtreecommitdiffstats
path: root/Solsnu.Widget/Views/MediumWidgetView.swift
diff options
context:
space:
mode:
authorivar <i@oiee.no>2026-05-07 01:24:28 +0200
committerivar <i@oiee.no>2026-05-07 01:24:28 +0200
commit6eb17a18e901e2d7faa219d7e5a79083a5891dc9 (patch)
tree3d0796e1e567864dfdf7c675f7e8a5a40fb51a95 /Solsnu.Widget/Views/MediumWidgetView.swift
parent4fb690150b77afced6453e6bdb14cc4cf00d5305 (diff)
downloadsolverv-master.tar.xz
solverv-master.zip
RefactorsHEADmaster
Diffstat (limited to 'Solsnu.Widget/Views/MediumWidgetView.swift')
-rw-r--r--Solsnu.Widget/Views/MediumWidgetView.swift30
1 files changed, 20 insertions, 10 deletions
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)
}
}
-