Skip to content

Commit

Permalink
fix showing beta popup (#966)
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev authored Aug 1, 2022
1 parent 5980910 commit bad152e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/index/sections/BetaPopUpDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ export default function BetaPopUpDialog() {
const { t } = useTranslation('index')
const [open, setOpen] = useState(false)
const [showAgain, setShowAgain] = useState(true)
useEffect(() => {
if (!showAgain) {
// Only set it if we are switching it off. The other way around is not possible
localStorage.setItem('showBetaPopup', JSON.stringify(showAgain))
}
}, [showAgain])

useEffect(() => {
const initialShowAgain = localStorage.getItem('showBetaPopup')
if (initialShowAgain !== undefined && initialShowAgain !== null) {
const showBetaPopup = JSON.parse(initialShowAgain) as boolean
console.log('betaPopup', showBetaPopup)
showAgainProp = showBetaPopup
}
})

const handleClose = () => {
setOpen(false)
Expand Down

0 comments on commit bad152e

Please sign in to comment.