aboutsummaryrefslogtreecommitdiff
path: root/src/common/components/TermsDialog.jsx
blob: 2ac74f2ebbcfdb26fbd145ad4d91ad9a88615024 (plain)
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
import React from 'react';
import { useSelector } from 'react-redux';
import {
  Button, Dialog, DialogActions, DialogContent, DialogContentText, Link,
} from '@mui/material';
import { useTranslation } from './LocalizationProvider';

const TermsDialog = ({ open, onCancel, onAccept }) => {
  const t = useTranslation();

  const termsUrl = useSelector((state) => state.session.server.attributes.termsUrl);
  const privacyUrl = useSelector((state) => state.session.server.attributes.privacyUrl);

  return (
    <Dialog
      open={open}
      onClose={onCancel}
    >
      <DialogContent>
        <DialogContentText>
          {t('userTermsPrompt')}
          <ul>
            <li><Link href={termsUrl} target="_blank">{t('userTerms')}</Link></li>
            <li><Link href={privacyUrl} target="_blank">{t('userPrivacy')}</Link></li>
          </ul>
        </DialogContentText>
      </DialogContent>
      <DialogActions>
        <Button onClick={onCancel}>{t('sharedCancel')}</Button>
        <Button onClick={onAccept}>{t('sharedAccept')}</Button>
      </DialogActions>
    </Dialog>
  );
};

export default TermsDialog;