Spaces:
Running
Running
Update scripts/ui.js
Browse files- scripts/ui.js +43 -9
scripts/ui.js
CHANGED
@@ -1,11 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
export function initUI() {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
if (productionButton && productionPanel) {
|
6 |
-
productionButton.addEventListener('click', () => {
|
7 |
-
// This toggles the 'open' class which is defined in your main.css
|
8 |
-
productionPanel.classList.toggle('open');
|
9 |
-
});
|
10 |
-
}
|
11 |
}
|
|
|
1 |
+
// scripts/ui.js
|
2 |
+
|
3 |
+
// --- Sample Data for Listings ---
|
4 |
+
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"}];
|
5 |
+
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."}];
|
6 |
+
|
7 |
+
const getElement = (id) => document.getElementById(id);
|
8 |
+
|
9 |
+
function showNotification(title, message) {
|
10 |
+
const container = getElement('notification');
|
11 |
+
if (!container) return;
|
12 |
+
container.className = 'notification show';
|
13 |
+
container.innerHTML = `<div class="flex items-center"><i class="fas fa-bell text-yellow-300 mr-3"></i><div><p class="font-semibold">${title}</p><p class="text-sm">${message}</p></div></div>`;
|
14 |
+
setTimeout(() => { container.classList.remove('show'); }, 3000);
|
15 |
+
}
|
16 |
+
|
17 |
+
function loadRSSFeed() {
|
18 |
+
const container = getElement('rss-feed');
|
19 |
+
if (!container) return;
|
20 |
+
container.innerHTML = '';
|
21 |
+
rssFeedData.forEach(item => {
|
22 |
+
const feedItem = document.createElement('div');
|
23 |
+
feedItem.className = 'rss-item bg-gray-50 p-3 rounded-lg';
|
24 |
+
feedItem.innerHTML = `<h4 class="font-medium text-sm mb-1">${item.title}</h4><div class="flex items-center text-xs text-gray-500 mb-2"><span>${item.source}</span><span class="mx-2">•</span><span>${item.time}</span></div><p class="text-xs text-gray-700">${item.excerpt}</p>`;
|
25 |
+
container.appendChild(feedItem);
|
26 |
+
});
|
27 |
+
}
|
28 |
+
|
29 |
+
function loadRecommendations() {
|
30 |
+
const container = getElement('recommendations-container');
|
31 |
+
if (!container) return;
|
32 |
+
container.innerHTML = '';
|
33 |
+
streamingData.forEach(item => {
|
34 |
+
const card = document.createElement('div');
|
35 |
+
card.className = 'stream-card bg-white rounded-lg overflow-hidden shadow-md hover:shadow-xl transition duration-300 fade-in p-4';
|
36 |
+
card.innerHTML = `<div class="mb-3"><div class="flex justify-between items-start"><h3 class="font-bold text-base">${item.title}</h3><span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full flex items-center"><i class="fas fa-star text-yellow-500 mr-1 text-xs"></i> ${item.rating}</span></div><p class="text-gray-600 text-xs mb-1">${item.type} • ${item.genre} • ${item.year}</p><div class="text-xs text-indigo-600 mb-2">${item.platform}</div></div><p class="text-gray-700 text-sm mb-4">${item.description}</p><div class="flex justify-between items-center"><button class="save-btn text-indigo-600 hover:text-indigo-800 text-xs font-medium"><i class="far fa-bookmark mr-1"></i> Save</button><a href="#" target="_blank" class="bg-indigo-600 hover:bg-indigo-700 text-white px-3 py-1 rounded-full text-xs font-medium transition"><i class="fas fa-play mr-1"></i> Watch</a></div>`;
|
37 |
+
card.querySelector('.save-btn').addEventListener('click', () => showNotification('Reminder Set!', `We'll notify you when "${item.title}" is about to broadcast.`));
|
38 |
+
container.appendChild(card);
|
39 |
+
});
|
40 |
+
}
|
41 |
+
|
42 |
export function initUI() {
|
43 |
+
loadRSSFeed();
|
44 |
+
loadRecommendations();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|