diff --git a/KisaniCal/Views/SplashView.swift b/KisaniCal/Views/SplashView.swift index ce6b0e1..a243145 100644 --- a/KisaniCal/Views/SplashView.swift +++ b/KisaniCal/Views/SplashView.swift @@ -20,7 +20,6 @@ struct SplashView: View { .scaleEffect(calendarScale) .opacity(calendarOpacity) - // Wordmark: kisaniCAL. VStack(spacing: 1) { Text("kisani") .font(AppFonts.mono(11, weight: .regular)) @@ -63,55 +62,30 @@ struct SplashView: View { private struct SplashCalendarCard: View { @Environment(\.colorScheme) private var cs - private let cal = Calendar.current - private let today = Calendar.current.component(.day, from: Date()) - private let monthName: String = { - let fmt = DateFormatter(); fmt.dateFormat = "MMMM" - return fmt.string(from: Date()) + private static let cal = Calendar.current + private static let today = cal.component(.day, from: Date()) + private static let monthFmt: DateFormatter = { + let f = DateFormatter(); f.dateFormat = "MMMM"; return f }() - // Flat day array: nil = empty cell, Int = day number - private var days: [Int?] { + private static var days: [Int?] { let now = Date() - let range = cal.range(of: .day, in: .month, for: now)!.count + let count = cal.range(of: .day, in: .month, for: now)!.count let first = cal.date(from: cal.dateComponents([.year, .month], from: now))! let lead = cal.component(.weekday, from: first) - 1 var grid: [Int?] = Array(repeating: nil, count: lead) - grid += (1...range).map { Optional($0) } + grid += (1...count).map { Optional($0) } while grid.count % 7 != 0 { grid.append(nil) } return grid } var body: some View { VStack(spacing: 0) { - // Month label - Text(monthName.uppercased()) - .font(AppFonts.mono(9, weight: .bold)) - .foregroundColor(AppColors.text3(cs)) - .kerning(2) - .padding(.bottom, 10) - - // Day-of-week header - HStack(spacing: 0) { - ForEach(Array(["S","M","T","W","T","F","S"].enumerated()), id: \.offset) { _, d in - Text(d) - .font(AppFonts.mono(7.5, weight: .bold)) - .foregroundColor(AppColors.text3(cs)) - .frame(maxWidth: .infinity) - } - } - .padding(.bottom, 6) - - // Day grid - let rowCount = days.count / 7 - ForEach(0..