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:
2026-03-12 03:29:52 +01:00
parent e5a9b99b14
commit 9559858075
3 changed files with 205 additions and 1 deletions

View File

@@ -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