Add soil variant step to the frontend

- Renamed location step folder
This commit is contained in:
Dana Lambert 2021-10-20 09:51:49 +13:00
parent 10ae4f46ce
commit c4fdd04e8b
7 changed files with 88 additions and 21 deletions

View file

@ -5,8 +5,8 @@ import Step from '@mui/material/Step';
import StepLabel from '@mui/material/StepLabel'; import StepLabel from '@mui/material/StepLabel';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import LocationStep from './steps/location/Location' import LocationStep from './steps/locationstep/Location'
import SoilStep from './steps/Soil' import SoilStep from './steps/soilvariantstep/Soil'
import ResultsStep from './steps/Results' import ResultsStep from './steps/Results'
const steps = [ const steps = [

View file

@ -1,15 +0,0 @@
import Step from './Step';
export default function SoilVariantStep() {
const soilVarientInfoPanel = (
<h1>Soil Information</h1>
)
const soilVarientSelectionPanel = (
<h1>Soil Selection</h1>
)
return (
<Step informationComponent={soilVarientInfoPanel} selectionComponent={soilVarientSelectionPanel} />
)
}

View file

@ -14,10 +14,10 @@ export default function Step(props) {
props.contentComponent props.contentComponent
) : ( ) : (
<Row style={{height: '100%'}}> <Row style={{height: '100%'}}>
<Col md="5" sm="12"> <Col md="4" sm="12" style={{display: 'flex', alignItems: 'center'}}>
{props.informationComponent} {props.informationComponent}
</Col> </Col>
<Col md="7" sm="12"> <Col md="8" sm="12" style={{display: 'flex', alignItems: 'center'}}>
{props.selectionComponent} {props.selectionComponent}
</Col> </Col>
</Row> </Row>

View file

@ -3,7 +3,7 @@ import LocationSelectorMap from './Map'
export default function LocationStep(props) { export default function LocationStep(props) {
const locationInfoPanel = ( const locationInfoPanel = (
<div className='py-5'> <div className='ph-4'>
<h4>Right Plant Right Place Plant Selector Tool for New Zealand.</h4> <h4>Right Plant Right Place Plant Selector Tool for New Zealand.</h4>
<br/> <br/>
<p> <p>

View file

@ -39,7 +39,7 @@ const fitNZBounds = (map) => {
function CoordinatesDisplay(props) { function CoordinatesDisplay(props) {
const savedCoordinates = props.filters["coordinates"]; const savedCoordinates = props.filters["coordinates"];
return savedCoordinates ? ( return savedCoordinates ? (
<div class='coordinates-display'> <div className='coordinates-display'>
<strong>Latitude:</strong> {savedCoordinates.lat} <br /> <strong>Latitude:</strong> {savedCoordinates.lat} <br />
<strong>Longitude:</strong> {savedCoordinates.lng} <strong>Longitude:</strong> {savedCoordinates.lng}
</div> </div>

View file

@ -0,0 +1,26 @@
import Step from '../Step';
import SoilSelector from './SoilSelector';
export default function SoilVariantStep(props) {
const soilVarientInfoPanel = (
<div className='ph-4'>
<h4>Soil Variant Selection</h4>
<br />
<p>
From your site location, we use <a href="https://soils.landcareresearch.co.nz/describing-soils/nzsc/" target="blank">New Zealand Soil Classification</a> data and additional <a href="https://www.landcareresearch.co.nz" target="blank">Manaaki Whenua Landcare Research</a> data to determine overall soil type. However we also need to know as much as possible about the moisture content of the soil at your planting site location.
<br /><br />
Please select an option from the choices listed to the right:
</p>
</div>
)
const soilVarientSelectionPanel = (
<div className='p-5'>
<SoilSelector {...props} />
</div>
)
return (
<Step informationComponent={soilVarientInfoPanel} selectionComponent={soilVarientSelectionPanel} />
)
}

View file

@ -0,0 +1,56 @@
import * as React from 'react';
import Radio from '@mui/material/Radio';
import RadioGroup from '@mui/material/RadioGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import FormLabel from '@mui/material/FormLabel';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import Tooltip from '@mui/material/Tooltip';
const WET_SOIL_DESCRIPTION = (<p>
Is your ground/soil <strong>VERY WET</strong>? i.e. is it soft and squishy under foot with ground water at or near surface for three months of year or more? Your soil is considered wet if the <Tooltip arrow title="Topsoil is the uppermost layer of soil usually 5-20cm of dark soil with high concentrations of organic matter. Subsoil is the layer under the topsoil and generally contains less organic matter and more of the small particles such as sand, silt and clay that characterize the mineral and geology of the location."><strong>subsoil</strong></Tooltip> is either very dark brown and <Tooltip arrow title="Peat is an accumulation of partially decayed vegetation or organic matter, usually brown and often formed in waterlogged areas."><strong>peat</strong></Tooltip>-like, or grey rather than a red, brown, or yellow rusty colour?
</p>);
const DRY_SOIL_DESCRIPTION = (<p>
Is your ground/soil <strong>VERY DRY</strong>? i.e. If your soil is very well drained, stony, sandy or shallow (less than one metre depth to bed rock, stones or other hard/artificial surface), or is it completely dry for three months of year or more, and not irrigated then we consider it dry.
</p>);
const MESIC_SOIL_DESCRIPTION = (<p>
If your ground/soil does not meet either of the two previous definitions, wed likely classify it as <strong>MOIST, or somewhere in between very wet and very dry</strong>. Your ground is considered moist if it has compacted soil that is fine or has a soft/crumbly texture. The sand, silt and clay mixture known as loam is considered moist in this context. Moist soils are more than one metre above an impervious layer, and are never water-logged nor are they completely dry for more than three months. If you are unsure, or if you plan to irrigate your site, then select this option.
</p>);
export default function SoilSelector(props) {
const [value, setValue] = React.useState('');
const [helperText, setHelperText] = React.useState('Please select your soil variant from the options above.');
const handleRadioChange = (event) => {
const soilVariantSelection = event.target.value;
setValue(soilVariantSelection);
setHelperText(' ');
props.updateFilterState({ "soilVariant": soilVariantSelection });
props.setNextDisabled(false);
};
return (
<form >
<FormControl
sx={{ m: 3 }}
component="fieldset"
variant="standard"
>
<FormLabel component="legend">Soil Variant Options</FormLabel>
<RadioGroup
aria-label="soil-varient-selection"
name="soil varient selection"
value={value}
onChange={handleRadioChange}
>
<FormControlLabel value="D" control={<Radio />} label={DRY_SOIL_DESCRIPTION} sx={{ paddingTop: '15px', paddingBottom: '15px' }}/>
<FormControlLabel value="W" control={<Radio />} label={WET_SOIL_DESCRIPTION} sx={{ paddingTop: '15px', paddingBottom: '15px' }} />
<FormControlLabel value="M" control={<Radio />} label={MESIC_SOIL_DESCRIPTION} sx={{ paddingTop: '15px', paddingBottom: '15px' }} />
</RadioGroup>
<FormHelperText>{helperText}</FormHelperText>
</FormControl>
</form>
);
}