Redux
The app mainly have two major redux slices: siteCondition
and calculator
.
There exists a slice stepSlice
in the /feature
folder. However, it's important to note that this particular slice is no longer used, it will be deprecated and eventually removed from the app in future updates.
Site Condition slice
The siteCondition
slice is mainly used for storing data from the user input for the Site Condition
page.
Initial state (/src/features/siteConditionSlice/state.js
):
const initialState = {
state: '',
stateId: '',
county: '',
countyId: '',
soilDrainage: '',
tileDrainage: false,
plannedPlantingDate: dayjs(new Date()).format('MM/DD/YYYY'),
acres: 0,
checkNRCSStandards: false,
council: '',
soilFertility: '',
latlon: [],
loading: false,
error: false,
states: [],
counties: [],
};
The loading
and error
state is used for site condition api which is located at /src/features/siteConditionSlice/api.js
.
Calculator slice
The calculator
slice is mainly used for storing data for the rest of pages.
Initial State (/src/features/calculatorSlice/state.js
):
const initialState = {
seedsSelected: [],
diversitySelected: [],
options: {},
crops: [],
loading: false,
error: false,
sideBarSelection: '',
mixSeedingRate: null,
adjustedMixSeedingRate: null,
bulkSeedingRate: {},
unit: 'acre',
}
seedsSelected
: saves selected seed data, contains detailed seed data and different from seed data in crops
.
diversitySelected
: saves selected diversity from selected seeds.
options
: selected seed options, which is used in calculator.
crops
: saves all crop data for a specific area from Site Condition
page.
The loading
and error
state is used for calculator api.
siteBarSelection
: used for saving selected seed from side bar.
mixSeedingRate
and adjustedMixSeedingRate
: used for Mix Seeding Rate
page, the mixSeedingRate
is the default value for the scroller. If the value is modified, use adjustedMixSeedingRate
instead.
bulkSeedingRate
: used for Review Mix
and Confirm Plan
page.
unit
: saves user selected unit value, the unit would apply to all seed data showed in the app.