fix: viewercount to show actual count

This commit is contained in:
2025-03-18 19:24:59 +01:00
parent 9538d23ed1
commit 5e1609abc2

View File

@@ -1,12 +1,14 @@
import { useStreams } from "@/lib/providers/StreamInfoProvider";
import { User } from "lucide-react";
import { useParams } from "next/navigation";
export default function ViewerCount() {
const streamInfo = useStreams();
const { username } = useParams();
if (streamInfo.isLoading) return null;
const viewerCount = streamInfo.stream!.reduce((acc, stream) => acc + stream.viewers, 0);
const viewerCount = streamInfo.stream!.find(s => s.username === username)?.viewers;
return (
<div className="flex items-center space-x-2 *:text-destructive">