Skip to content

Commit

Permalink
disable behaviour to not show modal after first appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
dabby9734 authored and wei2912 committed Apr 30, 2024
1 parent c5ba66f commit a32f77d
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions components/PersonalisationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const modalHeaderStyle = {
const modalTextStyle = {};

const PersonalisationModal = ({ industries, clearFilters, addFilter }) => {
const [open, setOpen] = useState<boolean>(false);
const [open, setOpen] = useState<boolean>(true);

// handles toggling of the selected industries
const [selectedIndustries, setSelectedIndustries] = useState<string[]>([]);
Expand All @@ -45,16 +45,8 @@ const PersonalisationModal = ({ industries, clearFilters, addFilter }) => {
addFilter("industries", industry, "any");
});
setOpen(false);
localStorage.setItem("ModalClosed", "true");
};

// only open the modal if the user hasn't closed it before
useEffect(() => {
if (localStorage.getItem("ModalClosed") === null) {
setOpen(true);
}
});

return (
<Modal open={open} onClose={() => setOpen(false)}>
<Box sx={modalStyle}>
Expand Down

0 comments on commit a32f77d

Please sign in to comment.