// scripts/ui.js // --- Sample Data for Listings --- const streamingData = [{title:"The Grand Adventure",type:"Movie",genre:"Adventure, Comedy",platform:"Netflix",rating:"4.8",year:"2022",description:"A hilarious journey across continents with unexpected twists.",broadcastTime:"2023-12-10T19:30:00"},{title:"Dark Secrets",type:"TV Series",genre:"Drama, Thriller",platform:"HBO Max",rating:"4.7",year:"2021",description:"A small town's dark past resurfaces with shocking revelations.",broadcastTime:"2023-12-12T21:00:00"},{title:"Space Explorers",type:"Documentary",genre:"Science, Space",platform:"Disney+",rating:"4.9",year:"2023",description:"The latest discoveries from the frontiers of space exploration.",broadcastTime:"2023-12-14T18:00:00"}]; const rssFeedData = [{title:"New Episode: The Grand Adventure",source:"Netflix",time:"5 hours ago",excerpt:"The comedy adventure movie is now the most-watched title on Netflix this week."}, {title:"Breaking: New streaming partnership",source:"Streaming News",time:"1 day ago",excerpt:"Major platforms announce new content sharing agreement."}]; const getElement = (id) => document.getElementById(id); function showNotification(title, message) { const container = getElement('notification'); if (!container) return; container.className = 'notification show'; container.innerHTML = `

${title}

${message}

`; setTimeout(() => { container.classList.remove('show'); }, 3000); } function loadRSSFeed() { const container = getElement('rss-feed'); if (!container) return; container.innerHTML = ''; rssFeedData.forEach(item => { const feedItem = document.createElement('div'); feedItem.className = 'rss-item bg-gray-50 p-3 rounded-lg'; feedItem.innerHTML = `

${item.title}

${item.source}${item.time}

${item.excerpt}

`; container.appendChild(feedItem); }); } function loadRecommendations() { const container = getElement('recommendations-container'); if (!container) return; container.innerHTML = ''; streamingData.forEach(item => { const card = document.createElement('div'); card.className = 'stream-card bg-white rounded-lg overflow-hidden shadow-md hover:shadow-xl transition duration-300 fade-in p-4'; card.innerHTML = `

${item.title}

${item.rating}

${item.type} • ${item.genre} • ${item.year}

${item.platform}

${item.description}

Watch
`; card.querySelector('.save-btn').addEventListener('click', () => showNotification('Reminder Set!', `We'll notify you when "${item.title}" is about to broadcast.`)); container.appendChild(card); }); } export function initUI() { loadRSSFeed(); loadRecommendations(); }