|
|
@@ -147,10 +147,9 @@ extension Bolus {
|
|
|
}
|
|
|
label: { Text(exceededMaxBolus ? "Max Bolus exceeded!" : "Enact bolus") }
|
|
|
.frame(maxWidth: .infinity, alignment: .center)
|
|
|
- .foregroundColor(exceededMaxBolus ? .loopRed : .accentColor)
|
|
|
- .disabled(
|
|
|
- state.amount <= 0 || state.amount > state.maxBolus
|
|
|
- )
|
|
|
+ .disabled(disabled)
|
|
|
+ .listRowBackground(!disabled ? Color(.systemBlue) : Color(.systemGray4))
|
|
|
+ .tint(.white)
|
|
|
}
|
|
|
}
|
|
|
if state.amount <= 0 {
|
|
|
@@ -265,6 +264,10 @@ extension Bolus {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ private var disabled: Bool {
|
|
|
+ state.amount <= 0 || state.amount > state.maxBolus
|
|
|
+ }
|
|
|
+
|
|
|
var changed: Bool {
|
|
|
((meal.first?.carbs ?? 0) > 0) || ((meal.first?.fat ?? 0) > 0) || ((meal.first?.protein ?? 0) > 0)
|
|
|
}
|