app/src/containers/AddToMyEventDialog/AddToMyEventDialog.js (view raw)
1import React from 'react';
2import Dialog from '@material-ui/core/Dialog';
3import DialogActions from '@material-ui/core/DialogActions';
4import DialogContent from '@material-ui/core/DialogContent';
5import DialogContentText from '@material-ui/core/DialogContentText';
6import DialogTitle from '@material-ui/core/DialogTitle';
7import Slide from '@material-ui/core/Slide';
8import Button from '@material-ui/core/Button';
9import {useTranslation} from 'react-i18next';
10import {useHistory} from 'react-router-dom';
11const Transition = React.forwardRef(function Transition(props, ref) {
12 return <Slide direction="up" ref={ref} {...props} />;
13});
14
15const AddToMyEventDialog = ({event, open, onClose}) => {
16 const {t} = useTranslation();
17 const history = useHistory();
18 return (
19 <Dialog open={open} TransitionComponent={Transition} onClose={onClose}>
20 <DialogContent>
21 <DialogTitle>
22 {t('event.add_to_my_events.title', {eventName: event.name})}
23 </DialogTitle>
24 <DialogContentText
25 dangerouslySetInnerHTML={{
26 __html: t('event.add_to_my_events.text_html', {
27 eventName: event.name,
28 }),
29 }}
30 />
31 </DialogContent>
32 <DialogActions>
33 <Button onClick={onClose} id="AddToMyEventCancel">
34 {t('event.add_to_my_events.cancel')}
35 </Button>
36 <Button
37 id="AddToMyEventLogin"
38 onClick={() => {
39 history.push({
40 pathName: '/login',
41 state: {event: event.id},
42 });
43 }}
44 >
45 {t('event.add_to_my_events.login')}
46 </Button>
47 <Button
48 id="AddToMyEventRegister"
49 onClick={() => {
50 history.push({
51 pathName: '/register',
52 state: {event: event.id},
53 });
54 }}
55 color="primary"
56 >
57 {t('event.add_to_my_events.register')}
58 </Button>
59 </DialogActions>
60 </Dialog>
61 );
62};
63
64export default AddToMyEventDialog;