feat: redirect to PDF when NEXT_PUBLIC_CGU_DOWNLOAD_LINK is set
This commit is contained in:
@@ -2,7 +2,6 @@ import {useRef, useEffect} from 'react'
|
|||||||
import {styled, useTheme} from '@mui/material/styles'
|
import {styled, useTheme} from '@mui/material/styles'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material'
|
import {Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material'
|
||||||
import {useRouter} from 'next/navigation'
|
|
||||||
import useMediaQuery from '@mui/material/useMediaQuery'
|
import useMediaQuery from '@mui/material/useMediaQuery'
|
||||||
import Cgu from '.'
|
import Cgu from '.'
|
||||||
|
|
||||||
@@ -23,17 +22,11 @@ const CGU_DOWNLOAD_LINK = process.env.NEXT_PUBLIC_CGU_DOWNLOAD_LINK
|
|||||||
export default function CGUDialog({open, setOpen}) {
|
export default function CGUDialog({open, setOpen}) {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
const fullScreen = useMediaQuery(theme.breakpoints.down('md'))
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClick = event => {
|
|
||||||
event.preventDefault()
|
|
||||||
router.push(CGU_DOWNLOAD_LINK)
|
|
||||||
}
|
|
||||||
|
|
||||||
const descriptionElementRef = useRef(null)
|
const descriptionElementRef = useRef(null)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) {
|
if (open) {
|
||||||
@@ -64,7 +57,24 @@ export default function CGUDialog({open, setOpen}) {
|
|||||||
id='scroll-dialog-description'
|
id='scroll-dialog-description'
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
|
{CGU_DOWNLOAD_LINK ? (
|
||||||
|
<div style={{textAlign: 'center', padding: '2rem'}}>
|
||||||
|
<Typography paragraph>
|
||||||
|
Consultez nos CGU et notre politique de confidentialité :
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
variant='contained'
|
||||||
|
component='a'
|
||||||
|
href={CGU_DOWNLOAD_LINK}
|
||||||
|
target='_blank'
|
||||||
|
rel='noopener noreferrer'
|
||||||
|
>
|
||||||
|
Consulter les CGU
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<Cgu />
|
<Cgu />
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|||||||
Reference in New Issue
Block a user