-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from pennlabs/change-dining-slope
made the slope average of total + last7
- Loading branch information
Showing
4 changed files
with
184 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// DiningSettingsView.swift | ||
// PennMobile | ||
// | ||
// Created by Christina Qiu on 11/5/23. | ||
// Copyright © 2023 PennLabs. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import PennMobileShared | ||
|
||
struct DiningSettingsView: View { | ||
@ObservedObject var viewModel: DiningAnalyticsViewModel | ||
|
||
@Environment(\.presentationMode) var presentationMode | ||
@State private var totalData = false | ||
private let options = ["All data", | ||
"Smart calculation", | ||
"Weighted average"] | ||
|
||
var body: some View { | ||
if #available(iOS 16.0, *) { | ||
NavigationView { | ||
Form { | ||
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) | ||
} | ||
.navigationBarTitle("Dining Analytics Settings", displayMode: .inline) | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarTrailing) { | ||
Button(action: { | ||
presentationMode.wrappedValue.dismiss() | ||
}) { | ||
Text("Done") | ||
} | ||
} | ||
} | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
} | ||
.presentationDetents([.medium]) | ||
} else { | ||
NavigationView { | ||
Form { | ||
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) | ||
} | ||
.navigationBarTitle("Dining Analytics Settings", displayMode: .inline) | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarTrailing) { | ||
Button(action: { | ||
presentationMode.wrappedValue.dismiss() | ||
}) { | ||
Text("Done") | ||
} | ||
} | ||
} | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.