diff options
author | Anton Tananaev <anton@traccar.org> | 2024-05-09 14:51:39 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-05-09 14:51:39 -0700 |
commit | a47064edf0e27d6c1fd3876d1cfd3a6c0188cf3c (patch) | |
tree | 9c0a753b136d55f178868a959f8f2e1eb768c0fd /src/common/components | |
parent | c4754d0befac1a0bfb85f56419dade8378b98b32 (diff) | |
download | trackermap-web-a47064edf0e27d6c1fd3876d1cfd3a6c0188cf3c.tar.gz trackermap-web-a47064edf0e27d6c1fd3876d1cfd3a6c0188cf3c.tar.bz2 trackermap-web-a47064edf0e27d6c1fd3876d1cfd3a6c0188cf3c.zip |
Terms and privacy policy support (fix #1052)
Diffstat (limited to 'src/common/components')
-rw-r--r-- | src/common/components/TermsDialog.jsx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/components/TermsDialog.jsx b/src/common/components/TermsDialog.jsx new file mode 100644 index 00000000..4b909415 --- /dev/null +++ b/src/common/components/TermsDialog.jsx @@ -0,0 +1,34 @@ +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; |