Skip to content

Commit

Permalink
Dining refactoring to clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
JHawk0224 committed Jan 21, 2024
1 parent dc1100d commit abd65ee
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 104 deletions.
9 changes: 0 additions & 9 deletions PennMobile/Dining/SwiftUI/DiningAnalyticsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ struct DiningAnalyticsView: View {
} else {
ScrollView {
VStack(alignment: .leading, spacing: 20) {
// HStack() {
// Text("Dining Analytics")
// .font(.system(size: 32))
// .bold()
//
// }
// Only show dollar history view if there is data for the graph
if !dollarHistory.wrappedValue.isEmpty {
CardView {
Expand Down Expand Up @@ -128,9 +122,6 @@ struct DiningAnalyticsView: View {
} else {
ScrollView {
VStack(alignment: .leading, spacing: 20) {
// Text("Dining Analytics")
// .font(.system(size: 32))
// .bold()
// Only show dollar history view if there is data for the graph
if !dollarXYHistory.wrappedValue.isEmpty {
CardView {
Expand Down
24 changes: 7 additions & 17 deletions PennMobile/Dining/SwiftUI/DiningSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@ struct DiningSettingsView: View {

@Environment(\.presentationMode) var presentationMode
@State private var totalData = false
private let options = ["Total data",
"Smart calculation",
"Weighted average"]
private let options = ["All data",
"Smart calculation",
"Weighted average"]

var body: some View {
if #available(iOS 16.0, *) {
NavigationView {
Form {
// Your settings view content here
Picker(selection: $viewModel.selectedOptionIndex, label: Text("Calculate Options")) {
Picker(selection: $viewModel.selectedOptionIndex, label: Text("Slope Calculation")) {
ForEach(0..<options.count, id: \.self) { index in
Text(options[index]).tag(index)
}
}
.pickerStyle(MenuPickerStyle())

//Toggle("Include guest swipes", isOn: $totalData)

// Toggle("Include guest swipes", isOn: $totalData)
}
.navigationBarTitle("Dining Analytics Settings")
.toolbar {
Expand All @@ -44,22 +42,19 @@ struct DiningSettingsView: View {
}
}
.navigationViewStyle(StackNavigationViewStyle())

}
.presentationDetents([.medium])
} else {
NavigationView {
Form {
// Your settings view content here
Picker(selection: $viewModel.selectedOptionIndex, label: Text("Calculate Options")) {
Picker(selection: $viewModel.selectedOptionIndex, label: Text("Slope Calculation")) {
ForEach(0..<options.count, id: \.self) { index in
Text(options[index]).tag(index)
}
}
.pickerStyle(MenuPickerStyle())

//Toggle("Include guest swipes", isOn: $totalData)

// Toggle("Include guest swipes", isOn: $totalData)
}
.navigationBarTitle("Dining Analytics Settings")
.toolbar {
Expand All @@ -72,12 +67,7 @@ struct DiningSettingsView: View {
}
}
.navigationViewStyle(StackNavigationViewStyle())

}
}
}
}
//
//#Preview {
// DiningSettingsView(viewModel: <#DiningAnalyticsViewModel#>)
//}
Loading

0 comments on commit abd65ee

Please sign in to comment.