From eda21437de04ceaa095589ff13fa5473703468dd Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Fri, 11 Apr 2025 10:02:50 -0500 Subject: [PATCH] Modified spacing for channel number and logo inside logo box. --- frontend/src/pages/Guide.jsx | 87 +++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/frontend/src/pages/Guide.jsx b/frontend/src/pages/Guide.jsx index be66da6f..b34c9e97 100644 --- a/frontend/src/pages/Guide.jsx +++ b/frontend/src/pages/Guide.jsx @@ -56,6 +56,9 @@ export default function TVChannelGuide({ startDate, endDate }) { const guideRef = useRef(null); const timelineRef = useRef(null); // New ref for timeline scrolling + // Add new state to track hovered logo + const [hoveredChannelId, setHoveredChannelId] = useState(null); + // Load program data once useEffect(() => { if (!Object.keys(channels).length === 0) { @@ -286,6 +289,21 @@ export default function TVChannelGuide({ startDate, endDate }) { showVideo(vidUrl); } + // Function to handle logo click to play channel + function handleLogoClick(channel, event) { + // Prevent event from bubbling up + event.stopPropagation(); + + // Build a playable stream URL for the channel + let vidUrl = `/proxy/ts/stream/${channel.uuid}`; + if (env_mode === 'dev') { + vidUrl = `${window.location.protocol}//${window.location.hostname}:5656${vidUrl}`; + } + + // Use the existing showVideo function + showVideo(vidUrl); + } + // On program click, toggle the expanded state function handleProgramClick(program, event) { // Prevent event from bubbling up to parent elements @@ -1014,38 +1032,83 @@ export default function TVChannelGuide({ startDate, endDate }) { zIndex: 30, // Higher than expanded programs to prevent overlap height: rowHeight, transition: 'height 0.2s ease', + cursor: 'pointer', // Add cursor pointer to indicate clickable + position: 'relative', // Remove duplicate, keep only this one }} + onClick={(e) => handleLogoClick(channel, e)} + onMouseEnter={() => setHoveredChannelId(channel.id)} + onMouseLeave={() => setHoveredChannelId(null)} > - {/* Logo content */} + {/* Play icon overlay - visible on hover (moved outside to cover entire box) */} + {hoveredChannelId === channel.id && ( + + + )} + + {/* Logo content - restructured for better positioning */} - {channel.name} + > + {channel.name} + + + {/* Channel number - pinned to bottom with padding */} {channel.channel_number || '-'}