generated from ocadotechnology/codeforlife-template-backend
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathSessionPopUp.tsx
51 lines (48 loc) · 1.31 KB
/
SessionPopUp.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import {
Stack,
Button,
Dialog,
Typography
} from '@mui/material';
const SessionPopUp: React.FC<{
open: boolean,
setOpen: React.Dispatch<React.SetStateAction<boolean>>,
interval: number
}> = ({ open, setOpen, interval }) => {
const minute = '2';
const second = '00';
const handleClose = (): void => {
setOpen(false);
setTimeout(() => { setOpen(true); }, interval);
};
return (
<>
<Dialog
open={open}
onClose={handleClose}
maxWidth='sm'
>
<Stack alignItems='center' margin={3}>
<Typography variant='h5' textAlign='center'>
Where did you go? 👀
</Typography>
<Typography textAlign='center'>
We noticed that you have been inactive for a while. Are you still there? For your
online safety we will log you out in:
</Typography>
<Typography variant='h5' textAlign='center'>
{minute} min {second} secs
</Typography>
<Typography textAlign='center'>
You may lose progress unless you continue or save.
</Typography>
<Button onClick={handleClose} autoFocus>
Wait, I'm still here!
</Button>
</Stack>
</Dialog>
</>
);
};
export default SessionPopUp;