reorganize content view
This commit is contained in:
@@ -183,6 +183,28 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var headerView: some View {
|
||||||
|
VStack {
|
||||||
|
if viewModel.shouldShowVotingHeader() {
|
||||||
|
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
|
||||||
|
withAnimation {
|
||||||
|
viewModel.add(mood: mood, forDate: date)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.frame(height: 180)
|
||||||
|
.frame(minWidth: 0, maxWidth: .infinity)
|
||||||
|
} else {
|
||||||
|
HeaderStatsView(fakeData: false, backDays: 30)
|
||||||
|
.frame(height: 180)
|
||||||
|
// should match backDays above
|
||||||
|
Text(String(format: String(localized: "content_view_header_title"), 30))
|
||||||
|
.font(.body)
|
||||||
|
.foregroundColor(Color(UIColor.systemGray))
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var mainView: some View {
|
private var mainView: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
|
||||||
@@ -190,27 +212,12 @@ struct ContentView: View {
|
|||||||
|
|
||||||
VStack{
|
VStack{
|
||||||
settingsButtonView
|
settingsButtonView
|
||||||
if viewModel.shouldShowVotingHeader() {
|
|
||||||
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
|
headerView
|
||||||
withAnimation {
|
|
||||||
viewModel.add(mood: mood, forDate: date)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.frame(height: 180)
|
|
||||||
.frame(minWidth: 0, maxWidth: .infinity)
|
|
||||||
} else {
|
|
||||||
HeaderStatsView(fakeData: false, backDays: 30)
|
|
||||||
.frame(height: 180)
|
|
||||||
// should match backDays above
|
|
||||||
Text(String(format: String(localized: "content_view_header_title"), 30))
|
|
||||||
.font(.body)
|
|
||||||
.foregroundColor(Color(UIColor.systemGray))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
|
||||||
}
|
|
||||||
listView
|
listView
|
||||||
.padding(.bottom)
|
|
||||||
}
|
}
|
||||||
.padding(.top, 50)
|
.padding(.bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user