all repos — caroster @ 2220be60c782c1c57757bd8a7ebd65e35241cd1d

[Octree] Group carpool to your event https://caroster.io

frontend/containers/WelcomeDialog/index.tsx (view raw)

 1import React from 'react';
 2import {makeStyles} from '@material-ui/core/styles';
 3import Dialog from '@material-ui/core/Dialog';
 4import CardMedia from '@material-ui/core/CardMedia';
 5import DialogActions from '@material-ui/core/DialogActions';
 6import DialogContent from '@material-ui/core/DialogContent';
 7import DialogContentText from '@material-ui/core/DialogContentText';
 8import Typography from '@material-ui/core/Typography';
 9import Button from '@material-ui/core/Button';
10import {useTranslation} from 'react-i18next';
11import useTourStore from '../../stores/useTourStore';
12
13const WelcomeDialog = () => {
14  const {t} = useTranslation();
15  const showWelcome = useTourStore(s => s.showWelcome);
16  const setTour = useTourStore(s => s.setTour);
17  const classes = useStyles();
18
19  const onStartTour = () =>
20    setTour({showWelcome: false, run: true, step: 0, prev: -1});
21
22  const onCancel = () => setTour({showWelcome: false});
23
24  return (
25    <Dialog open={showWelcome} fullWidth maxWidth="xs">
26      <CardMedia
27        className={classes.media}
28        image="/assets/Caroster_Octree_Social.jpg"
29      />
30      <DialogContent>
31        <DialogContentText align="center">
32          <Typography variant="h6">{t('tour.welcome.title')}</Typography>
33          {t('tour.welcome.text')}
34        </DialogContentText>
35      </DialogContent>
36      <DialogActions>
37        <Button onClick={onCancel} id="TourCancel">
38          {t('tour.welcome.nope')}
39        </Button>
40        <Button onClick={onStartTour} id="TourConfirm">
41          {t('tour.welcome.onboard')}
42        </Button>
43      </DialogActions>
44    </Dialog>
45  );
46};
47
48const useStyles = makeStyles({
49  media: {
50    height: 240,
51  },
52});
53
54export default WelcomeDialog;