add count to month view header
clean up spacing on day view
This commit is contained in:
@@ -125,12 +125,31 @@ extension MonthView {
|
||||
|
||||
// view that make up the list body
|
||||
extension MonthView {
|
||||
private func monthCountView(forMonth month: Int, year: Int) -> [MoodMetrics] {
|
||||
let (startDate, endDate) = Date.dateRange(monthInt: month, yearInt: year)
|
||||
let entries = PersistenceController.shared.getData(startDate: startDate, endDate: endDate, includedDays: [1,2,3,4,5,6,7])
|
||||
return Random.createTotalPerc(fromEntries: entries)
|
||||
}
|
||||
|
||||
|
||||
private func homeViewTwoSectionHeaderView(month: Int, year: Int) -> some View {
|
||||
ZStack {
|
||||
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
||||
.font(.body)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
HStack {
|
||||
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
||||
.font(.body)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
ForEach(monthCountView(forMonth: month, year: year)) {
|
||||
Text("\($0.total)")
|
||||
.font(.body)
|
||||
.fontWeight(.bold)
|
||||
.foregroundColor($0.mood.color)
|
||||
}
|
||||
}
|
||||
Text(String(customMoodTintUpdateNumber))
|
||||
.hidden()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user