@@ -12,7 +12,6 @@ export default function LivePage() {
1212 const { isPlaying, closePlayer } = useAudio ( ) ;
1313 const router = useRouter ( ) ;
1414 const [ showAudioConfirm , setShowAudioConfirm ] = React . useState ( false ) ;
15- // Use a ref to track if we've already checked on mount
1615 const hasCheckedAudio = useRef ( false ) ;
1716
1817 useEffect ( ( ) => {
@@ -22,6 +21,34 @@ export default function LivePage() {
2221 }
2322 } , [ isPlaying ] ) ;
2423
24+ // Live Schedule: Active from 3:30 AM to 12:00 AM (Midnight) IST
25+ const [ isLiveActive , setIsLiveActive ] = React . useState ( false ) ;
26+
27+ useEffect ( ( ) => {
28+ const checkSchedule = ( ) => {
29+ // Get current time in India Standard Time
30+ const now = new Date ( ) ;
31+ const istString = now . toLocaleString ( "en-US" , { timeZone : "Asia/Kolkata" } ) ;
32+ const istDate = new Date ( istString ) ;
33+
34+ const hours = istDate . getHours ( ) ;
35+ const minutes = istDate . getMinutes ( ) ;
36+ const timeInMinutes = hours * 60 + minutes ;
37+
38+ const START_TIME = 3 * 60 + 30 ; // 3:30 AM
39+ const END_TIME = 24 * 60 ; // 12:00 AM (Midnight)
40+
41+ const isActive = timeInMinutes >= START_TIME && timeInMinutes < END_TIME ;
42+
43+ // Set active based on schedule only
44+ setIsLiveActive ( isActive ) ;
45+ } ;
46+
47+ checkSchedule ( ) ;
48+ const interval = setInterval ( checkSchedule , 60000 ) ; // Check every minute
49+ return ( ) => clearInterval ( interval ) ;
50+ } , [ ] ) ;
51+
2552 const handleConfirmAudioStop = ( ) => {
2653 closePlayer ( ) ;
2754 setShowAudioConfirm ( false ) ;
@@ -33,7 +60,7 @@ export default function LivePage() {
3360 } ;
3461
3562 return (
36- < div className = "max-w-6xl mx-auto space-y-6 pt-6 px-4" >
63+ < div className = "max-w-6xl mx-auto space-y-6 pt-6 px-4 pb-24 " >
3764
3865 { /* Header */ }
3966 < div className = "flex items-center space-x-4 pb-2 border-b border-gray-100" >
@@ -45,30 +72,61 @@ export default function LivePage() {
4572 < p className = "text-sm text-gray-500 font-serif italic" > "Experience the divine presence"</ p >
4673 </ div >
4774 </ div >
48- { /* Live Banner */ }
49- { liveData . live_status && (
50- < div className = "bg-black rounded-xl overflow-hidden shadow-2xl" >
75+
76+ { /* Featured Live Darshan Block - Always Visible */ }
77+ < div className = "bg-black rounded-xl overflow-hidden shadow-2xl" >
78+ { /* Live Indicator - Only during scheduled hours */ }
79+ { isLiveActive && (
5180 < div className = "bg-red-600 text-white px-4 py-2 flex items-center font-bold text-sm tracking-wider uppercase" >
5281 < span className = "w-2 h-2 bg-white rounded-full mr-2 animate-pulse" />
5382 Live Now
5483 </ div >
55- < div className = "grid lg:grid-cols-3" >
56- < div className = "lg:col-span-2" >
84+ ) }
85+
86+ { ! isLiveActive && (
87+ < div className = "bg-gray-800 text-white px-4 py-2 flex items-center font-bold text-sm tracking-wider uppercase" >
88+ < span className = "w-2 h-2 bg-gray-400 rounded-full mr-2" />
89+ Off Schedule
90+ </ div >
91+ ) }
92+
93+ < div className = "grid lg:grid-cols-3" >
94+ < div className = "lg:col-span-2" >
95+ { isLiveActive ? (
96+ /* Live Video - During scheduled hours */
5797 < VideoPlayer
5898 videoId = { liveData . live_video . youtube_id }
5999 streamUrl = { liveData . live_video . stream_url }
60100 />
61- </ div >
62- < div className = "p-6 text-white space-y-4 flex flex-col justify-center" >
63- < h2 className = "text-2xl font-bold" > { liveData . live_video . title } </ h2 >
64- < p className = "text-gray-300 leading-relaxed text-sm" >
65- { liveData . live_video . description }
66- </ p >
67-
68- </ div >
101+ ) : (
102+ /* Offline Placeholder - Outside scheduled hours */
103+ < div className = "relative w-full pb-[56.25%] bg-gradient-to-br from-ochre/20 via-gray-900 to-black" >
104+ < div className = "absolute inset-0 flex flex-col items-center justify-center text-white p-8" >
105+ < div className = "w-20 h-20 bg-gray-800/50 rounded-full flex items-center justify-center mb-4 backdrop-blur-sm border border-gray-700" >
106+ < Radio className = "w-10 h-10 text-gray-400" />
107+ </ div >
108+ < h3 className = "text-2xl font-bold mb-2" > Live Darshan Offline</ h3 >
109+ < p className = "text-gray-400 text-sm text-center max-w-md mb-4" >
110+ Featured live darshan is available daily from
111+ </ p >
112+ < div className = "text-ochre font-bold text-lg" >
113+ 3:30 AM - 12:00 AM IST
114+ </ div >
115+ < p className = "text-gray-500 text-xs mt-4" >
116+ Check past streams below for recorded content
117+ </ p >
118+ </ div >
119+ </ div >
120+ ) }
121+ </ div >
122+ < div className = "p-6 text-white space-y-4 flex flex-col justify-center" >
123+ < h2 className = "text-2xl font-bold" > { liveData . live_video . title } </ h2 >
124+ < p className = "text-gray-300 leading-relaxed text-sm" >
125+ { liveData . live_video . description }
126+ </ p >
69127 </ div >
70128 </ div >
71- ) }
129+ </ div >
72130
73131 { /* Past Streams Library */ }
74132 < div className = "space-y-6" >
0 commit comments