Skip to content

Commit

Permalink
Change temp target slider number position consistent with nightscout#291
Browse files Browse the repository at this point in the history
  • Loading branch information
dnzxy authored Nov 10, 2023
1 parent 6c701dd commit 62c2aff
Showing 1 changed file with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ extension AddTempTarget {
}

if state.viewPercantage {
Section(
header: Text("")
) {
Section {
VStack {
Text("\(state.percentage.formatted(.number)) % Insulin")
.foregroundColor(isEditing ? .orange : .blue)
.font(.largeTitle)
.padding(.vertical)
Slider(
value: $state.percentage,
in: 15 ...
Expand All @@ -54,33 +56,27 @@ extension AddTempTarget {
isEditing = editing
}
)
HStack {
Text("\(state.percentage.formatted(.number)) % Insulin")
.foregroundColor(isEditing ? .orange : .blue)
.font(.largeTitle)
}
// Only display target slider when not 100 %
if state.percentage != 100 {
Spacer()
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(
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"
)
+ NSLocalizedString(" Target Glucose", comment: "")
)
.foregroundColor(.green)
}
}
}
}
Expand Down

0 comments on commit 62c2aff

Please sign in to comment.