diff --git a/src/components/app/UserInfoCard/viewerCount.tsx b/src/components/app/UserInfoCard/viewerCount.tsx index f00361b..32b0c29 100644 --- a/src/components/app/UserInfoCard/viewerCount.tsx +++ b/src/components/app/UserInfoCard/viewerCount.tsx @@ -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 (