feat(guide): implement channel guide page with EPG and upcoming slots
feat(layout): add guide link to navigation feat(tv): enable channel navigation via query parameter
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
VideoPlayer,
|
||||
@@ -37,12 +38,19 @@ const BANNER_THRESHOLD = 80; // show "up next" when progress ≥ this %
|
||||
|
||||
export default function TvPage() {
|
||||
const { token } = useAuthContext();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Channel list
|
||||
const { data: channels, isLoading: isLoadingChannels } = useChannels();
|
||||
|
||||
// Channel navigation
|
||||
// Channel navigation — seed from ?channel=<id> query param if present
|
||||
const [channelIdx, setChannelIdx] = useState(0);
|
||||
useEffect(() => {
|
||||
const id = searchParams.get("channel");
|
||||
if (!id || !channels) return;
|
||||
const idx = channels.findIndex((c) => c.id === id);
|
||||
if (idx !== -1) setChannelIdx(idx);
|
||||
}, [channels, searchParams]);
|
||||
const channel = channels?.[channelIdx];
|
||||
|
||||
// Overlay / idle state
|
||||
|
||||
Reference in New Issue
Block a user