feat(channel): add logo support with position and opacity settings
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
ChannelPasswordModal,
|
||||
} from "./components";
|
||||
import type { SubtitleTrack } from "./components/video-player";
|
||||
import type { LogoPosition } from "@/lib/types";
|
||||
import { Maximize2, Minimize2, Volume1, Volume2, VolumeX } from "lucide-react";
|
||||
import { useAuthContext } from "@/context/auth-context";
|
||||
import { useChannels, useCurrentBroadcast, useEpg } from "@/hooks/use-channels";
|
||||
@@ -33,6 +34,15 @@ import {
|
||||
const IDLE_TIMEOUT_MS = 3500;
|
||||
const BANNER_THRESHOLD = 80; // show "up next" when progress ≥ this %
|
||||
|
||||
function logoPositionClass(pos?: LogoPosition) {
|
||||
switch (pos) {
|
||||
case "top_left": return "top-0 left-0";
|
||||
case "bottom_left": return "bottom-0 left-0";
|
||||
case "bottom_right":return "bottom-0 right-0";
|
||||
default: return "top-0 right-0";
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Page
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -499,6 +509,21 @@ function TvPageContent() {
|
||||
{/* ── Base layer ─────────────────────────────────────────────── */}
|
||||
<div className="absolute inset-0">{renderBase()}</div>
|
||||
|
||||
{/* ── Logo watermark — always visible, not tied to idle state ── */}
|
||||
{channel?.logo && (
|
||||
<div
|
||||
className={`pointer-events-none absolute z-10 p-3 ${logoPositionClass(channel.logo_position)}`}
|
||||
style={{ opacity: channel.logo_opacity ?? 1 }}
|
||||
>
|
||||
{channel.logo.trimStart().startsWith("<") ? (
|
||||
<div dangerouslySetInnerHTML={{ __html: channel.logo }} className="h-12 w-auto" />
|
||||
) : (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={channel.logo} alt="" className="h-12 w-auto object-contain" />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Channel password modal ──────────────────────────────────── */}
|
||||
{showChannelPasswordModal && (
|
||||
<ChannelPasswordModal
|
||||
|
||||
Reference in New Issue
Block a user