This commit is contained in:
Trey t
2022-12-23 12:17:55 -06:00
parent 87865571c1
commit adc1eadb49
4 changed files with 14 additions and 34 deletions

View File

@@ -81,15 +81,13 @@ struct DayView: View {
})
}
}
.padding([.top])
}
// MARK: Views
public var mainView: some View {
VStack {
settingsButtonView
.padding(.top)
if viewModel.hasNoData {
Spacer()
EmptyHomeView(showVote: true, viewModel: viewModel)
@@ -99,42 +97,22 @@ struct DayView: View {
headerView
listView
.padding(.top, 5)
}
}
}
.padding([.leading, .trailing])
.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.all)
)
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
PersistenceController.shared.fillInMissingDates()
viewModel.updateData()
}
}
private var settingsButtonView: some View {
HStack {
Spacer()
Button(action: {
showingSheet.toggle()
}, label: {
Image(systemName: "gear")
.foregroundColor(Color(UIColor.darkGray))
.font(.system(size: 20))
}).padding(.trailing)
}
}
private var headerView: some View {
VStack {
if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: UserDefaultsStore.getOnboarding()) {
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
viewModel.add(mood: mood, forDate: date, entryType: .header)
})
.frame(height: DayViewConstants.maxHeaderHeight)
.frame(minWidth: 0, maxWidth: .infinity)
}
}
}