|
@@ -213,12 +213,12 @@ struct EditTempTargetForm: View {
|
|
|
Text("Duration")
|
|
Text("Duration")
|
|
|
Spacer()
|
|
Spacer()
|
|
|
Text(formatHrMin(Int(duration)))
|
|
Text(formatHrMin(Int(duration)))
|
|
|
- .foregroundColor(!displayPickerDuration ? .primary : .accentColor)
|
|
|
|
|
|
|
+ .foregroundColor(!displayPickerDuration ? (duration > 0 ? .primary : .secondary) : .accentColor)
|
|
|
}
|
|
}
|
|
|
.onTapGesture {
|
|
.onTapGesture {
|
|
|
displayPickerDuration = toggleScrollWheel(displayPickerDuration)
|
|
displayPickerDuration = toggleScrollWheel(displayPickerDuration)
|
|
|
}
|
|
}
|
|
|
- .onChange(of: duration) { hasChanges = true }
|
|
|
|
|
|
|
+// .onChange(of: duration) { hasChanges = true }
|
|
|
|
|
|
|
|
if displayPickerDuration {
|
|
if displayPickerDuration {
|
|
|
HStack {
|
|
HStack {
|
|
@@ -231,7 +231,7 @@ struct EditTempTargetForm: View {
|
|
|
let minutes = Int(truncating: duration as NSNumber) % 60
|
|
let minutes = Int(truncating: duration as NSNumber) % 60
|
|
|
let totalMinutes = $0 * 60 + minutes
|
|
let totalMinutes = $0 * 60 + minutes
|
|
|
duration = Decimal(totalMinutes)
|
|
duration = Decimal(totalMinutes)
|
|
|
- hasChanges = true
|
|
|
|
|
|
|
+ hasChanges = duration > 0 ? true : false // prevents the user from setting 0 min
|
|
|
}
|
|
}
|
|
|
),
|
|
),
|
|
|
label: Text("")
|
|
label: Text("")
|
|
@@ -251,7 +251,7 @@ struct EditTempTargetForm: View {
|
|
|
},
|
|
},
|
|
|
set: {
|
|
set: {
|
|
|
duration = Decimal((Int(truncating: duration as NSNumber) / 60) * 60 + $0)
|
|
duration = Decimal((Int(truncating: duration as NSNumber) / 60) * 60 + $0)
|
|
|
- hasChanges = true
|
|
|
|
|
|
|
+ hasChanges = duration > 0 ? true : false
|
|
|
}
|
|
}
|
|
|
),
|
|
),
|
|
|
label: Text("")
|
|
label: Text("")
|