Skip to content

Commit b49a041

Browse files
committed
Active darshan time
1 parent 56f40f2 commit b49a041

4 files changed

Lines changed: 106 additions & 45 deletions

File tree

web/src/app/(main)/ask/page.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import { useState, useEffect, useRef } from 'react';
4-
import { MessageCircleQuestion, Send, ChevronDown, ChevronUp, Loader2, CheckCircle2, Archive, Lock } from 'lucide-react';
4+
import { MessageCircleQuestion, Send, ChevronDown, ChevronUp, Loader2, CheckCircle2, Archive } from 'lucide-react';
55
import { useUser, SignInButton } from '@clerk/nextjs';
66
import { getTickets, createTicket, closeTicket, userReplyToTicket } from '@/actions/tickets';
77
import { useInquiry } from '@/context/InquiryContext';
@@ -103,11 +103,6 @@ export default function AskPage() {
103103
const handleSubmit = async (e: React.FormEvent) => {
104104
e.preventDefault();
105105

106-
if (role === 'guest') {
107-
setNotification({ message: "Guests cannot submit new inquiries. Please contact support.", type: 'error' });
108-
return;
109-
}
110-
111106
setIsSubmitting(true);
112107
try {
113108
const result = await createTicket(newTicketSubject, newTicketMessage);
@@ -129,11 +124,6 @@ export default function AskPage() {
129124
};
130125

131126
const handleFollowUp = async (ticketId: string) => {
132-
if (role === 'guest') {
133-
setNotification({ message: "Guests cannot reply to inquiries.", type: 'error' });
134-
return;
135-
}
136-
137127
const text = followUpText[ticketId];
138128
if (!text?.trim()) return;
139129

@@ -208,22 +198,9 @@ export default function AskPage() {
208198
</button>
209199
</SignInButton>
210200
<p className="text-[10px] text-gray-400 font-bold uppercase tracking-widest">
211-
* This is a secure & private channel.
201+
* This is a secure &amp; private channel.
212202
</p>
213203
</div>
214-
) : role === 'guest' ? (
215-
/* GUEST ROLE VIEW - SIGNED IN BUT RESTRICTED */
216-
<div className="flex flex-col items-center justify-center min-h-[60vh] text-center space-y-6 max-w-lg mx-auto w-full px-4 animate-in fade-in duration-700">
217-
<div className="w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center text-gray-400 mb-2 border border-gray-200">
218-
<Lock className="w-10 h-10" />
219-
</div>
220-
<div className="space-y-2">
221-
<h1 className="text-3xl font-black text-gray-900 tracking-tight">Guest Access</h1>
222-
<p className="text-gray-500 text-base leading-relaxed font-medium">
223-
You are currently logged in as a Guest. Guest accounts cannot submit new spiritual inquiries.
224-
</p>
225-
</div>
226-
</div>
227204
) : (
228205
/* VERIFIED USER VIEW */
229206
<>

web/src/app/(main)/live/page.tsx

Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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">

web/src/components/features/VideoPlayer.tsx

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,53 @@ export default function VideoPlayer({ videoId, streamUrl, poster }: VideoPlayerP
3939

4040
if (streamUrl) {
4141
return (
42-
<div className="relative w-full pb-[56.25%] overflow-hidden rounded-lg shadow-lg bg-black">
42+
<div
43+
className="relative w-full pb-[56.25%] overflow-hidden rounded-lg shadow-lg bg-black z-10"
44+
style={{
45+
touchAction: 'manipulation',
46+
WebkitTransform: 'translateZ(0)',
47+
transform: 'translateZ(0)',
48+
isolation: 'isolate'
49+
}}
50+
>
4351
<video
4452
ref={videoRef}
4553
className="absolute top-0 left-0 w-full h-full object-contain"
4654
controls
4755
poster={poster}
4856
playsInline
57+
style={{
58+
touchAction: 'manipulation',
59+
WebkitTransform: 'translateZ(0)',
60+
transform: 'translateZ(0)'
61+
}}
4962
/>
5063
</div>
5164
);
5265
}
5366

5467
if (videoId) {
5568
return (
56-
<div className="relative w-full pb-[56.25%] overflow-hidden rounded-lg shadow-lg bg-black">
69+
<div
70+
className="relative w-full pb-[56.25%] overflow-hidden rounded-lg shadow-lg bg-black z-10"
71+
style={{
72+
touchAction: 'manipulation',
73+
WebkitTransform: 'translateZ(0)',
74+
transform: 'translateZ(0)',
75+
isolation: 'isolate'
76+
}}
77+
>
5778
<iframe
58-
className="absolute top-0 left-0 w-full h-full"
79+
className="absolute top-0 left-0 w-full h-full pointer-events-none"
5980
src={`https://www.youtube.com/embed/${videoId}`}
6081
title="YouTube video player"
6182
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
6283
allowFullScreen
84+
style={{
85+
touchAction: 'manipulation',
86+
WebkitTransform: 'translateZ(0)',
87+
transform: 'translateZ(0)'
88+
}}
6389
/>
6490
</div>
6591
);

web/src/data/live_videos.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"live_status": true,
2+
"live_status": false,
33
"live_video": {
44
"id": "live-1",
55
"title": "Live Darshan from Shirdi",

0 commit comments

Comments
 (0)