- < MicrosoftSignIn />
+
diff --git a/src/components/auth/apple/SignIn.tsx b/src/components/auth/apple/SignIn.tsx
index 6b99634..ece1b7f 100644
--- a/src/components/auth/apple/SignIn.tsx
+++ b/src/components/auth/apple/SignIn.tsx
@@ -11,12 +11,11 @@ const AppleSignIn = () => {
-
- Sign in with Apple
-
+
Sign in with Apple
);
};
diff --git a/src/components/auth/microsoft/SignIn.tsx b/src/components/auth/microsoft/SignIn.tsx
index 00a3a9d..868b5c6 100644
--- a/src/components/auth/microsoft/SignIn.tsx
+++ b/src/components/auth/microsoft/SignIn.tsx
@@ -11,7 +11,8 @@ const MicrosoftSignIn = () => {
Sign in with Microsoft
diff --git a/src/components/context/TVMode.tsx b/src/components/context/TVMode.tsx
index c6b2e2b..70c327b 100644
--- a/src/components/context/TVMode.tsx
+++ b/src/components/context/TVMode.tsx
@@ -1,8 +1,9 @@
'use client';
-import React, { createContext, useContext, useState } from 'react';
+import React, { createContext, useContext, useState, useEffect } from 'react';
import Image from 'next/image';
import type { ReactNode } from 'react';
-//import { useSession } from 'next-auth/react';
+import type { Session } from '@supabase/supabase-js';
+import { createClient } from '@/utils/supabase/client';
interface TVModeContextProps {
tvMode: boolean;
@@ -35,8 +36,45 @@ export const useTVMode = () => {
export const TVToggle = () => {
const { tvMode, toggleTVMode } = useTVMode();
- //const { data: session } = useSession();
- //if (!session) return
;
+ const supabase = createClient();
+ const [session, setSession] = useState
(null);
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ // Function to fetch the session
+ async function fetchSession() {
+ try {
+ const {
+ data: { session },
+ } = await supabase.auth.getSession();
+ setSession(session);
+ } catch (error) {
+ console.error('Error fetching session:', error);
+ } finally {
+ setLoading(false);
+ }
+ }
+
+ // Call the function
+ fetchSession().catch((error) => {
+ console.error('Error fetching session:', error);
+ });
+
+ // Set up auth state change listener
+ const {
+ data: { subscription },
+ } = supabase.auth.onAuthStateChange((_event, session) => {
+ setSession(session);
+ });
+
+ // Clean up the subscription when component unmounts
+ return () => {
+ subscription.unsubscribe();
+ };
+ }, [supabase]);
+
+ if (loading || !session) return ;
+
return (