diff --git a/src/components/ButtonHilight.js b/src/components/ButtonHilight.js index 7cfbde7..6bd6348 100644 --- a/src/components/ButtonHilight.js +++ b/src/components/ButtonHilight.js @@ -16,7 +16,11 @@ import connect_white from "../mysy_img/connect_white_v2.png"; import MenuItem from "@material-ui/core/MenuItem"; import Menu from "@material-ui/core/Menu"; import connect_green from "../mysy_img/connect_green.png"; - +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; const ButtonHilight = () => { const history = useHistory(); @@ -43,10 +47,16 @@ const ButtonHilight = () => { const [userconnected, setuserconnected] = useState("0"); const [someoneconnected, setsomeoneconnected] = useState("0"); const [partnerconnected, setpartnerconnected] = useState("0"); - const stored_user = getCookie('tokenmysych'); - const stored_part = getCookie('tokenmysypart'); + var stored_user = getCookie('tokenmysych'); + var stored_part = getCookie('tokenmysypart'); function whosisconnected() { + + stored_user = getCookie('tokenmysych'); + stored_part = getCookie('tokenmysypart'); + + + var local_user_connect = 0; var local_part_connect = 0; @@ -61,7 +71,9 @@ const ButtonHilight = () => { } if (typeof (stored_part) === "undefined" || String(stored_part) === '') { + setpartnerconnected("0"); + setsomeoneconnected("0"); local_part_connect = 0; } else { setpartnerconnected("1"); @@ -72,6 +84,7 @@ const ButtonHilight = () => { } useEffect(() => { + whosisconnected(); @@ -126,7 +139,7 @@ const ButtonHilight = () => { }; - + const handleClose_Account = () => { alert(" my account"); @@ -205,13 +218,16 @@ const ButtonHilight = () => { setpartCookie(acces_right_token_name, "", { path: '/' }); removeCookie(acces_right_token_name, { path: '/' }); } + + setsomeoneconnected('0'); + setDialog_1_open(false); history.push("/recherche-formation"); } function part_logout() { confirmAlert({ title: '', - message: 'Confirmez la deconnexion (pro bb)', + message: 'Confirmez la deconnexion (pro)', buttons: [ { label: 'Oui', @@ -226,7 +242,6 @@ const ButtonHilight = () => { } function handleAccountLogout() { - if (String(userconnected) === String("1")) { user_logout(); } @@ -270,8 +285,55 @@ const ButtonHilight = () => { }; + + const [Dialog_1_message, setDialog_1_message] = React.useState(false); + const [Dialog_1_open, setDialog_1_open] = React.useState(false); + function Dialog_1_handle_change_participant_session(message) { + setDialog_1_message(message); + setDialog_1_open(true); + } + + const Dialog_1_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_1_handleClose_buton = () => { + setDialog_1_open(false); + }; + + return (