From 157f9a69d8e76888cea083613306fa34d659a355 Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 24 Dec 2025 18:12:35 -0800 Subject: [PATCH] Add live stream status indicator to landing page and sidebar --- packages/web/src/routes/index.tsx | 64 +++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/packages/web/src/routes/index.tsx b/packages/web/src/routes/index.tsx index 2167a73f..ad8322d0 100644 --- a/packages/web/src/routes/index.tsx +++ b/packages/web/src/routes/index.tsx @@ -1,18 +1,72 @@ -import { useState, type FormEvent } from "react" +import { useState, useEffect, type FormEvent } from "react" import { createFileRoute, Link } from "@tanstack/react-router" import { ShaderBackground } from "@/components/ShaderBackground" import { authClient } from "@/lib/auth-client" import { useAccount } from "jazz-tools/react" import { ViewerAccount, type SavedUrl } from "@/lib/jazz/schema" -import { Link2, Plus, Trash2, ExternalLink, Video, Settings, LogOut } from "lucide-react" +import { JazzProvider } from "@/lib/jazz/provider" +import { Link2, Plus, Trash2, ExternalLink, Video, Settings, LogOut, Radio } from "lucide-react" // Feature flag: only this email can access stream features const STREAM_ENABLED_EMAIL = "nikita@nikiv.dev" +function LiveNowSidebar({ isLive }: { isLive: boolean }) { + if (!isLive) return null + + return ( +
+ +
+
+ + +
+ Live Now +
+
+ nikiv +
+

nikiv

+

Streaming now

+
+
+ +
+ ) +} + function LandingPage() { + const [isLive, setIsLive] = useState(false) + + useEffect(() => { + const checkLiveStatus = async () => { + try { + const response = await fetch("https://nikiv.dev/api/stream-status") + if (response.ok) { + const data = await response.json() + setIsLive(Boolean(data.isLive)) + } + } catch { + // Ignore errors, just don't show live indicator + } + } + + checkLiveStatus() + const interval = setInterval(checkLiveStatus, 30000) // Check every 30s + return () => clearInterval(interval) + }, []) + return (
+ {/* Hero Section */}
@@ -278,7 +332,11 @@ function HomePage() { } if (session?.user) { - return + return ( + + + + ) } return