|
|
@@ -20,6 +20,7 @@ struct CarbsView: View {
|
|
|
VStack(spacing: 16) {
|
|
|
HStack {
|
|
|
Button {
|
|
|
+ WKInterfaceDevice.current().play(.click)
|
|
|
let newValue = amount - 5
|
|
|
amount = max(newValue, 0)
|
|
|
} label: {
|
|
|
@@ -41,12 +42,14 @@ struct CarbsView: View {
|
|
|
)
|
|
|
Spacer()
|
|
|
Button {
|
|
|
+ WKInterfaceDevice.current().play(.click)
|
|
|
let newValue = amount + 5
|
|
|
amount = min(newValue, Double(state.maxCOB ?? 120))
|
|
|
} label: { Image(systemName: "plus") }
|
|
|
.frame(width: geo.size.width / 4)
|
|
|
}
|
|
|
Button {
|
|
|
+ WKInterfaceDevice.current().play(.click)
|
|
|
state.addCarbs(Int(amount))
|
|
|
}
|
|
|
label: {
|
|
|
@@ -56,13 +59,14 @@ struct CarbsView: View {
|
|
|
.resizable()
|
|
|
.frame(width: 24, height: 24)
|
|
|
.foregroundColor(.loopGreen)
|
|
|
- Text("Add Carbs")
|
|
|
+ Text("Add Carbs ")
|
|
|
}
|
|
|
}
|
|
|
.disabled(amount <= 0)
|
|
|
}.frame(maxHeight: .infinity)
|
|
|
}
|
|
|
- .navigationTitle("Add Carbs")
|
|
|
+ .navigationTitle("Add Carbs ")
|
|
|
+
|
|
|
.onAppear {
|
|
|
amount = Double(state.carbsRequired ?? 0)
|
|
|
}
|