Skip to content

Commit

Permalink
Simplify new TT Slider UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-b-m committed Apr 2, 2023
1 parent 7f405e3 commit f2fc99a
Showing 1 changed file with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ extension AddTempTarget {
}

HStack {
Text("Advanced")
Text("Experimental")
Toggle(isOn: $state.viewPercantage) {}.controlSize(.mini)
Image(systemName: "figure.highintensity.intervaltraining")
Image(systemName: "fork.knife")
}

if state.viewPercantage {
Section(
header: Text("Percent Insulin")
header: Text("")
) {
VStack {
Slider(
Expand All @@ -56,32 +56,31 @@ extension AddTempTarget {
isEditing = editing
}
)
Text("\(state.percentage.formatted(.number)) %")
.foregroundColor(isEditing ? .orange : .blue)
.font(.largeTitle)
HStack {
Text("Insulin \(state.percentage.formatted(.number)) %")
.foregroundColor(isEditing ? .orange : .blue)
.font(.largeTitle)
}
Divider()
Text(
NSLocalizedString("Target glucose", comment: "") +
(
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"
)
)

Slider(
value: $state.hbt,
in: 101 ... 295,
step: 1
)
Text(
state
.units == .mgdL ? "Half normal Basal at: \(state.hbt.formatted(.number)) mg/dl" :
"Half normal Basal at: \(state.hbt.asMmolL.formatted(.number.grouping(.never).rounded().precision(.fractionLength(1)))) mmol/L"
)
.foregroundColor(.secondary)
.font(.caption).italic()
).accentColor(.green)

HStack {
Text(
NSLocalizedString("Target glucose", comment: "") +
(
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"
)
)
.foregroundColor(.green)
}
}
}
} else {
Expand Down

0 comments on commit f2fc99a

Please sign in to comment.