feat: wip

This commit is contained in:
2024-06-17 11:46:42 -04:00
parent cf4c00d9d5
commit fd3d33878a
7 changed files with 35 additions and 26 deletions

View File

@@ -3,7 +3,6 @@ import SharedModels
import Styleguide
import SwiftUI
#warning("Add info view destination??")
/// Allows for rated static pressure fields to be optional values, setting their corresponding shared state values to zero when they're nilled out.
///
@Reducer
@@ -38,7 +37,8 @@ public struct RatedStaticPressuresSection {
case minimum
case rated
var label: String { rawValue.capitalized }
public var label: String { rawValue.capitalized }
public var prompt: String { "\(label) Pressure"}
}
}
@@ -95,7 +95,7 @@ public struct RatedStaticPressuresSectionView: View {
"Maximum",
value: $store.maxPressure,
fractionLength: 2,
prompt: Text("Max Static Pressure")
prompt: prompt(for: .maximum)
)
.decimalPad()
.focused($focusedField, equals: .maximum)
@@ -106,7 +106,7 @@ public struct RatedStaticPressuresSectionView: View {
"Minimum",
value: $store.minPressure,
fractionLength: 2,
prompt: Text("Min Static Pressure")
prompt: prompt(for: .minimum)
)
.decimalPad()
.focused($focusedField, equals: .minimum)
@@ -117,7 +117,7 @@ public struct RatedStaticPressuresSectionView: View {
"Rated",
value: $store.ratedPressure,
fractionLength: 2,
prompt: Text("Rated Static Pressure")
prompt: prompt(for: .rated)
)
.decimalPad()
.focused($focusedField, equals: .rated)
@@ -138,4 +138,8 @@ public struct RatedStaticPressuresSectionView: View {
private func label(for field: RatedStaticPressuresSection.State.FocusedField) -> some View {
TextLabel(field.label)
}
private func prompt(for field: RatedStaticPressuresSection.State.FocusedField) -> Text {
Text(field.prompt)
}
}