-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f5c5b0
commit c699ad5
Showing
8 changed files
with
205 additions
and
47 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
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
85 changes: 85 additions & 0 deletions
85
zubhub_frontend/zubhub/src/components/sessionExpired/sessionExpired.Style.js
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,85 @@ | ||
export const sessionExpiredStyle = theme => ({ | ||
card: { | ||
borderRadius: 12, | ||
position: 'fixed', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
boxShadow: theme.shadows[5], | ||
overflow: 'hidden', | ||
width: '90%', | ||
zIndex: 1300, | ||
[theme.breakpoints.up('sm')]: { | ||
width: 500, | ||
}, | ||
}, | ||
cardHeader: { | ||
backgroundColor: theme.palette.primary.main, | ||
color: theme.palette.common.white, | ||
padding: theme.spacing(1), | ||
[theme.breakpoints.up('sm')]: { | ||
padding: theme.spacing(1, 2), | ||
}, | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}, | ||
cardContent: { | ||
padding: theme.spacing(1), | ||
[theme.breakpoints.up('sm')]: { | ||
padding: theme.spacing(2), | ||
}, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
}, | ||
closeButton: { | ||
cursor: 'pointer', | ||
color: theme.palette.common.white, | ||
}, | ||
iconWrapper: { | ||
marginBottom: theme.spacing(2), | ||
display: 'flex', | ||
justifyContent: 'center', | ||
}, | ||
centerText: { | ||
textAlign: 'center', | ||
marginBottom: theme.spacing(1), | ||
}, | ||
modal: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: '100vw', | ||
height: '100vh', | ||
backgroundColor: theme.palette.background.paper, | ||
backdropFilter: 'blur(5px)', | ||
}, | ||
textDecorationNone: { | ||
width: '100%', | ||
marginTop: theme.spacing(2), | ||
}, | ||
customButtonStyle: { | ||
backgroundColor: theme.palette.primary.main, | ||
color: theme.palette.common.white, | ||
'&:hover': { | ||
backgroundColor: theme.palette.primary.main, | ||
}, | ||
}, | ||
buttonContainer: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
marginTop: theme.spacing(2), | ||
}, | ||
errorIcon: { | ||
fontSize: 60, | ||
color: 'var(--primary-color1)', | ||
}, | ||
titleStyle: { | ||
fontSize: '1.2rem', | ||
[theme.breakpoints.up('sm')]: { | ||
fontSize: '1.5rem', | ||
}, | ||
fontWeight: 600, | ||
}, | ||
}); |
70 changes: 70 additions & 0 deletions
70
zubhub_frontend/zubhub/src/components/sessionExpired/sessionExpired.jsx
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,70 @@ | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import clsx from 'clsx'; | ||
import { Card, CardContent, Typography, ErrorOutline } from '@material-ui/core'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import { useHistory, Link } from 'react-router-dom'; | ||
import { sessionExpiredStyle } from './sessionExpired.Style'; | ||
import Modal from '../modals/Modal'; | ||
import CustomButton from '../button/Button'; | ||
import CloseIcon from '@material-ui/icons/Close'; | ||
import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'; | ||
|
||
const useStyles = makeStyles(sessionExpiredStyle); | ||
|
||
const SessionExpiredModal = () => { | ||
const classes = useStyles(); | ||
const [modalOpen, setModalOpen] = useState(true); | ||
const history = useHistory(); | ||
|
||
const handleClose = () => { | ||
setModalOpen(false); | ||
history.push('/login'); | ||
}; | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Modal open={modalOpen}> | ||
<Card className={classes.card}> | ||
<div className={classes.cardHeader}> | ||
<Typography variant="h6">{t(`sessionExpired.heading`)}</Typography> | ||
<Typography variant="button" className={classes.closeButton} onClick={handleClose}> | ||
<CloseIcon /> | ||
</Typography> | ||
</div> | ||
<CardContent className={classes.cardContent}> | ||
<div className={classes.iconWrapper}> | ||
<ErrorOutlineIcon className={clsx(classes.icon, classes.errorIcon)} /> | ||
</div> | ||
<Typography | ||
variant="body1" | ||
color="textPrimary" | ||
className={clsx(classes.centerText, classes.titleStyle)} | ||
> | ||
{t(`sessionExpired.title`)} | ||
</Typography> | ||
<Typography | ||
variant="body2" | ||
className={classes.centerText} | ||
> | ||
{t(`sessionExpired.text`)} | ||
</Typography> | ||
<div className={classes.buttonContainer}> | ||
<Link to="/login" className={classes.textDecorationNone}> | ||
<CustomButton | ||
variant="outlined" | ||
size="small" | ||
primaryButtonStyle | ||
customButtonStyle | ||
> | ||
{t(`sessionExpired.buttonLabel`)} | ||
</CustomButton> | ||
</Link> | ||
</div> | ||
</CardContent> | ||
</Card> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default SessionExpiredModal; |
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