feat: Begins flagged measurement list view.
This commit is contained in:
83
Sources/PressureEstimationsFeature/PressureEstimations.swift
Normal file
83
Sources/PressureEstimationsFeature/PressureEstimations.swift
Normal file
@@ -0,0 +1,83 @@
|
||||
import ComposableArchitecture
|
||||
import SharedModels
|
||||
import Styleguide
|
||||
import SwiftUI
|
||||
import TCAExtras
|
||||
|
||||
@Reducer
|
||||
public struct PressureEstimationsFeature {
|
||||
|
||||
public init() { }
|
||||
|
||||
@Reducer(state: .equatable)
|
||||
public enum Destination {
|
||||
case equipmentMeasurements(EquipmentMeasurementForm)
|
||||
}
|
||||
|
||||
@ObservableState
|
||||
public struct State: Equatable {
|
||||
@Presents public var destination: Destination.State?
|
||||
public var equipmentSettings: EquipmentSettingsForm.State
|
||||
public var equipmentMeasurements: EquipmentMeasurementForm.State?
|
||||
|
||||
public init(
|
||||
destination: Destination.State? = nil,
|
||||
equipmentSettings: EquipmentSettingsForm.State = .init(),
|
||||
equipmentMeasurements: EquipmentMeasurementForm.State? = nil
|
||||
) {
|
||||
self.destination = destination
|
||||
self.equipmentSettings = equipmentSettings
|
||||
self.equipmentMeasurements = equipmentMeasurements
|
||||
}
|
||||
}
|
||||
|
||||
public enum Action: ViewAction {
|
||||
case destination(PresentationAction<Destination.Action>)
|
||||
case equipmentSettings(EquipmentSettingsForm.Action)
|
||||
case view(View)
|
||||
|
||||
@CasePathable
|
||||
public enum View {
|
||||
case nextButtonTapped
|
||||
}
|
||||
}
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.equipmentSettings, action: \.equipmentSettings) {
|
||||
EquipmentSettingsForm()
|
||||
}
|
||||
Reduce<State, Action> { state, action in
|
||||
switch action {
|
||||
case .destination:
|
||||
return .none
|
||||
|
||||
case .equipmentSettings:
|
||||
return .none
|
||||
|
||||
case let .view(action):
|
||||
switch action {
|
||||
case .nextButtonTapped:
|
||||
return .none
|
||||
}
|
||||
}
|
||||
}
|
||||
.ifLet(\.$destination, action: \.destination)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ViewAction(for: PressureEstimationsFeature.self)
|
||||
public struct PressureEstimationsView: View {
|
||||
|
||||
@Bindable public var store: StoreOf<PressureEstimationsFeature>
|
||||
|
||||
public init(store: StoreOf<PressureEstimationsFeature>) {
|
||||
self.store = store
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
EquipmentSettingsFormView(
|
||||
store: store.scope(state: \.equipmentSettings, action: \.equipmentSettings)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user