|
@@ -41,10 +41,12 @@ extension AddTempTarget {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if state.viewPercantage {
|
|
if state.viewPercantage {
|
|
|
- Section(
|
|
|
|
|
- header: Text("")
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ Section {
|
|
|
VStack {
|
|
VStack {
|
|
|
|
|
+ Text("\(state.percentage.formatted(.number)) % Insulin")
|
|
|
|
|
+ .foregroundColor(isEditing ? .orange : .blue)
|
|
|
|
|
+ .font(.largeTitle)
|
|
|
|
|
+ .padding(.vertical)
|
|
|
Slider(
|
|
Slider(
|
|
|
value: $state.percentage,
|
|
value: $state.percentage,
|
|
|
in: 15 ...
|
|
in: 15 ...
|
|
@@ -54,33 +56,27 @@ extension AddTempTarget {
|
|
|
isEditing = editing
|
|
isEditing = editing
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
- HStack {
|
|
|
|
|
- Text("\(state.percentage.formatted(.number)) % Insulin")
|
|
|
|
|
- .foregroundColor(isEditing ? .orange : .blue)
|
|
|
|
|
- .font(.largeTitle)
|
|
|
|
|
- }
|
|
|
|
|
// Only display target slider when not 100 %
|
|
// Only display target slider when not 100 %
|
|
|
if state.percentage != 100 {
|
|
if state.percentage != 100 {
|
|
|
|
|
+ Spacer()
|
|
|
Divider()
|
|
Divider()
|
|
|
|
|
+ Text(
|
|
|
|
|
+ (
|
|
|
|
|
+ state
|
|
|
|
|
+ .units == .mmolL ?
|
|
|
|
|
+ "\(state.computeTarget().asMmolL.formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))) mmol/L" :
|
|
|
|
|
+ "\(state.computeTarget().formatted(.number.grouping(.never).rounded().precision(.fractionLength(0)))) mg/dl"
|
|
|
|
|
+ )
|
|
|
|
|
+ + NSLocalizedString(" Target Glucose", comment: "")
|
|
|
|
|
+ )
|
|
|
|
|
+ .foregroundColor(.green)
|
|
|
|
|
+ .padding(.vertical)
|
|
|
|
|
|
|
|
Slider(
|
|
Slider(
|
|
|
value: $state.hbt,
|
|
value: $state.hbt,
|
|
|
in: 101 ... 295,
|
|
in: 101 ... 295,
|
|
|
step: 1
|
|
step: 1
|
|
|
).accentColor(.green)
|
|
).accentColor(.green)
|
|
|
-
|
|
|
|
|
- HStack {
|
|
|
|
|
- Text(
|
|
|
|
|
- (
|
|
|
|
|
- state
|
|
|
|
|
- .units == .mmolL ?
|
|
|
|
|
- "\(state.computeTarget().asMmolL.formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))) mmol/L" :
|
|
|
|
|
- "\(state.computeTarget().formatted(.number.grouping(.never).rounded().precision(.fractionLength(0)))) mg/dl"
|
|
|
|
|
- )
|
|
|
|
|
- + NSLocalizedString(" Target Glucose", comment: "")
|
|
|
|
|
- )
|
|
|
|
|
- .foregroundColor(.green)
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|