Skip to content
Snippets Groups Projects
Commit dc07e177 authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira Committed by Stephanie Briere Americo
Browse files

Issue #42: Detection on user leaving

parent bbb819d5
No related branches found
No related tags found
2 merge requests!58Version 1.1,!54Issue #53: Fix password info
...@@ -17,39 +17,39 @@ import { FormEditionContext } from "../../contexts/FormContext"; ...@@ -17,39 +17,39 @@ import { FormEditionContext } from "../../contexts/FormContext";
import useForm from "../../contexts/useForm"; import useForm from "../../contexts/useForm";
import SubmitButton from "./SubmitButton"; import SubmitButton from "./SubmitButton";
/** CSS styles used on page components */ /** CSS styles used on page components */
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles(theme => ({
app: { app: {
margin: "0", margin: "0",
padding: "40px", padding: "40px",
display: "flex", display: "flex",
["@media (max-width: 600px)"]: { ["@media (max-width: 600px)"]: {
flexDirection: "column-reverse", flexDirection: "column-reverse",
justifyContent: "flex-end", justifyContent: "flex-end"
}, },
paddingBottom: "78px", paddingBottom: "78px",
["@media (min-width: 600px)"]: { ["@media (min-width: 600px)"]: {
minHeight: "calc(100vh - 92.4px - 78px -60px)", minHeight: "calc(100vh - 92.4px - 78px -60px)"
}, },
minHeight: "calc(100vh - 71.6px - 78px -60px)", minHeight: "calc(100vh - 71.6px - 78px -60px)",
marginBottom: "60px", marginBottom: "60px"
}, },
addButton: { addButton: {
fontSize: "100%", fontSize: "100%"
}, },
sideMenuFormatingGrid: { sideMenuFormatingGrid: {
["@media (max-width:600px)"]: { ["@media (max-width:600px)"]: {
marginTop: "-90px", marginTop: "-90px"
}, }
}, },
sizeFormating: { sizeFormating: {
["@media (max-width:600px)"]: { ["@media (max-width:600px)"]: {
["@media (max-width:430px)"]: { ["@media (max-width:430px)"]: {
marginLeft: "1%", marginLeft: "1%",
width: "95%", width: "95%"
}, },
marginLeft: "2%", marginLeft: "2%"
}, }
}, }
})); }));
/** CSS style used through Material Ui. */ /** CSS style used through Material Ui. */
const theme = createMuiTheme({ const theme = createMuiTheme({
...@@ -57,19 +57,19 @@ const theme = createMuiTheme({ ...@@ -57,19 +57,19 @@ const theme = createMuiTheme({
MuiInput: { MuiInput: {
underline: { underline: {
"&:before": { "&:before": {
borderBottom: "1px solid #35c7fc", borderBottom: "1px solid #35c7fc"
}, },
"&:after": { "&:after": {
borderBottom: "1px solid #3f51b5", borderBottom: "1px solid #3f51b5"
}, }
}, }
}, },
MuiButton: { MuiButton: {
label: { label: {
color: "white", color: "white"
}, }
}, }
}, }
}); });
/** Main function that returns the children that composes the form creation or edition page. */ /** Main function that returns the children that composes the form creation or edition page. */
function DisplayForm() { function DisplayForm() {
...@@ -90,6 +90,10 @@ function DisplayForm() { ...@@ -90,6 +90,10 @@ function DisplayForm() {
*/ */
useEffect(() => { useEffect(() => {
setValidToSend(verifyError(form)); setValidToSend(verifyError(form));
window.onbeforeunload = confirmExit;
function confirmExit() {
return "show warning";
}
}, [form]); }, [form]);
return ( return (
<MuiThemeProvider theme={theme}> <MuiThemeProvider theme={theme}>
......
...@@ -222,6 +222,10 @@ function AnwserForm() { ...@@ -222,6 +222,10 @@ function AnwserForm() {
/** First thing the page does is getting the form from the API. */ /** First thing the page does is getting the form from the API. */
useEffect(() => { useEffect(() => {
getForm(id); getForm(id);
window.onbeforeunload = confirmExit;
function confirmExit() {
return "show warning";
}
}, []); }, []);
return ( return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment