Skip to content

Commit

Permalink
Profile override adaptive UI.
Browse files Browse the repository at this point in the history
Visualise the max limit.
And improve override summation in confirmation  alert.
  • Loading branch information
Jon-b-m committed Apr 10, 2023
1 parent 27071ef commit 4a60d3e
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ extension OverrideProfilesConfig {
onEditingChanged: { editing in
isEditing = editing
}
)
).accentColor(state.percentage >= 130 ? .red : .blue)
Text("\(state.percentage.formatted(.number)) %")
.foregroundColor(isEditing ? .orange : .blue)
.foregroundColor(
state
.percentage >= 130 ? .red :
(isEditing ? .orange : (state.percentage >= 150 ? .red : .blue))
)
.font(.largeTitle)
Spacer()
Toggle(isOn: $state._indefinite) {
Expand All @@ -81,7 +85,9 @@ extension OverrideProfilesConfig {
.frame(maxWidth: .infinity, alignment: .center)
.controlSize(.mini)
.alert(
"Saving this override will change your basal insulin, ISF and CR during the entire selected duration. Tapping save will start your new overide or edit your current active override.",
"Selected Override:\n\n\(state.percentage.formatted(.number)) %, " +
(state.duration > 0 ? "\(state.duration) min" : " infinite duration.") + "\n\n" +
"Saving this override will change your basal insulin, ISF and CR during the entire selected duration. Tapping save will start your new overide or edit your current active override.",
isPresented: $showAlert,
actions: {
Button("Cancel", role: .cancel) {}
Expand Down

0 comments on commit 4a60d3e

Please sign in to comment.