File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -5,26 +5,16 @@ const JoinCommunityPopup = () => {
55 const [ isOpen , setIsOpen ] = useState ( false ) ;
66
77 useEffect ( ( ) => {
8- // Check if the user has previously closed the popup
9- const hasClosedPopup = localStorage . getItem ( 'communityPopupClosed' ) ;
8+ // Show popup after 5 seconds on every visit
9+ const timer = setTimeout ( ( ) => {
10+ setIsOpen ( true ) ;
11+ } , 5000 ) ;
1012
11- // Show popup after 5 seconds if they haven't closed it before
12- if ( ! hasClosedPopup ) {
13- const timer = setTimeout ( ( ) => {
14- setIsOpen ( true ) ;
15- } , 5000 ) ;
16-
17- return ( ) => clearTimeout ( timer ) ;
18- }
13+ return ( ) => clearTimeout ( timer ) ;
1914 } , [ ] ) ;
2015
2116 const closePopup = ( ) => {
2217 setIsOpen ( false ) ;
23- // Remember that user closed the popup for 7 days
24- localStorage . setItem ( 'communityPopupClosed' , 'true' ) ;
25- setTimeout ( ( ) => {
26- localStorage . removeItem ( 'communityPopupClosed' ) ;
27- } , 7 * 24 * 60 * 60 * 1000 ) ; // 7 days in milliseconds
2818 } ;
2919
3020 const joinDiscord = ( ) => {
You can’t perform that action at this time.
0 commit comments