|
@@ -94,7 +94,8 @@ struct CalendarDesktopWidgetView: View {
|
|
|
openCalendarPath("/calendar/u/0/r")
|
|
openCalendarPath("/calendar/u/0/r")
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- .padding(14)
|
|
|
|
|
|
|
+ .padding(.horizontal, 14)
|
|
|
|
|
+ .padding(.vertical, 16)
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
|
}
|
|
}
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
@@ -106,23 +107,31 @@ struct CalendarDesktopWidgetView: View {
|
|
|
let now = Date()
|
|
let now = Date()
|
|
|
let cal = Calendar.current
|
|
let cal = Calendar.current
|
|
|
let day = cal.component(.day, from: now)
|
|
let day = cal.component(.day, from: now)
|
|
|
- let weekday = Self.weekdayFormatter.string(from: now).uppercased()
|
|
|
|
|
- let monthYear = Self.monthYearFormatter.string(from: now)
|
|
|
|
|
|
|
+ let displayDate = Self.smallDateFormatter.string(from: now)
|
|
|
|
|
|
|
|
- return HStack(alignment: .firstTextBaseline, spacing: 14) {
|
|
|
|
|
|
|
+ return HStack(spacing: 12) {
|
|
|
Text("\(day)")
|
|
Text("\(day)")
|
|
|
.font(.system(size: 36, weight: .bold, design: .rounded))
|
|
.font(.system(size: 36, weight: .bold, design: .rounded))
|
|
|
.foregroundStyle(.white)
|
|
.foregroundStyle(.white)
|
|
|
|
|
+ .frame(width: 54, alignment: .leading)
|
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
|
- Text(weekday)
|
|
|
|
|
- .font(.system(size: 10, weight: .bold))
|
|
|
|
|
- .foregroundStyle(.white.opacity(0.55))
|
|
|
|
|
- Text(monthYear)
|
|
|
|
|
- .font(.system(size: 14, weight: .semibold))
|
|
|
|
|
- .foregroundStyle(.white.opacity(0.9))
|
|
|
|
|
|
|
+ Text("Today")
|
|
|
|
|
+ .font(.system(size: 11, weight: .bold))
|
|
|
|
|
+ .foregroundStyle(.white.opacity(0.54))
|
|
|
|
|
+ Text(displayDate)
|
|
|
|
|
+ .font(.system(size: 13, weight: .semibold))
|
|
|
|
|
+ .foregroundStyle(.white.opacity(0.92))
|
|
|
|
|
+ .lineLimit(1)
|
|
|
}
|
|
}
|
|
|
Spacer(minLength: 0)
|
|
Spacer(minLength: 0)
|
|
|
}
|
|
}
|
|
|
|
|
+ .padding(10)
|
|
|
|
|
+ .frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
|
+ .background(RoundedRectangle(cornerRadius: 12, style: .continuous).fill(Color.black.opacity(0.2)))
|
|
|
|
|
+ .overlay(
|
|
|
|
|
+ RoundedRectangle(cornerRadius: 12, style: .continuous)
|
|
|
|
|
+ .stroke(Color.white.opacity(0.12), lineWidth: 1)
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func nextEventSummary(_ ev: CalendarEventSnapshot) -> some View {
|
|
private func nextEventSummary(_ ev: CalendarEventSnapshot) -> some View {
|
|
@@ -427,6 +436,12 @@ struct CalendarDesktopWidgetView: View {
|
|
|
return f
|
|
return f
|
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
|
|
+ private static let smallDateFormatter: DateFormatter = {
|
|
|
|
|
+ let f = DateFormatter()
|
|
|
|
|
+ f.dateFormat = "EEEE, MMM d"
|
|
|
|
|
+ return f
|
|
|
|
|
+ }()
|
|
|
|
|
+
|
|
|
private static let fullDateFormatter: DateFormatter = {
|
|
private static let fullDateFormatter: DateFormatter = {
|
|
|
let f = DateFormatter()
|
|
let f = DateFormatter()
|
|
|
f.dateFormat = "EEEE, MMM d"
|
|
f.dateFormat = "EEEE, MMM d"
|