-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_s.html
342 lines (305 loc) · 12.6 KB
/
index_s.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ApproVideo - DIY Solutions Portal</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<link href="style.css" rel="stylesheet">
<style>
/* Accordion styles */
.accordion-item {
@apply border-b border-gray-200;
}
.accordion-header {
@apply py-2;
}
.accordion-button {
@apply w-full text-left font-medium;
}
.accordion-collapse {
@apply transition-max-height duration-300 overflow-hidden;
}
.accordion-collapse.hidden {
@apply max-h-0;
}
/* Optional: Arrow icon styles */
.arrow-icon {
@apply ml-2 transition-transform duration-200;
}
.arrow-icon.rotate-180 {
@apply transform rotate-180;
}
/* Video Modal */
.video-modal {
@apply fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center hidden z-50;
}
</style>
</head>
<body class="theme-transition">
<nav class="theme-transition shadow-lg">
<div class="max-w-7xl mx-auto px-4">
<div class="flex items-center justify-between h-16">
<a href="index.html" class="flex items-center space-x-3">
<svg class="h-8 w-8 text-green-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" />
<path d="M12 8v8m-4-4h8" />
</svg>
<span class="text-xl font-bold bg-gradient-to-r from-green-500 to-blue-500 bg-clip-text text-transparent">
ApproVideo
</span>
</a>
<div class="flex items-center space-x-4">
<a href="index.html" class="text-gray-300 hover:text-green-500 px-3 py-2">Home</a>
<button id="darkModeToggle" class="p-2 rounded-lg hover:bg-gray-700/50 text-gray-300">
<i class="fas fa-sun text-yellow-500 dark:hidden"></i>
<i class="fas fa-moon text-blue-400 hidden dark:inline"></i>
</button>
<div class="relative">
<button id="profileButton" class="p-2 rounded-lg hover:bg-gray-700/50">
<i class="fas fa-user text-gray-300"></i>
</button>
<div id="profileDropdown"
class="profile-dropdown absolute right-0 mt-2 w-48 rounded-lg shadow-lg bg-white dark:bg-gray-800">
<div class="py-1">
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">Profile</a>
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">Settings</a>
<a href="#" class="block px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">Sign out</a>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="hero-slider">
<div class="slide active">
<img src="https://images.unsplash.com/photo-1505236858219-8359eb29e329?auto=format&fit=crop"
alt="Clean water solutions">
<div class="slide-content">
<h2 class="text-2xl font-bold mb-2">Clean Water Solutions</h2>
<p class="text-lg opacity-90">Discover sustainable technologies</p>
<div class="button-group">
<a href="/skills" class="cta-button cta-primary">
<i class="fas fa-graduation-cap"></i>
Drinking Water
</a>
<a href="/sanitation" class="cta-button cta-secondary">
<i class="fas fa-shield-alt"></i>
Sanitation
</a>
</div>
</div>
</div>
<div class="slide">
<img src="https://images.unsplash.com/photo-1531206715517-5c0ba140b2b8?auto=format&fit=crop" alt="Community impact">
<div class="slide-content">
<h2 class="text-2xl font-bold mb-2">Community Impact</h2>
<p class="text-lg opacity-90">Building together</p>
</div>
</div>
<div class="slide">
<img src="https://images.unsplash.com/photo-1501854140801-50d01698950b?auto=format&fit=crop" alt="Natural solutions">
<div class="slide-content">
<h2 class="text-2xl font-bold mb-2">Natural Solutions</h2>
<p class="text-lg opacity-90">Working with nature</p>
<div class="button-group">
<a href="/skills" class="cta-button cta-primary">
<i class="fas fa-graduation-cap"></i>
Drinking water
</a>
<a href="/sanitation" class="cta-button cta-secondary">
<i class="fas fa-shield-alt"></i>
Hygiene
</a>
</div>
</div>
</div>
<div class="slider-nav">
<button class="nav-dot active"></button>
<button class="nav-dot"></button>
<button class="nav-dot"></button>
</div>
</div>
<div class="container mx-auto p-4">
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-8">
<button class="category-icon active flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="diy">
<i class="fas fa-home text-2xl mb-2 text-blue-500"></i>
<span class="text-sm text-gray-600">DIY</span>
</button>
<button class="category-icon flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="water">
<i class="fas fa-tint text-2xl mb-2 text-cyan-500"></i>
<span class="text-sm text-gray-600">Water</span>
</button>
<button class="category-icon flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="waste">
<i class="fas fa-recycle text-2xl mb-2 text-green-500"></i>
<span class="text-sm text-gray-600">Waste</span>
</button>
<button class="category-icon flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="energy">
<i class="fas fa-solar-panel text-2xl mb-2 text-yellow-500"></i>
<span class="text-sm text-gray-600">Energy</span>
</button>
<button class="category-icon flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="food">
<i class="fas fa-seedling text-2xl mb-2 text-emerald-500"></i>
<span class="text-sm text-gray-600">Agriculture</span>
</button>
<button class="category-icon flex flex-col items-center p-4 bg-white rounded-xl shadow-sm hover:shadow-md"
data-category="health">
<i class="fas fa-heart text-2xl mb-2 text-red-500"></i>
<span class="text-sm text-gray-600">Health</span>
</button>
</div>
<div class="flex flex-col md:flex-row gap-4 mb-8">
<div class="flex-1">
<input type="text" id="searchInput" placeholder="Search solutions..."
class="w-full px-4 py-3 rounded-lg border border-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200">
</div>
<div class="flex-shrink-0">
<select id="sortSelect"
class="w-full md:w-auto px-4 py-3 bg-white border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200">
<option value="newest">Newest First</option>
<option value="popular">Most Popular</option>
<option value="az">A-Z</option>
</select>
</div>
</div>
<div id="skeletonLoader" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
</div>
<div id="videoGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 hidden">
</div>
<div id="infiniteScrollTrigger" class="h-20"></div>
</div>
<div id="videoModal" class="video-modal">
<div class="bg-white rounded-lg overflow-hidden w-full max-w-4xl relative p-4">
<button id="modalCloseButton" class="absolute top-2 right-2 text-gray-500 hover:text-gray-700">
<i class="fas fa-times text-2xl"></i>
</button>
<div class="aspect-video">
<iframe id="modalVideoIframe" class="w-full h-full" src="" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
<script>
// Theme Toggle
const darkModeToggle = document.getElementById('darkModeToggle');
const html = document.documentElement;
function updateTheme(isDark) {
html.classList.toggle('dark', isDark);
localStorage.setItem('darkMode', isDark);
}
// Check saved preference
if (localStorage.getItem('darkMode') === 'true' ||
(!localStorage.getItem('darkMode') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)) {
updateTheme(true);
}
darkModeToggle.addEventListener('click', () => {
updateTheme(!html.classList.contains('dark'));
});
// Profile Dropdown
const profileButton = document.getElementById('profileButton');
const profileDropdown = document.getElementById('profileDropdown');
profileButton.addEventListener('click', (e) => {
e.stopPropagation();
profileDropdown.classList.toggle('dropdown-active');
});
document.addEventListener('click', () => {
profileDropdown.classList.remove('dropdown-active');
});
// Slider Functionality
document.addEventListener('DOMContentLoaded', () => {
const slides = document.querySelectorAll('.slide');
const dots = document.querySelectorAll('.nav-dot');
let currentSlide = 0;
let interval;
function showSlide(n) {
slides[currentSlide].classList.remove('active');
dots[currentSlide].classList.remove('active');
currentSlide = (n + slides.length) % slides.length;
slides[currentSlide].classList.add('active');
dots[currentSlide].classList.add('active');
}
function startAutoSlide() {
interval = setInterval(() => showSlide(currentSlide + 1), 5000);
}
dots.forEach((dot, index) => {
dot.addEventListener('click', () => {
clearInterval(interval);
showSlide(index);
startAutoSlide();
});
});
startAutoSlide();
const slider = document.querySelector('.hero-slider');
slider.addEventListener('mouseenter', () => clearInterval(interval));
slider.addEventListener('mouseleave', startAutoSlide);
});
</script>
<script type="module">
import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm';
import safeHtml from './safeHtmlUtils.js';
class PublicVideoPortal {
constructor() {
this.supabase = createClient(
'https://vlvbodwrtblttvwnxkjx.supabase.co',
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZsdmJvZHdydGJsdHR2d254a2p4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODY3NDk2NzIsImV4cCI6MjAwMjMyNTY3Mn0.TRT1HeX85vP1zDxnU7qBz5GqNPgYZUj-BOdek4qmtEg'
);
this.safeHtml = safeHtml;
this.currentPage = 0;
this.isLoading = false;
this.hasMore = true;
this.BATCH_SIZE = 12;
this.selectedCategory = null;
this.searchQuery = '';
this.init();
}
async init() {
this.setupEventListeners();
this.showSkeletonLoader();
await this.loadVideos();
const modalCloseButton = document.getElementById('modalCloseButton');
modalCloseButton.addEventListener('click', () => {
this.closeVideoModal();
});
const modal = document.getElementById('videoModal');
modal.addEventListener('click', (event) => {
if (event.target === modal) {
this.closeVideoModal();
}
});
}
setupEventListeners() {
const searchInput = document.getElementById('searchInput');
if (searchInput) {
searchInput.addEventListener('input', (e) => {
this.searchQuery = e.target.value;
this.resetAndReload();
});
}
const categoryButtons = document.querySelectorAll('.category-icon');
categoryButtons.forEach(button => {
button.addEventListener('click', () => this.handleCategoryClick(button));
});
const sortSelect = document.getElementById('sortSelect');
if (sortSelect) {
sortSelect.addEventListener('change', (e) => {
this.handleSort(e.target.value);
});
}
document.querySelectorAll('.category-icon').forEach(button => {
button.addEventListener('click', () => {
this.handleCategoryClick(button);
});
});
this.setupInfiniteScroll();
}
resetAndReload() {
this.currentPage = 0;
this.hasMore = true;