|
|
@@ -171,39 +171,48 @@ extension Bolus {
|
|
|
VStack {
|
|
|
Form {
|
|
|
Section {
|
|
|
+ ForeCastChart(state: state, units: $state.units, stops: state.stops)
|
|
|
+ .padding(.vertical)
|
|
|
+ }.listRowBackground(Color.chart)
|
|
|
+
|
|
|
+ Section {
|
|
|
carbsTextField()
|
|
|
|
|
|
- if state.useFPUconversion {
|
|
|
- proteinAndFat()
|
|
|
- }
|
|
|
+ DisclosureGroup("Extras") {
|
|
|
+ if state.useFPUconversion {
|
|
|
+ proteinAndFat()
|
|
|
+ }
|
|
|
|
|
|
- // Time
|
|
|
- HStack {
|
|
|
- Text("Time").foregroundStyle(Color.secondary)
|
|
|
- Spacer()
|
|
|
- if !pushed {
|
|
|
- Button {
|
|
|
- pushed = true
|
|
|
- } label: { Text("Now") }.buttonStyle(.borderless).foregroundColor(.secondary)
|
|
|
- .padding(.trailing, 5)
|
|
|
- } else {
|
|
|
- Button { state.date = state.date.addingTimeInterval(-15.minutes.timeInterval) }
|
|
|
- label: { Image(systemName: "minus.circle") }.tint(.blue).buttonStyle(.borderless)
|
|
|
- DatePicker(
|
|
|
- "Time",
|
|
|
- selection: $state.date,
|
|
|
- displayedComponents: [.hourAndMinute]
|
|
|
- ).controlSize(.mini)
|
|
|
- .labelsHidden()
|
|
|
- Button {
|
|
|
- state.date = state.date.addingTimeInterval(15.minutes.timeInterval)
|
|
|
+ // Time
|
|
|
+ HStack {
|
|
|
+ Text("Time").foregroundStyle(Color.secondary)
|
|
|
+ Spacer()
|
|
|
+ if !pushed {
|
|
|
+ Button {
|
|
|
+ pushed = true
|
|
|
+ } label: { Text("Now") }.buttonStyle(.borderless).foregroundColor(.secondary)
|
|
|
+ .padding(.trailing, 5)
|
|
|
+ } else {
|
|
|
+ Button { state.date = state.date.addingTimeInterval(-15.minutes.timeInterval) }
|
|
|
+ label: { Image(systemName: "minus.circle") }.tint(.blue).buttonStyle(.borderless)
|
|
|
+ DatePicker(
|
|
|
+ "Time",
|
|
|
+ selection: $state.date,
|
|
|
+ displayedComponents: [.hourAndMinute]
|
|
|
+ ).controlSize(.mini)
|
|
|
+ .labelsHidden()
|
|
|
+ Button {
|
|
|
+ state.date = state.date.addingTimeInterval(15.minutes.timeInterval)
|
|
|
+ }
|
|
|
+ label: { Image(systemName: "plus.circle") }.tint(.blue).buttonStyle(.borderless)
|
|
|
}
|
|
|
- label: { Image(systemName: "plus.circle") }.tint(.blue).buttonStyle(.borderless)
|
|
|
}
|
|
|
- }
|
|
|
- HStack {
|
|
|
- Image(systemName: "square.and.pencil").foregroundColor(.secondary)
|
|
|
- TextFieldWithToolBarString(text: $state.note, placeholder: "", maxLength: 25)
|
|
|
+
|
|
|
+ // Notes
|
|
|
+ HStack {
|
|
|
+ Image(systemName: "square.and.pencil").foregroundColor(.secondary)
|
|
|
+ TextFieldWithToolBarString(text: $state.note, placeholder: "", maxLength: 25)
|
|
|
+ }
|
|
|
}
|
|
|
}.listRowBackground(Color.chart)
|
|
|
|
|
|
@@ -292,16 +301,13 @@ extension Bolus {
|
|
|
Toggle("", isOn: $state.externalInsulin).toggleStyle(Checkbox())
|
|
|
}
|
|
|
}.listRowBackground(Color.chart)
|
|
|
-
|
|
|
- Section {
|
|
|
- ForeCastChart(state: state, units: $state.units)
|
|
|
- .padding(.vertical)
|
|
|
- }.listRowBackground(Color.chart)
|
|
|
}
|
|
|
}
|
|
|
- .safeAreaInset(edge: .bottom, spacing: 0) {
|
|
|
+ .safeAreaInset(edge: .bottom, content: {
|
|
|
stickyButton
|
|
|
- }.blur(radius: state.waitForSuggestion ? 5 : 0)
|
|
|
+ })
|
|
|
+ .ignoresSafeArea(.keyboard, edges: .bottom)
|
|
|
+ .blur(radius: state.waitForSuggestion ? 5 : 0)
|
|
|
|
|
|
if state.waitForSuggestion {
|
|
|
CustomProgressView(text: progressText.rawValue)
|
|
|
@@ -396,15 +402,15 @@ extension Bolus {
|
|
|
|
|
|
private var taskButtonLabel: some View {
|
|
|
if pumpBolusLimitExceeded {
|
|
|
- return Text("Max Bolus of \(state.maxBolus) U Exceeded")
|
|
|
+ return Text("Max Bolus of \(state.maxBolus.description) U Exceeded")
|
|
|
} else if externalBolusLimitExceeded {
|
|
|
- return Text("Max External Bolus of \(state.maxExternal) U Exceeded")
|
|
|
+ return Text("Max External Bolus of \(state.maxExternal.description) U Exceeded")
|
|
|
} else if carbLimitExceeded {
|
|
|
- return Text("Max Carbs of \(state.maxCarbs) g Exceeded")
|
|
|
+ return Text("Max Carbs of \(state.maxCarbs.description) g Exceeded")
|
|
|
} else if fatLimitExceeded {
|
|
|
- return Text("Max Fat of \(state.maxFat) g Exceeded")
|
|
|
+ return Text("Max Fat of \(state.maxFat.description) g Exceeded")
|
|
|
} else if proteinLimitExceeded {
|
|
|
- return Text("Max Protein of \(state.maxProtein) g Exceeded")
|
|
|
+ return Text("Max Protein of \(state.maxProtein.description) g Exceeded")
|
|
|
}
|
|
|
|
|
|
let hasInsulin = state.amount > 0
|