separate all customize views into their own files
make corner radius a constant create the views in the main app file and pass through so they dont get re-drawn when changing UI things
This commit is contained in:
@@ -15,8 +15,6 @@ struct DayViewConstants {
|
||||
}
|
||||
|
||||
struct DayView: View {
|
||||
@EnvironmentObject var daysFilter: DaysFilterClass
|
||||
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.deleteEnable.rawValue, store: GroupUserDefaults.groupDefaults) private var deleteEnabled = true
|
||||
@@ -47,6 +45,7 @@ struct DayView: View {
|
||||
@State private var showTodayInput = true
|
||||
@State private var showUpdateEntryAlert = false
|
||||
@StateObject private var onboardingData = OnboardingDataDataManager.shared
|
||||
@StateObject private var filteredDays = DaysFilterClass.shared
|
||||
|
||||
// MARK: header properties
|
||||
@State private var headerHeight: CGFloat = DayViewConstants.maxHeaderHeight
|
||||
@@ -54,10 +53,10 @@ struct DayView: View {
|
||||
@State private var headerOpacity: Double = 1.0
|
||||
//
|
||||
|
||||
@ObservedObject var viewModel: DayViewViewModel = DayViewViewModel(addMonthStartWeekdayPadding: false)
|
||||
@ObservedObject var viewModel: DayViewViewModel
|
||||
|
||||
var body: some View {
|
||||
mainView
|
||||
mainView
|
||||
.onAppear(perform: {
|
||||
EventLogger.log(event: "show_home_view")
|
||||
})
|
||||
@@ -149,7 +148,7 @@ struct DayView: View {
|
||||
.background(
|
||||
theme.currentTheme.secondaryBGColor
|
||||
)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
|
||||
Spacer()
|
||||
}
|
||||
@@ -270,7 +269,7 @@ struct DayView: View {
|
||||
yOffset: value)
|
||||
}
|
||||
}
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight])
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight])
|
||||
}
|
||||
|
||||
func getBackEntries() -> [MoodEntry] {
|
||||
@@ -300,7 +299,7 @@ extension DayView {
|
||||
ForEach(entries.sorted(by: {
|
||||
return $0.forDate! > $1.forDate!
|
||||
}), id: \.self) { entry in
|
||||
if daysFilter.currentFilters.contains(Int(entry.weekDay)) {
|
||||
if filteredDays.currentFilters.contains(Int(entry.weekDay)) {
|
||||
EntryListView(entry: entry)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture(perform: {
|
||||
|
||||
Reference in New Issue
Block a user