import { getDracinStream, getDracinDetail } from '@/lib/dramabox'; import Link from 'next/link'; import { Button } from '@/components/ui/button'; import { List, ArrowRight, ArrowLeft } from 'lucide-react'; import { createClient } from '@/lib/supabase/server'; import { redirect } from 'next/navigation'; import VideoPlayer from '@/components/VideoPlayer'; import { DracinPlayer } from '@/components/DracinPlayer'; interface DracinWatchPageProps { params: Promise<{ id: string; episode: string }>; } export default async function DracinWatchPage({ params }: DracinWatchPageProps) { const { id, episode } = await params; const episodeNum = parseInt(episode); // Auth Check const supabase = await createClient(); const { data: { user } } = await supabase.auth.getUser(); if (!user) { redirect('/login'); } // Fetch stream URL const streamUrl = await getDracinStream(id, episodeNum); // Fetch detail for title and navigation context const { drama } = await getDracinDetail(id); if (!streamUrl) { return (

Error

Could not load stream for Episode {episode}. It might be a premium/VIP episode or API error.

); } return (
{/* Player Container */}
{/* Info & Navigation */}

{drama?.name || 'Unknown Drama'} - Episode {episodeNum + 1}

{/* Left: Previous */}
{episodeNum > 0 ? ( ) : (
)}
{/* Center: Back */}
{/* Right: Next */}
); }