diff --git a/frontend/src/assets/data/staticText.json b/frontend/src/assets/data/staticText.json
index ce6155e..56a12e9 100644
--- a/frontend/src/assets/data/staticText.json
+++ b/frontend/src/assets/data/staticText.json
@@ -1,5 +1,9 @@
{
"steps": {
+ "address": {
+ "title": "Right Plant Right Place Right Time\nPlant Selector Tool for New Zealand.",
+ "description": "Your native plant selection starts here! Register by entering your address. On the following pages you will provide more details on your project until the system has enough information to create your plant species list and planting plan. To start, click on the map and pan and zoom to the site location. Once the location is selected, click on the “next step” button to complete the process. Repeat this process for sites at different locations."
+ },
"location": {
"title": "Right Plant Right Place Right Time\nPlant Selector Tool for New Zealand.",
"description": "Your native plant selection starts here! Use the map to select a planting site location within New Zealand. On the following pages you will provide more details on your project until the system has enough information to create your plant species list and planting plan. To start, click on the map and pan and zoom to the site location. Once the location is selected, click on the “next step” button to complete the process. Repeat this process for sites at different locations."
diff --git a/frontend/src/components/Stepper.js b/frontend/src/components/Stepper.js
index b914f72..b659cd6 100644
--- a/frontend/src/components/Stepper.js
+++ b/frontend/src/components/Stepper.js
@@ -1,4 +1,4 @@
-import * as React from 'react';
+import { useState } from 'react';
import Box from '@mui/material/Box';
import Stepper from '@mui/material/Stepper';
import Step from '@mui/material/Step';
@@ -6,26 +6,11 @@ import StepLabel from '@mui/material/StepLabel';
import Button from '@mui/material/Button';
import Tooltip from '@mui/material/Tooltip';
-import LocationStep from './steps/location/LocationStep'
-import SoilStep from './steps/soilvariant/SoilStep'
-import HabitatStep from './steps/habitat/HabitatStep';
-import ZoneStep from './steps/zone/ZoneStep';
-import SummaryStep from './steps/summary/SummaryStep';
-import ResultsStep from './steps/results/ResultsStep'
-
-const steps = [
- { 'label': 'Select location', 'component': LocationStep, 'tooltip': "Click on a location on the map" },
- { 'label': 'Choose soil', 'component': SoilStep, 'tooltip': "Describe the moisture content of your soil" },
- { 'label': 'Choose habitat', 'component': HabitatStep, 'tooltip': "Specify type of landscape to be planted" },
- { 'label': 'Select zone', 'component': ZoneStep, 'tooltip': "Specify geographical detail" },
- { 'label': 'Summary', 'component': SummaryStep, 'tooltip': "Check your inputs" },
- { 'label': 'Results', 'component': ResultsStep, 'tooltip': "List of plant species and user guide" }
-];
-
-export default function StepperWizard(props) {
- const [activeStep, setActiveStep] = React.useState(0);
- const [nextDisabled, setNextDisabled] = React.useState(true);
- const [redirectBack, setRedirectBack] = React.useState(false);
+export default function StepperWizard({ steps }) {
+ const [filters, setFilters] = useState({});
+ const [activeStep, setActiveStep] = useState(0);
+ const [nextDisabled, setNextDisabled] = useState(true);
+ const [redirectBack, setRedirectBack] = useState(false);
const resetStepState = () => {
setNextDisabled(true);
@@ -49,7 +34,11 @@ export default function StepperWizard(props) {
const handleReset = () => {
setActiveStep(0);
resetStepState();
- props.resetFilterState()
+ setFilters({});
+ };
+
+ const updateFilterState = (newFilters) => {
+ setFilters(f => ({...f, ...newFilters}));
};
let CurrentStep = activeStep >= steps.length ? steps[steps.length - 1].component : steps[activeStep].component;
@@ -67,8 +56,14 @@ export default function StepperWizard(props) {
);
})}
-
-
+ <>
+ setFilters({})}
+ setNextDisabled={setNextDisabled}
+ setRedirectBack={setRedirectBack}
+ />
: }
-
+ >
);
}
diff --git a/frontend/src/components/steps/address/AddressSearch.jsx b/frontend/src/components/steps/address/AddressSearch.jsx
new file mode 100644
index 0000000..1bf9b2a
--- /dev/null
+++ b/frontend/src/components/steps/address/AddressSearch.jsx
@@ -0,0 +1,88 @@
+import { useState, useRef, useEffect } from 'react';
+import { InputAdornment, TextField } from '@mui/material';
+import PlaceIcon from '@mui/icons-material/Place';
+import Box from '@mui/material/Box';
+import List from '@mui/material/List';
+import ListItem from '@mui/material/ListItem';
+import ListItemButton from '@mui/material/ListItemButton';
+import ListItemText from '@mui/material/ListItemText';
+import LocationRepsostory from '../../../repository/LocationRepository';
+import { CircularProgress } from "@mui/material";
+
+
+const AddressSearchSuggestions = ({results, onClick}) => (
+ (Array.isArray(results) && results.length > 0)
+ ?
+
+ {results.map((r) => (
+
+ onClick(r)}>
+
+
+
+ ))}
+
+
+ : null);
+
+const AddressSearch = ({filters, updateFilterState, resetFilterState, setNextDisabled, setRedirectBack, classNames}) => {
+ const [value, setValue] = useState("");
+ const [enable, setEnable] = useState(true);
+ const [results, setResults] = useState([]);
+ const [isLoading, setIsLoading] = useState(false);
+
+ useEffect(() => {
+ setResults([]);
+
+ if (enable && value && value.length > 5) {
+ setNextDisabled(true);
+ const timer = setTimeout(() => {
+ setIsLoading(true);
+ LocationRepsostory.getPropertyDetails({search: value}).then(resp => {
+ setResults(resp.data);
+ setIsLoading(false);
+ });
+ }, 500);
+
+ return () => clearTimeout(timer);
+ }
+ }, [value, enable, setNextDisabled]);
+
+ return (
+