@@ -13,7 +13,6 @@ struct FilterView: View {
|
||||
let months = [(0, "J"), (1, "F"), (2,"M"), (3,"A"), (4,"M"), (5, "J"), (6,"J"), (7,"A"), (8,"S"), (9,"O"), (10, "N"), (11,"D")]
|
||||
|
||||
@State private var toggle = true
|
||||
|
||||
@State private var showFilter = false
|
||||
|
||||
@FetchRequest(
|
||||
@@ -21,6 +20,8 @@ struct FilterView: View {
|
||||
animation: .spring())
|
||||
private var items: FetchedResults<MoodEntry>
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@StateObject private var viewModel = FilterViewModel()
|
||||
//[
|
||||
// 2001: [0: [], 1: [], 2: []],
|
||||
@@ -63,6 +64,10 @@ struct FilterView: View {
|
||||
self.viewModel.filterEntries(startDate: Date(timeIntervalSince1970: 0), endDate: Date())
|
||||
})
|
||||
}
|
||||
.background(
|
||||
theme.bg
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
)
|
||||
}
|
||||
|
||||
private var filterButon: some View {
|
||||
@@ -75,7 +80,7 @@ struct FilterView: View {
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 44)
|
||||
.foregroundColor(Color(UIColor.label))
|
||||
.background(Color(UIColor.secondarySystemBackground))
|
||||
.background(Color(theme.secondaryBGColor))
|
||||
.cornerRadius(25)
|
||||
}).frame(maxWidth: .infinity)
|
||||
}
|
||||
@@ -97,7 +102,7 @@ struct FilterView: View {
|
||||
|
||||
private var statsView: some View {
|
||||
ZStack {
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
Color(theme.secondaryBGColor)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
@@ -115,7 +120,7 @@ struct FilterView: View {
|
||||
VStack {
|
||||
VStack {
|
||||
ZStack {
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
Color(theme.secondaryBGColor)
|
||||
DatePicker(
|
||||
String(localized: "filter_view_begin_date"),
|
||||
selection: $viewModel.entryStartDate,
|
||||
@@ -130,7 +135,7 @@ struct FilterView: View {
|
||||
.padding([.leading, .trailing])
|
||||
|
||||
ZStack {
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
Color(theme.secondaryBGColor)
|
||||
DatePicker(
|
||||
String(localized: "filter_view_end_date"),
|
||||
selection: $viewModel.entryEndDate,
|
||||
@@ -145,7 +150,7 @@ struct FilterView: View {
|
||||
.padding([.leading, .trailing])
|
||||
|
||||
ZStack {
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
Color(theme.secondaryBGColor)
|
||||
HStack {
|
||||
Spacer()
|
||||
ForEach(weekdays.indices, id: \.self) { dayIdx in
|
||||
@@ -198,6 +203,10 @@ struct FilterView: View {
|
||||
Text(String(yearKey))
|
||||
.font(.title)
|
||||
yearGridView(yearData: yearData, columns: columns)
|
||||
.background(
|
||||
Color(theme.secondaryBGColor)
|
||||
)
|
||||
.cornerRadius(25)
|
||||
}
|
||||
}
|
||||
.simultaneousGesture(DragGesture().onChanged({ _ in
|
||||
@@ -215,20 +224,16 @@ struct FilterView: View {
|
||||
let columns: [GridItem]
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
|
||||
VStack {
|
||||
LazyVGrid(columns: columns, spacing: 0) {
|
||||
ForEach(Array(yearData.keys.sorted(by: <)), id: \.self) { monthKey in
|
||||
let monthData = yearData[monthKey]!
|
||||
VStack {
|
||||
monthGridView(monthData: monthData)
|
||||
}
|
||||
VStack {
|
||||
LazyVGrid(columns: columns, spacing: 0) {
|
||||
ForEach(Array(yearData.keys.sorted(by: <)), id: \.self) { monthKey in
|
||||
let monthData = yearData[monthKey]!
|
||||
VStack {
|
||||
monthGridView(monthData: monthData)
|
||||
}
|
||||
}
|
||||
.padding([.leading, .trailing, .top, .bottom])
|
||||
}
|
||||
.padding([.leading, .trailing, .top, .bottom])
|
||||
}
|
||||
.cornerRadius(25)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user