Skip to content

Commit

Permalink
Hide target slider when ratio 1
Browse files Browse the repository at this point in the history
(cherry picked from commit 9ed6861)
(cherry picked from commit aafaa7a)
  • Loading branch information
Jon-b-m committed Apr 3, 2023
1 parent 72a998a commit 257202c
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,28 @@ extension AddTempTarget {
.foregroundColor(isEditing ? .orange : .blue)
.font(.largeTitle)
}
Divider()
// Only display target slider when not 100 %
if state.percentage != 100 {
Divider()

Slider(
value: $state.hbt,
in: 101 ... 295,
step: 1
).accentColor(.green)
Slider(
value: $state.hbt,
in: 101 ... 295,
step: 1
).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"
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: "")
)
+ NSLocalizedString(" Target Glucose", comment: "")
)
.foregroundColor(.green)
.foregroundColor(.green)
}
}
}
}
Expand Down

0 comments on commit 257202c

Please sign in to comment.