11import  {  CheckIcon  }  from  '@heroicons/react/outline' 
2+ import  {  REALTIME_CHANNEL_STATES  }  from  '@supabase/supabase-js' 
23import  Image  from  'next/image' 
34import  Link  from  'next/link' 
45import  {  useRouter  }  from  'next/router' 
5- import  {  Badge ,  IconDiscord ,  IconGitHubSolid ,  IconTwitterX ,  IconYoutubeSolid ,  cn  }  from  'ui' 
6- import  SectionContainer  from  '../Layouts/SectionContainer' 
6+ import  {  useEffect  }  from  'react' 
77
88import  *  as  supabaseLogoWordmarkDark  from  'common/assets/images/supabase-logo-wordmark--dark.png' 
99import  *  as  supabaseLogoWordmarkLight  from  'common/assets/images/supabase-logo-wordmark--light.png' 
1010import  footerData  from  'data/Footer' 
11+ import  {  Badge ,  IconDiscord ,  IconGitHubSolid ,  IconTwitterX ,  IconYoutubeSolid ,  cn  }  from  'ui' 
1112import  {  ThemeToggle  }  from  'ui-patterns/ThemeToggle' 
13+ import  supabase  from  '~/lib/supabase' 
1214import  useDarkLaunchWeeks  from  '../../hooks/useDarkLaunchWeeks' 
15+ import  SectionContainer  from  '../Layouts/SectionContainer' 
1316
1417interface  Props  { 
1518  className ?: string 
@@ -23,6 +26,24 @@ const Footer = (props: Props) => {
2326  const  isGAWeek  =  pathname . includes ( '/ga-week' ) 
2427  const  forceDark  =  isDarkLaunchWeek 
2528
29+   useEffect ( ( )  =>  { 
30+     const  channel  =  supabase . channel ( 'footer' ) 
31+     if  ( channel . state  ===  REALTIME_CHANNEL_STATES . closed )  { 
32+       channel . subscribe ( ( status : string )  =>  { 
33+         if  ( status  ==  'SUBSCRIBED' )  { 
34+           channel . send ( { 
35+             type : 'broadcast' , 
36+             event : 'footer_subscribed' , 
37+             payload : {  ts : Date . now ( )  } , 
38+           } ) 
39+         } 
40+       } ) 
41+     } 
42+     return  ( )  =>  { 
43+       channel . unsubscribe ( ) 
44+     } 
45+   } ,  [ ] ) 
46+ 
2647  if  ( props . hideFooter )  { 
2748    return  null 
2849  } 
0 commit comments