-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from InseeFrLab/develop
Develop
- Loading branch information
Showing
85 changed files
with
17,790 additions
and
15,306 deletions.
There are no files selected for viewing
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,3 +1,4 @@ | ||
REACT_APP_LOCAL= | ||
REACT_APP_PEARL_API_URL= | ||
REACT_APP_GOOGLE_API_KEY= | ||
REACT_APP_GOOGLE_API_KEY= | ||
REACT_APP_STROMAE_API_URL= |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const getDataFromAPI = () => Promise.resolve([]); | ||
export const getDataFromAPI = ({ setError, setData = () => {}, setLoading }) => | ||
Promise.resolve([setLoading(false)]); | ||
|
||
export const getLatLng = (address, setError) => Promise.resolve([]); | ||
export const postData = () => Promise.resolve(true); |
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,18 +1,34 @@ | ||
import { SURVEY_UNITS, UNITS } from './paths'; | ||
import { SURVEY_UNITS, UNITS, PARADATA } from './paths'; | ||
|
||
const get = (url) => | ||
fetch(url) | ||
const fetcher = (url, method, body) => { | ||
const headers = { | ||
Accept: 'application/json, text/plain, */*', | ||
'Content-Type': 'application/json', | ||
}; | ||
return fetch(url, { | ||
headers: headers, | ||
method, | ||
body: body ? JSON.stringify(body) : null, | ||
}) | ||
.then((r) => { | ||
console.log(r); | ||
if (r.ok) return r.json(); | ||
throw new Error('API failed'); | ||
}) | ||
.catch(() => { | ||
.catch((e) => { | ||
console.log(e); | ||
throw new Error(`Fetch error for ${url}`); | ||
}); | ||
}; | ||
|
||
export const getSurveyUnitsAPI = () => get(SURVEY_UNITS); | ||
const postRequest = (url) => (body) => fetcher(url, 'POST', body); | ||
const getRequest = (url) => fetcher(url, 'GET', null); | ||
|
||
export const getSurveyUnitsAPI = () => getRequest(SURVEY_UNITS); | ||
|
||
export const getSurveyUnitsExtended = () => | ||
get(`${SURVEY_UNITS}?extended=true`); | ||
getRequest(`${SURVEY_UNITS}?extended=true`); | ||
|
||
export const getUnit = (id) => getRequest(`${UNITS}/${id}`); | ||
|
||
export const getUnit = (id) => get(`${UNITS}/${id}`); | ||
export const postParadata = (body) => postRequest(PARADATA)(body); |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { getEnvVar } from 'utils/env'; | ||
|
||
const BASE_URL = getEnvVar('PEARL_API_URL'); | ||
|
||
const STROMAE_URL = getEnvVar('STROMAE_API_URL') | ||
export const SURVEY_UNITS = `${BASE_URL}/api/survey-units`; | ||
export const UNITS = `${BASE_URL}/api/survey-unit`; | ||
|
||
export const PARADATA = `${STROMAE_URL}/api/paradata`; |
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
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,44 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import LinearProgress from '@material-ui/core/LinearProgress'; | ||
import logoMapex from './logoMapex.svg'; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
textAlign: 'center', | ||
}, | ||
colorPrimary: { | ||
backgroundColor: '#FF780A', | ||
}, | ||
barColorPrimary: { | ||
backgroundColor: '#B2DFDB', | ||
}, | ||
imgBlock: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
img: { | ||
maxWidth: '500px', | ||
display: 'block', | ||
}, | ||
})); | ||
|
||
const Loader = () => { | ||
const classes = useStyles(); | ||
return ( | ||
<div className={classes.root}> | ||
<LinearProgress | ||
classes={{ | ||
colorPrimary: classes.colorPrimary, | ||
barColorPrimary: classes.barColorPrimary, | ||
}} | ||
/> | ||
<div className={classes.imgBlock}> | ||
<img src={logoMapex} className={classes.img} alt="logo" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Loader; |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import Dialog from '@material-ui/core/Dialog'; | ||
import DialogActions from '@material-ui/core/DialogActions'; | ||
import DialogContent from '@material-ui/core/DialogContent'; | ||
import DialogContentText from '@material-ui/core/DialogContentText'; | ||
import DialogTitle from '@material-ui/core/DialogTitle'; | ||
|
||
const ModalReperage = ({ open, setOpen, handleSend }) => { | ||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Dialog | ||
open={open} | ||
onClose={handleClose} | ||
aria-labelledby="alert-dialog-title" | ||
aria-describedby="alert-dialog-description" | ||
> | ||
<DialogTitle id="alert-dialog-title">{'Validation'}</DialogTitle> | ||
<DialogContent> | ||
<DialogContentText id="alert-dialog-description"> | ||
Êtes vous sûr de vouloir envoyer vos réponses aux questions ? | ||
</DialogContentText> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={handleSend}>Oui</Button> | ||
<Button onClick={handleClose} autoFocus> | ||
Non | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ModalReperage; |
File renamed without changes.
Oops, something went wrong.