"use client"; import Link from "next/link"; import { LivePulse } from "@/components/ui"; import { useYouTubeLiveMap } from "@/lib/youtubeLive"; /** Home ticker: all live YouTube groups + Shorts channels from live-map. */ export function YouTubeLiveTicker() { const { map } = useYouTubeLiveMap(); const entries = map?.entries || {}; const live = Object.entries(entries).filter( ([k, v]) => (k.startsWith("group:") || k.startsWith("shorts:")) && v?.is_live, ); if (!live.length) return null; const items = live.map(([key, v]) => ({ key, title: v.title || key.replace(/^(group|shorts):/, ""), url: v.live_url || "#", source: v.source, })); return (
分组 →
{[...items, ...items].map((item, idx) => ( {item.title} {item.source ? {item.source} : null} ))}
); }