add count to month view header
clean up spacing on day view
This commit is contained in:
@@ -42,6 +42,10 @@ struct DayView: View {
|
|||||||
@ObservedObject var viewModel: DayViewViewModel
|
@ObservedObject var viewModel: DayViewViewModel
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
Text(String(customMoodTintUpdateNumber))
|
||||||
|
.hidden()
|
||||||
|
|
||||||
mainView
|
mainView
|
||||||
.onAppear(perform: {
|
.onAppear(perform: {
|
||||||
EventLogger.log(event: "show_home_view")
|
EventLogger.log(event: "show_home_view")
|
||||||
@@ -76,30 +80,28 @@ struct DayView: View {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Views
|
// MARK: Views
|
||||||
public var mainView: some View {
|
public var mainView: some View {
|
||||||
VStack {
|
VStack {
|
||||||
settingsButtonView
|
settingsButtonView
|
||||||
|
.padding(.top)
|
||||||
|
|
||||||
if viewModel.hasNoData {
|
if viewModel.hasNoData {
|
||||||
Spacer()
|
Spacer()
|
||||||
EmptyHomeView(showVote: true, viewModel: viewModel)
|
EmptyHomeView(showVote: true, viewModel: viewModel)
|
||||||
Spacer()
|
Spacer()
|
||||||
} else {
|
} else {
|
||||||
ZStack {
|
|
||||||
Text(String(customMoodTintUpdateNumber))
|
|
||||||
.hidden()
|
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
headerView
|
headerView
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
listView
|
listView
|
||||||
|
.padding(.top, 5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding()
|
}
|
||||||
.padding(.bottom, 5)
|
.padding([.leading, .trailing, .bottom])
|
||||||
.background(
|
.background(
|
||||||
theme.currentTheme.bg
|
theme.currentTheme.bg
|
||||||
.edgesIgnoringSafeArea(.all)
|
.edgesIgnoringSafeArea(.all)
|
||||||
|
|||||||
@@ -125,12 +125,31 @@ extension MonthView {
|
|||||||
|
|
||||||
// view that make up the list body
|
// view that make up the list body
|
||||||
extension MonthView {
|
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 {
|
private func homeViewTwoSectionHeaderView(month: Int, year: Int) -> some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
HStack {
|
||||||
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
Text("\(Random.monthName(fromMonthInt: month)) \(String(year))")
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.foregroundColor(textColor)
|
.foregroundColor(textColor)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.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))
|
Text(String(customMoodTintUpdateNumber))
|
||||||
.hidden()
|
.hidden()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user