From da570abfbece08debfbae1a8b8ecab79b9ea4b18 Mon Sep 17 00:00:00 2001 From: Abhishek-kumar09 Date: Thu, 28 Jan 2021 23:30:27 +0530 Subject: [PATCH] Trigger auto pupup only on query parameter --- src/components/popups/autoPopupDialog.js | 10 +++++++--- src/views/pages/Course/CoursePage/index.js | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/popups/autoPopupDialog.js b/src/components/popups/autoPopupDialog.js index ad7bea84..6af9e414 100644 --- a/src/components/popups/autoPopupDialog.js +++ b/src/components/popups/autoPopupDialog.js @@ -39,7 +39,11 @@ const useStyles = makeStyles(theme => ({ } })); -export default function AutoPopupDialog({ fullWidth = true, ...rest }) { +export default function AutoPopupDialog({ + allowPopup, + fullWidth = true, + ...rest +}) { const classes = useStyles(); const [open, setOpen] = useState(false); @@ -50,9 +54,9 @@ export default function AutoPopupDialog({ fullWidth = true, ...rest }) { useEffect(() => { setTimeout(() => { - setOpen(true); + if (allowPopup) setOpen(true); }, 15000); - }, []); + }, []); // eslint-disable-line react-hooks/exhaustive-deps const handleClose = () => { setOpen(false); diff --git a/src/views/pages/Course/CoursePage/index.js b/src/views/pages/Course/CoursePage/index.js index d314b5fc..baf550ce 100755 --- a/src/views/pages/Course/CoursePage/index.js +++ b/src/views/pages/Course/CoursePage/index.js @@ -19,14 +19,16 @@ const useStyles = makeStyles(() => ({ } })); -function CoursePage({ course }) { +function CoursePage({ course, location }) { const batch = course.schedule[0]; const classes = useStyles(); return ( - + {/* */}