-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/successNotifications
- Loading branch information
Showing
19 changed files
with
125 additions
and
128 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import {LoadScript} from '@react-google-maps/api'; | ||
import {Grid} from '@mui/material'; | ||
import {FormProvider, UseFormReturn} from 'react-hook-form'; | ||
|
||
import GoogleAutocompleteControl from '../../components/common/form/GoogleAutocompleteControl'; | ||
import Map from '../../components/Map'; | ||
import {IPlan} from '../../pages/Plan/types'; | ||
import {libraries} from './constants'; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
methods: UseFormReturn<IPlan, any>; | ||
}; | ||
|
||
const GoogleMapsLoader: React.FC<Props> = ({children, methods}) => { | ||
const googleMapsApiKey = process.env.REACT_APP_GOOGLE_API_KEY || ''; | ||
|
||
return ( | ||
<LoadScript googleMapsApiKey={googleMapsApiKey} libraries={libraries} loadingElement={<div>Loading...</div>}> | ||
<Grid container height="100%"> | ||
<Grid item xs={6} px={2}> | ||
<FormProvider {...methods}> | ||
<form> | ||
<Grid container> | ||
<Grid item xs={6}> | ||
<GoogleAutocompleteControl name="search" control={methods.control} /> | ||
</Grid> | ||
</Grid> | ||
</form> | ||
</FormProvider> | ||
</Grid> | ||
<Grid item xs={6}> | ||
<Map /> | ||
</Grid> | ||
</Grid> | ||
{children} | ||
</LoadScript> | ||
); | ||
}; | ||
|
||
export default GoogleMapsLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const libraries: ('drawing' | 'geometry' | 'places' | 'localContext' | 'visualization')[] = [ | ||
'drawing', | ||
'geometry', | ||
'places', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import GoogleMapsLoader from './GoogleMapsLoader'; | ||
|
||
export default GoogleMapsLoader; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
import React from 'react'; | ||
import {useForm, FormProvider} from 'react-hook-form'; | ||
import {useForm} from 'react-hook-form'; | ||
import {yupResolver} from '@hookform/resolvers/yup'; | ||
import {Grid} from '@mui/material'; | ||
|
||
import {IPlan} from './types'; | ||
import {defaultValues, validation} from './form'; | ||
import GoogleAutocompleteControl from '../../components/common/form/GoogleAutocompleteControl'; | ||
import GoogleMapsLoader from '../../layouts/GoogleMapsLoader'; | ||
|
||
const Plan = () => { | ||
const methods = useForm<IPlan>({ | ||
resolver: yupResolver(validation), | ||
defaultValues, | ||
}); | ||
const {control} = methods; | ||
|
||
return ( | ||
<FormProvider {...methods}> | ||
<form> | ||
<Grid container> | ||
<Grid item xs={6}> | ||
<GoogleAutocompleteControl name="search" control={control} /> | ||
</Grid> | ||
</Grid> | ||
</form> | ||
</FormProvider> | ||
); | ||
return <GoogleMapsLoader methods={methods} />; | ||
}; | ||
|
||
export default Plan; |
Oops, something went wrong.