From abe584b1c1e883fdaffff06b73c403e390e96c25 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 8 Feb 2025 23:45:43 -0800 Subject: [PATCH] Oayout --- nazara/apps/web/app/layout.tsx | 2 +- nazara/apps/web/lib/realtime.tsx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 nazara/apps/web/lib/realtime.tsx diff --git a/nazara/apps/web/app/layout.tsx b/nazara/apps/web/app/layout.tsx index 4f58953..bf98b1a 100644 --- a/nazara/apps/web/app/layout.tsx +++ b/nazara/apps/web/app/layout.tsx @@ -45,7 +45,7 @@ export default function RootLayout({ {!hasEnvVars ? : } -
+
{children}
diff --git a/nazara/apps/web/lib/realtime.tsx b/nazara/apps/web/lib/realtime.tsx new file mode 100644 index 0000000..9d7e6bb --- /dev/null +++ b/nazara/apps/web/lib/realtime.tsx @@ -0,0 +1,14 @@ +'use client'; + +export default function + + useEffect(() => { + const daysChannel = supabase.channel('days') + .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'days' }, (payload) => { + setDay(payload.new); + }).subscribe(); + + return () => { + daysChannel.unsubscribe(); + } + }, [supabase]) \ No newline at end of file