11import React , { useContext , useEffect } from "react" ;
22import { StatusContext } from "../../providers/StatusProvider" ;
3+ import { useNavigate } from "react-router-dom" ;
34
45const Statistics = ( ) => {
56 const { streamStatus, refreshStatus} = useContext ( StatusContext ) ;
7+ const navigate = useNavigate ( ) ;
68
79 useEffect ( ( ) => {
810 refreshStatus ( ) ;
911 } , [ ] ) ;
10-
12+
1113 return (
1214 < div className = "p-6 min-h-screen" >
1315 < h2 className = "text-4xl font-semibold mb-4" > 📊 Statistics</ h2 >
1416
15- { ! streamStatus && (
16- < p className = "text-center text-gray-500 mt-10" > No statistics currently available</ p >
17+ { ! streamStatus || streamStatus ?. length === 0 && (
18+ < p className = "text-center text-gray-500 mt-10 text-3xl " > No statistics currently available</ p >
1719 ) }
1820
1921 < div className = "space-y-6" >
@@ -25,7 +27,8 @@ const Statistics = () => {
2527 Stream Key: { status . streamKey }
2628 </ div >
2729 < button
28- className = "bg-blue-900 hover:bg-blue-800 px-4 py-2 rounded-lg " >
30+ onClick = { ( ) => navigate ( `/${ status . streamKey } ` ) }
31+ className = "bg-blue-500 hover:bg-blue-700 px-4 py-2 rounded-lg text-white" >
2932 Watch stream
3033 </ button >
3134 </ div >
@@ -54,7 +57,7 @@ const Statistics = () => {
5457 { status . whepSessions . map ( ( session , index ) => (
5558 < div
5659 key = { index }
57- className = "bg-green-50 rounded-md p-3 border border-green -100"
60+ className = "rounded-md p-3 border border-indigo -100"
5861 >
5962 < div > < strong > ID:</ strong > { session . id } </ div >
6063 < div > < strong > Layer:</ strong > { session . currentLayer } </ div >
0 commit comments