Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Trigger auto pupup only on query parameter #203

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/popups/autoPopupDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/views/pages/Course/CoursePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ const useStyles = makeStyles(() => ({
}
}));

function CoursePage({ course }) {
function CoursePage({ course, location }) {
const batch = course.schedule[0];

const classes = useStyles();

return (
<Page className={classes.root} title={course.title}>
<AutoPopup />
<AutoPopup
allowPopup={String(location.search).startsWith('?request=true')}
/>
<Major course={course} />
{/* <CourseFeatures /> */}
<Process />
Expand Down