-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1105 lines (962 loc) · 53.4 KB
/
Copy pathindex.html
File metadata and controls
1105 lines (962 loc) · 53.4 KB
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VIT Site Hub | Student Resource Directory</title>
<meta name="description" content="Curated resources for VIT students. Notes, tools, entertainment, and more.">
<link rel="icon" type="image/png" href="assets/flaticon.png">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
fontFamily: { sans: ['Outfit', 'sans-serif'] },
colors: {
dark: { 900: '#11111b', 800: '#1e1e2e', 700: '#313244' },
brand: { 500: '#cba6f7', 600: '#b4befe' }
},
animation: {
'slide-up': 'slideUp 0.5s ease-out forwards',
'fade-in': 'fadeIn 0.5s ease-out forwards',
},
keyframes: {
slideUp: {
'0%': { transform: 'translateY(20px)', opacity: '0' },
'100%': { transform: 'translateY(0)', opacity: '1' },
},
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
}
}
}
}
}
</script>
<style>
body {
background-color: #f3f4f6;
color: #1f2937;
transition: background-color 0.3s, color 0.3s;
}
.dark body {
background-color: #11111b;
background-image: radial-gradient(circle at 50% 0%, #313244 0%, #11111b 70%);
color: #cdd6f4;
background-attachment: fixed;
}
/* Glass Cards */
.glass-panel {
background: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(0, 0, 0, 0.05);
backdrop-filter: blur(10px);
transition: all 0.3s ease;
}
.dark .glass-panel {
background: rgba(30, 30, 46, 0.6);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}
.glass-panel:hover {
transform: translateY(-5px);
box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
}
.dark .glass-panel:hover {
box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
border-color: rgba(203, 166, 247, 0.3);
}
/* Staggered Animation Logic */
.card-enter {
opacity: 0;
animation: slideUp 0.5s ease-out forwards;
}
.card-enter:nth-child(1) {
animation-delay: 50ms;
}
.card-enter:nth-child(2) {
animation-delay: 100ms;
}
.card-enter:nth-child(3) {
animation-delay: 150ms;
}
.card-enter:nth-child(4) {
animation-delay: 200ms;
}
.card-enter:nth-child(5) {
animation-delay: 250ms;
}
.card-enter:nth-child(6) {
animation-delay: 300ms;
}
.card-enter:nth-child(7) {
animation-delay: 350ms;
}
.card-enter:nth-child(8) {
animation-delay: 400ms;
}
.card-enter:nth-child(9) {
animation-delay: 450ms;
}
.card-enter:nth-child(10) {
animation-delay: 500ms;
}
.card-enter:nth-child(11) {
animation-delay: 550ms;
}
.card-enter:nth-child(12) {
animation-delay: 600ms;
}
/* Inputs */
.custom-input {
transition: all 0.2s;
}
.custom-input:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(203, 166, 247, 0.5);
}
/* Badges */
.badge {
font-size: 0.7rem;
padding: 2px 8px;
border-radius: 99px;
font-weight: 600;
letter-spacing: 0.02em;
}
.badge-new {
background: #f38ba8;
color: #11111b;
animation: pulse 2s infinite;
}
/* Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #9ca3af;
border-radius: 4px;
}
.dark ::-webkit-scrollbar-thumb {
background: #45475a;
}
.dark ::-webkit-scrollbar-thumb:hover {
background: #585b70;
}
/* Custom Dropdown Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.05);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.4);
}
.sub-filter-btn.active {
background-color: #cba6f7;
color: #11111b;
font-weight: 700;
}
/* Heart Pop Animation */
@keyframes heartPop {
0% {
transform: scale(1);
}
50% {
transform: scale(1.4);
}
100% {
transform: scale(1);
}
}
.heart-pop {
animation: heartPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.thumb-flip {
animation: thumbFlip 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
display: inline-block;
}
/* Simple Dropdown Scale Animation */
.dropdown-item {
transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s;
transform-origin: center;
position: relative;
will-change: transform;
}
.dropdown-item:hover {
transform: scale(1.04);
background-color: rgba(255, 255, 255, 0.08); /* Slight highlight */
z-index: 10;
}
/* Number Ticker */
.ticker-wrap {
position: relative;
display: inline-block;
height: 1.25rem;
/* ~20px to match text line-height */
overflow: hidden;
vertical-align: bottom;
min-width: 1ch;
text-align: left;
}
.ticker-col {
display: flex;
flex-direction: column;
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ticker-item {
display: flex;
align-items: center;
height: 1.25rem;
line-height: 1.25rem;
}
/* Hide scrollbar for dropdown */
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.dark .skeleton-shimmer {
background-color: rgba(255, 255, 255, 0.05);
}
.skeleton-shimmer::after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform: translateX(-100%);
background-image: linear-gradient(90deg,
rgba(255, 255, 255, 0) 0,
rgba(255, 255, 255, 0.4) 20%,
rgba(255, 255, 255, 0.8) 60%,
rgba(255, 255, 255, 0) 100%);
animation: shimmer 2s infinite;
}
.dark .skeleton-shimmer::after {
background-image: linear-gradient(90deg,
rgba(255, 255, 255, 0) 0,
rgba(255, 255, 255, 0.05) 20%,
rgba(255, 255, 255, 0.1) 60%,
rgba(255, 255, 255, 0) 100%);
}
@keyframes shimmer {
100% {
transform: translateX(100%);
}
}
</style>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-DDEMB3X2XQ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-DDEMB3X2XQ');
</script>
<body class="flex flex-col min-h-screen">
<div id="announcement-banner"
class="hidden relative z-[100] px-4 py-3 text-center text-sm font-medium animate-slide-up shadow-lg">
<span id="announcement-text"></span>
<button id="close-announcement"
class="absolute right-4 top-1/2 -translate-y-1/2 opacity-60 hover:opacity-100"><i
class="fas fa-times"></i></button>
</div>
<div id="toast-container" class="fixed bottom-6 right-6 z-[100] flex flex-col gap-3 pointer-events-none"></div>
<nav class="container mx-auto px-6 py-6 flex justify-between items-center z-[60] relative">
<div class="flex items-center gap-2">
<div
class="w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center text-white font-bold text-xl shadow-lg">
V</div>
<span class="text-xl font-bold tracking-tight dark:text-white">Site<span
class="text-purple-500">Hub</span></span>
</div>
<div class="flex gap-4">
<button id="theme-toggle"
class="w-10 h-10 rounded-full bg-gray-200 dark:bg-white/10 flex items-center justify-center transition hover:bg-gray-300 dark:hover:bg-white/20">
<i class="fas fa-moon text-gray-700 dark:text-gray-300" id="theme-icon"></i>
</button>
<button onclick="document.getElementById('suggestionModal').classList.remove('hidden')"
class="bg-purple-600 hover:bg-purple-700 text-white px-5 py-2 rounded-full text-sm font-semibold shadow-lg shadow-purple-500/20 transition transform hover:scale-105">
<i class="fas fa-plus mr-2"></i> Submit Site
</button>
</div>
</nav>
<header class="relative container mx-auto px-6 pt-10 pb-16 text-center z-50">
<div class="max-w-3xl mx-auto animate-slide-up">
<h1 class="text-4xl md:text-6xl font-bold mb-6 dark:text-white leading-tight">
Everything you need,<br>
<span class="text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-purple-500">in one
place.</span>
</h1>
<p class="text-gray-600 dark:text-gray-400 text-lg mb-10 max-w-xl mx-auto">
A community-curated directory of resources for VIT students.
From academics to entertainment.
</p>
<div class="relative max-w-2xl mx-auto group z-50">
<div
class="absolute -inset-1 bg-gradient-to-r from-blue-600 to-purple-600 rounded-2xl blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200">
</div>
<div
class="relative bg-white dark:bg-[#1e1e2e] rounded-2xl p-2 shadow-2xl flex flex-col md:flex-row gap-2 items-center">
<div class="flex-1 flex items-center pl-4 w-full">
<i class="fas fa-search text-gray-400 text-lg"></i>
<input type="text" id="searchInput" placeholder="Search resources (e.g., 'calc', 'movies')..."
class="w-full bg-transparent border-none p-4 text-gray-800 dark:text-white focus:ring-0 placeholder-gray-400 text-lg custom-input">
</div>
<div class="h-8 w-[1px] bg-gray-200 dark:bg-gray-700 hidden md:block"></div>
<div class="relative w-full md:w-56 z-50">
<input type="hidden" id="filterSelect" value="all">
<button id="dropdownTrigger"
class="w-full flex items-center justify-between bg-white/5 border border-white/10 rounded-xl px-4 py-4 text-left text-gray-300 hover:bg-white/10 hover:text-white transition-all duration-300 focus:outline-none group">
<span id="dropdownLabel" class="flex items-center gap-2 font-medium truncate">
<i class="fas fa-layer-group text-purple-400"></i> Everything
</span>
<i class="fas fa-chevron-down text-xs text-gray-500 group-hover:text-white transition-transform duration-300"
id="dropdownArrow"></i>
</button>
<div id="dropdownMenu"
class="hidden absolute top-full right-0 mt-2 w-full bg-[#1e1e2e]/95 backdrop-blur-xl border border-white/10 rounded-xl shadow-2xl overflow-hidden origin-top-right transform transition-all duration-200 scale-95 opacity-0 z-50">
<div class="dropdown-item px-4 py-3 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-gray-300 hover:text-white transition border-b border-white/5"
data-value="all" data-icon="fa-layer-group" data-color="text-purple-400">
<div
class="w-8 h-8 rounded-lg bg-purple-500/10 flex items-center justify-center text-purple-400 flex-shrink-0">
<i class="fas fa-layer-group"></i>
</div>
<span class="font-medium truncate">Everything</span>
</div>
<div class="dropdown-item px-4 py-3 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-gray-300 hover:text-white transition"
data-value="favorites" data-icon="fa-star" data-color="text-yellow-400">
<div
class="w-8 h-8 rounded-lg bg-yellow-500/10 flex items-center justify-center text-yellow-400 flex-shrink-0">
<i class="fas fa-star"></i>
</div>
<span class="font-medium truncate">Favorites</span>
</div>
<div class="h-px bg-white/10 my-1 mx-4"></div>
<div class="max-h-60 overflow-y-auto no-scrollbar">
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="academics" data-icon="fa-graduation-cap" data-color="text-blue-400">
<i class="fas fa-graduation-cap w-5 text-center text-blue-400 flex-shrink-0"></i>
Academics
</div>
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="entertainment" data-icon="fa-film" data-color="text-pink-400">
<i class="fas fa-film w-5 text-center text-pink-400 flex-shrink-0"></i>
Entertainment
</div>
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="productivity" data-icon="fa-check-double" data-color="text-green-400">
<i class="fas fa-check-double w-5 text-center text-green-400 flex-shrink-0"></i>
Productivity
</div>
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="design" data-icon="fa-palette" data-color="text-orange-400">
<i class="fas fa-palette w-5 text-center text-orange-400 flex-shrink-0"></i> Design
</div>
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="utilities" data-icon="fa-tools" data-color="text-gray-400">
<i class="fas fa-tools w-5 text-center text-gray-400 flex-shrink-0"></i> Utilities
</div>
<div class="dropdown-item px-4 py-2.5 hover:bg-white/5 cursor-pointer flex items-center gap-3 text-sm text-gray-400 hover:text-white transition"
data-value="student-projects" data-icon="fa-flask" data-color="text-indigo-400">
<i class="fas fa-flask w-5 text-center text-indigo-400 flex-shrink-0"></i> Projects
</div>
</div>
</div>
</div>
</div>
</div>
<div id="subFilterContainer" class="mt-6 flex flex-wrap justify-center gap-2 hidden animate-slide-up">
</div>
</div>
</header>
<main class="container mx-auto px-6 pb-20 flex-grow z-0 relative">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold dark:text-white flex items-center gap-2">
<i class="fas fa-layer-group text-purple-500"></i> Resources
<span id="resourceCount"
class="text-xs bg-gray-200 dark:bg-gray-700 px-2 py-1 rounded-full text-gray-600 dark:text-gray-300">0</span>
</h2>
<select id="sortSelect"
class="bg-white dark:bg-[#1e1e2e] dark:text-gray-300 border border-gray-200 dark:border-gray-700 rounded-lg text-sm px-3 py-2 focus:outline-none focus:border-purple-500">
<option value="popular">Most Voted</option>
<option value="newest">Newest Added</option>
<option value="alpha">A-Z Name</option>
</select>
</div>
<div id="resourceGrid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
</div>
<div id="paginationContainer" class="flex justify-center mt-12 hidden">
<button id="loadMoreBtn"
class="bg-white/10 hover:bg-white/20 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 px-8 py-3 rounded-full font-bold transition shadow-lg flex items-center gap-2 border border-gray-200 dark:border-gray-700">
Load More Resources <i class="fas fa-chevron-down"></i>
</button>
</div>
</main>
<footer class="mt-auto border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-[#181825] py-8 z-0">
<div class="container mx-auto px-6 text-center">
<p class="text-gray-500 dark:text-gray-400 mb-2">© 2024 VIT Site Hub. Built for students.</p>
<div class="flex justify-center gap-4 text-sm">
<a href="main.html" class="text-gray-400 hover:text-purple-400 transition"><i
class="fas fa-shield-alt"></i> Admin Login</a>
<a href="#" onclick="document.getElementById('suggestionModal').classList.remove('hidden')"
class="text-gray-400 hover:text-purple-400 transition">Submit Site</a>
</div>
</div>
</footer>
<div id="suggestionModal"
class="hidden fixed inset-0 z-[70] flex items-center justify-center bg-black/80 backdrop-blur-sm p-4">
<div class="bg-white dark:bg-[#1e1e2e] w-full max-w-md rounded-2xl shadow-2xl p-6 relative animate-slide-up">
<button onclick="document.getElementById('suggestionModal').classList.add('hidden')"
class="absolute top-4 right-4 text-gray-400 hover:text-red-500"><i
class="fas fa-times text-xl"></i></button>
<h2 class="text-2xl font-bold mb-1 dark:text-white">Suggest a Resource</h2>
<p class="text-gray-500 text-sm mb-6">Help us grow the library.</p>
<form id="suggestionForm" class="space-y-4">
<input type="hidden" name="access_key" value="76a4594d-6f73-47f1-b59e-7472327cdb0c">
<div>
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">Name</label>
<input type="text" name="Site Name" required
class="w-full bg-gray-100 dark:bg-[#181825] border-none rounded-lg p-3 dark:text-white focus:ring-2 focus:ring-purple-500">
</div>
<div>
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">URL</label>
<input type="url" name="Site URL" required
class="w-full bg-gray-100 dark:bg-[#181825] border-none rounded-lg p-3 dark:text-white focus:ring-2 focus:ring-purple-500">
</div>
<div>
<label class="block text-xs font-bold text-gray-500 uppercase mb-1">Why is this useful?</label>
<textarea name="Reason" rows="3"
class="w-full bg-gray-100 dark:bg-[#181825] border-none rounded-lg p-3 dark:text-white focus:ring-2 focus:ring-purple-500"></textarea>
</div>
<button type="submit"
class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 rounded-lg transition">Send
Suggestion</button>
</form>
</div>
</div>
<div id="reportModal"
class="hidden fixed inset-0 z-[70] flex items-center justify-center bg-black/80 backdrop-blur-sm p-4">
<div class="bg-white dark:bg-[#1e1e2e] w-full max-w-sm rounded-2xl shadow-2xl p-6 animate-slide-up">
<h2 class="text-xl font-bold mb-4 text-red-500 flex items-center gap-2"><i class="fas fa-flag"></i> Report
Issue</h2>
<p id="reportTargetName" class="text-gray-500 text-sm mb-4 truncate">...</p>
<form id="reportForm" class="space-y-3">
<input type="hidden" id="reportResourceId">
<input type="hidden" id="reportResourceName">
<label
class="flex items-center p-3 rounded-lg bg-gray-50 dark:bg-[#181825] cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<input type="radio" name="reportReason" value="Broken Link" checked
class="text-red-500 focus:ring-red-500 bg-gray-700 border-gray-600">
<span class="ml-3 text-sm font-medium dark:text-gray-300">Link is broken</span>
</label>
<label
class="flex items-center p-3 rounded-lg bg-gray-50 dark:bg-[#181825] cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<input type="radio" name="reportReason" value="Outdated Info"
class="text-red-500 focus:ring-red-500 bg-gray-700 border-gray-600">
<span class="ml-3 text-sm font-medium dark:text-gray-300">Information is outdated</span>
</label>
<label
class="flex items-center p-3 rounded-lg bg-gray-50 dark:bg-[#181825] cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<input type="radio" name="reportReason" value="Wrong Category"
class="text-red-500 focus:ring-red-500 bg-gray-700 border-gray-600">
<span class="ml-3 text-sm font-medium dark:text-gray-300">Wrong category</span>
</label>
<label
class="flex items-center p-3 rounded-lg bg-gray-50 dark:bg-[#181825] cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<input type="radio" name="reportReason" value="Inappropriate"
class="text-red-500 focus:ring-red-500 bg-gray-700 border-gray-600">
<span class="ml-3 text-sm font-medium dark:text-gray-300">Inappropriate content</span>
</label>
<label
class="flex items-center p-3 rounded-lg bg-gray-50 dark:bg-[#181825] cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition">
<input type="radio" name="reportReason" value="Other"
class="text-red-500 focus:ring-red-500 bg-gray-700 border-gray-600">
<span class="ml-3 text-sm font-medium dark:text-gray-300">Other</span>
</label>
<div class="flex gap-3 mt-4">
<button type="button" onclick="document.getElementById('reportModal').classList.add('hidden')"
class="flex-1 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-sm">Cancel</button>
<button type="submit"
class="flex-1 py-2 rounded-lg bg-red-500 hover:bg-red-600 text-white font-bold text-sm">Report</button>
</div>
</form>
</div>
</div>
<button id="toTopBtn"
class="fixed bottom-6 right-6 hidden bg-purple-600 hover:bg-purple-700 text-white w-12 h-12 rounded-full shadow-lg z-40 items-center justify-center transition-all hover:scale-110">
<i class="fas fa-arrow-up"></i>
</button>
<script>
document.addEventListener('DOMContentLoaded', () => {
const trigger = document.getElementById('dropdownTrigger');
const menu = document.getElementById('dropdownMenu');
const arrow = document.getElementById('dropdownArrow');
const label = document.getElementById('dropdownLabel');
const hiddenInput = document.getElementById('filterSelect');
function closeDropdown() {
menu.classList.remove('scale-100', 'opacity-100');
menu.classList.add('scale-95', 'opacity-0');
arrow.classList.remove('rotate-180');
setTimeout(() => menu.classList.add('hidden'), 200);
}
trigger.addEventListener('click', (e) => {
e.stopPropagation();
const isHidden = menu.classList.contains('hidden');
if (isHidden) {
menu.classList.remove('hidden');
requestAnimationFrame(() => {
menu.classList.remove('scale-95', 'opacity-0');
menu.classList.add('scale-100', 'opacity-100');
});
arrow.classList.add('rotate-180');
} else {
closeDropdown();
}
});
document.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', (e) => {
e.stopPropagation();
const value = item.dataset.value;
const icon = item.dataset.icon;
const color = item.dataset.color;
const text = item.innerText;
label.innerHTML = `<i class="fas ${icon} ${color}"></i> ${text}`;
hiddenInput.value = value;
hiddenInput.dispatchEvent(new Event('change'));
closeDropdown();
});
});
document.addEventListener('click', (e) => {
if (!trigger.contains(e.target) && !menu.contains(e.target)) {
closeDropdown();
}
});
});
</script>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
import { getFirestore, collection, doc, updateDoc, increment, query, orderBy, getDocs, arrayUnion, arrayRemove, addDoc, serverTimestamp, onSnapshot } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js";
import { getAuth, signInAnonymously, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
const firebaseConfig = {
apiKey: "AIzaSyB8f4b8xdU5Uq-HHqQ8kwxG6i18zdi8JAo",
authDomain: "site-hub-29fb2.firebaseapp.com",
projectId: "site-hub-29fb2",
storageBucket: "site-hub-29fb2.firebasestorage.app",
messagingSenderId: "373988520340",
appId: "1:373988520340:web:f9eafe75c8de05cca55f81",
measurementId: "G-DDEMB3X2XQ"
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
const auth = getAuth(app);
// State
let allResources = [];
let filteredResources = [];
let favorites = JSON.parse(localStorage.getItem('vsh_favorites') || '[]');
let userUid = null;
let activeSubFilter = 'all';
let searchTimeout;
const ITEMS_PER_PAGE = 12;
let currentPage = 1;
const predefinedSubcats = {
academics: ['notes', 'coding'],
entertainment: ['movies', 'anime', 'music'],
productivity: ['tools', 'planning'],
design: ['ui-ux', 'graphics', 'inspirations'],
utilities: [],
'student-projects': ['web', 'app']
};
// --- AUTH & INIT ---
onAuthStateChanged(auth, (user) => {
if (user) {
userUid = user.uid;
showSkeletons();
loadResources();
} else {
signInAnonymously(auth).catch(err => console.error("Auth Error", err));
}
});
// --- CORE FUNCTIONS ---
function showSkeletons() {
const grid = document.getElementById('resourceGrid');
let html = '';
for (let i = 0; i < 8; i++) {
html += `
<div class="glass-panel rounded-2xl p-6 h-48">
<div class="flex justify-between mb-4">
<div class="h-6 w-32 skeleton-shimmer rounded"></div>
<div class="h-6 w-6 skeleton-shimmer rounded-full"></div>
</div>
<div class="h-4 w-full skeleton-shimmer rounded mb-2 mt-4"></div>
<div class="h-4 w-2/3 skeleton-shimmer rounded"></div>
</div>`;
}
grid.innerHTML = html;
}
async function loadResources() {
try {
const q = query(collection(db, 'resources'), orderBy('votes', 'desc'));
const snap = await getDocs(q);
allResources = snap.docs
.map(doc => {
let data = doc.data();
let cats = data.categories || [];
let subcats = data.subcategories || [];
if (cats.includes('notes')) {
cats = cats.filter(c => c !== 'notes');
if (!cats.includes('academics')) cats.push('academics');
if (!subcats.includes('notes')) subcats.push('notes');
}
if (cats.includes('coding')) {
cats = cats.filter(c => c !== 'coding');
if (!cats.includes('academics')) cats.push('academics');
if (!subcats.includes('coding')) subcats.push('coding');
}
return {
id: doc.id,
...data,
categories: cats,
subcategories: subcats,
createdAtVal: data.createdAt?.seconds || 0
};
})
.filter(r => !r.isHidden);
filterResources(true);
} catch (err) {
console.error(err);
document.getElementById('resourceGrid').innerHTML = `<div class="col-span-full text-center text-red-400 py-10">Failed to load resources.</div>`;
}
}
function renderResources(data, append = false) {
const grid = document.getElementById('resourceGrid');
const loadMoreBtn = document.getElementById('paginationContainer');
document.getElementById('resourceCount').innerText = filteredResources.length;
if (!append) grid.innerHTML = '';
if (data.length === 0 && !append) {
grid.innerHTML = `<div class="col-span-full flex flex-col items-center justify-center text-gray-400 py-16"><i class="fas fa-search text-5xl mb-4 opacity-20"></i><p>No resources found matching your criteria.</p></div>`;
loadMoreBtn.classList.add('hidden');
return;
}
const getCatColor = (cat) => {
const map = {
entertainment: 'bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-300',
academics: 'bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-300',
notes: 'bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-300',
coding: 'bg-teal-100 text-teal-600 dark:bg-teal-900/30 dark:text-teal-300',
};
return map[cat] || 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300';
};
data.forEach((r, index) => {
const isFav = favorites.includes(r.id);
const isNew = (Date.now() / 1000 - r.createdAtVal) < (7 * 86400);
const hasVoted = r.votedBy?.includes(userUid);
const card = document.createElement('div');
card.className = 'glass-panel rounded-2xl p-5 relative flex flex-col h-full group card-enter';
card.innerHTML = `
<div class="flex justify-between items-start mb-3">
<div class="flex-1 pr-2">
<div class="flex items-center gap-2 flex-wrap">
<h3 class="text-lg font-bold dark:text-white leading-tight group-hover:text-purple-400 transition cursor-pointer" onclick="window.open('${r.url}', '_blank')">${r.name}</h3>
${r.isVerified ? '<i class="fas fa-check-circle text-blue-400 text-xs" title="Official/Verified"></i>' : ''}
${isNew ? '<span class="badge badge-new">NEW</span>' : ''}
</div>
</div>
<button onclick="toggleFav('${r.id}')" class="transition transform hover:scale-110">
<i id="fav-icon-${r.id}" class="${isFav ? 'fas text-red-500' : 'far text-gray-400'} fa-heart text-lg"></i>
</button>
</div>
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-2 flex-grow cursor-pointer" onclick="window.open('${r.url}', '_blank')">
${r.description || 'No description available.'}
</p>
<div class="flex flex-wrap gap-2 mb-4">
${r.categories.slice(0, 3).map(c => `<span class="badge ${getCatColor(c)}">${c}</span>`).join('')}
</div>
<div class="flex items-center justify-between pt-4 border-t border-gray-100 dark:border-gray-700 mt-auto">
<div class="flex items-center gap-1">
<button id="vote-btn-${r.id}" onclick="handleVote('${r.id}')" class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg ${hasVoted ? 'bg-purple-100 dark:bg-purple-900/50 text-purple-600 dark:text-purple-300' : 'bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200'} transition text-sm font-semibold">
<i class="fas fa-thumbs-up"></i>
<span class="ticker-wrap"><span id="vote-count-${r.id}" class="ticker-col"><span class="ticker-item">${r.votes || 0}</span></span></span>
</button>
</div>
<div class="flex gap-2">
<button onclick="copyLink('${r.url}')" class="p-2 text-gray-400 hover:text-green-400 transition" title="Copy Link"><i class="fas fa-link"></i></button>
<button onclick="openReport('${r.id}', '${r.name.replace(/'/g, "\\'")}')" class="p-2 text-gray-400 hover:text-red-400 transition" title="Report"><i class="fas fa-flag"></i></button>
<a href="${r.url}" target="_blank" class="px-4 py-1.5 bg-gray-900 dark:bg-white text-white dark:text-black rounded-lg text-sm font-bold hover:opacity-80 transition">Visit</a>
</div>
</div>
`;
grid.appendChild(card);
});
const totalShown = currentPage * ITEMS_PER_PAGE;
if (totalShown < filteredResources.length) {
loadMoreBtn.classList.remove('hidden');
} else {
loadMoreBtn.classList.add('hidden');
}
}
const filterResources = (resetPagination = false) => {
const term = document.getElementById('searchInput').value.toLowerCase();
const mainCat = document.getElementById('filterSelect').value;
const sort = document.getElementById('sortSelect').value;
const subContainer = document.getElementById('subFilterContainer');
if (predefinedSubcats[mainCat] && predefinedSubcats[mainCat].length > 0) {
subContainer.classList.remove('hidden');
let html = `<button onclick="setSubFilter('all')" class="sub-filter-btn px-3 py-1 rounded-full text-xs border border-gray-600 text-gray-400 hover:bg-white/10 ${activeSubFilter === 'all' ? 'active' : ''}">All</button>`;
predefinedSubcats[mainCat].forEach(sc => {
html += `<button onclick="setSubFilter('${sc}')" class="sub-filter-btn px-3 py-1 rounded-full text-xs border border-gray-600 text-gray-400 hover:bg-white/10 capitalize ${activeSubFilter === sc ? 'active' : ''}">${sc.replace('-', ' ')}</button>`;
});
subContainer.innerHTML = html;
} else {
subContainer.classList.add('hidden');
activeSubFilter = 'all';
}
filteredResources = allResources.filter(r => {
const matchesSearch = r.name.toLowerCase().includes(term) || (r.description || '').toLowerCase().includes(term);
const matchesMainCat = mainCat === 'all' ||
(mainCat === 'favorites' && favorites.includes(r.id)) ||
r.categories.includes(mainCat);
const hasNoSubcats = !r.subcategories || r.subcategories.length === 0;
const matchesSubCat = activeSubFilter === 'all' || r.subcategories.includes(activeSubFilter) || hasNoSubcats;
return matchesSearch && matchesMainCat && matchesSubCat;
});
filteredResources.sort((a, b) => {
if (sort === 'popular') return (parseInt(b.votes) || 0) - (parseInt(a.votes) || 0);
if (sort === 'newest') return (b.createdAtVal || 0) - (a.createdAtVal || 0);
if (sort === 'alpha') return a.name.localeCompare(b.name);
return 0;
});
if (resetPagination) currentPage = 1;
const paginatedItems = filteredResources.slice(0, currentPage * ITEMS_PER_PAGE);
renderResources(paginatedItems);
};
// --- EVENTS ---
document.getElementById('loadMoreBtn').addEventListener('click', () => {
currentPage++;
const start = (currentPage - 1) * ITEMS_PER_PAGE;
const end = currentPage * ITEMS_PER_PAGE;
const nextBatch = filteredResources.slice(start, end);
renderResources(nextBatch, true);
});
document.getElementById('searchInput').addEventListener('input', (e) => {
filterResources(true);
clearTimeout(searchTimeout);
const query = e.target.value.trim();
if (query.length > 2) {
searchTimeout = setTimeout(async () => {
try {
await addDoc(collection(db, 'stats_search'), { term: query, timestamp: serverTimestamp() });
} catch (err) { console.error(err); }
}, 2000);
}
});
window.setSubFilter = (sub) => { activeSubFilter = sub; filterResources(true); };
// Listen for hidden input change (from custom dropdown)
document.getElementById('filterSelect').addEventListener('change', () => filterResources(true));
document.getElementById('sortSelect').addEventListener('change', () => filterResources(true));
// --- ACTIONS ---
window.toggleFav = (id) => {
const isAdding = !favorites.includes(id);
if (!isAdding) favorites = favorites.filter(f => f !== id);
else favorites.push(id);
localStorage.setItem('vsh_favorites', JSON.stringify(favorites));
const icon = document.getElementById(`fav-icon-${id}`);
if (icon) {
if (isAdding) {
icon.className = 'fas fa-heart text-red-500 text-lg heart-pop';
setTimeout(() => { if (icon) icon.classList.remove('heart-pop'); }, 300);
} else {
icon.className = 'far fa-heart text-gray-400 text-lg transition transform hover:scale-110';
}
}
if (document.getElementById('filterSelect').value === 'favorites') filterResources(true);
showToast(isAdding ? 'Added to Favorites' : 'Removed from Favorites');
};
window.handleVote = async (id) => {
if (!userUid) return;
const res = allResources.find(r => r.id === id);
const btn = document.getElementById(`vote-btn-${id}`);
const countSpan = document.getElementById(`vote-count-${id}`);
btn.disabled = true;
const hasVoted = res.votedBy?.includes(userUid);
const ref = doc(db, 'resources', id);
try {
if (hasVoted) {
await updateDoc(ref, { votes: increment(-1), votedBy: arrayRemove(userUid) });
res.votes = (res.votes || 0) - 1;
res.votedBy = res.votedBy.filter(u => u !== userUid);
} else {
await updateDoc(ref, { votes: increment(1), votedBy: arrayUnion(userUid) });
res.votes = (res.votes || 0) + 1;
if (!res.votedBy) res.votedBy = [];
res.votedBy.push(userUid);
}
if (!hasVoted) {
// Upvote visual animation
countSpan.innerHTML += `<span class="ticker-item">${res.votes}</span>`;
void countSpan.offsetWidth; // Force reflow
countSpan.style.transform = `translateY(-1.25rem)`;
setTimeout(() => {
countSpan.style.transition = 'none';
countSpan.style.transform = 'translateY(0)';
countSpan.innerHTML = `<span class="ticker-item">${res.votes}</span>`;
void countSpan.offsetWidth;
countSpan.style.transition = 'transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)';
}, 400);
} else {
// Downvote visual animation
countSpan.innerHTML = `<span class="ticker-item">${res.votes}</span>` + countSpan.innerHTML;
countSpan.style.transition = 'none';
countSpan.style.transform = `translateY(-1.25rem)`;
void countSpan.offsetWidth; // Force reflow
countSpan.style.transition = 'transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)';
countSpan.style.transform = 'translateY(0)';
setTimeout(() => {
countSpan.innerHTML = `<span class="ticker-item">${res.votes}</span>`;
}, 400);
}
btn.className = `flex items-center gap-1.5 px-3 py-1.5 rounded-lg transition text-sm font-semibold ${!hasVoted ? 'bg-purple-100 dark:bg-purple-900/50 text-purple-600 dark:text-purple-300' : 'bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200'}`;
} catch (e) { console.error(e); showToast('Vote failed', 'error'); }
finally { btn.disabled = false; }
};
window.copyLink = (url) => {
navigator.clipboard.writeText(url);
showToast('Link copied to clipboard!');
};
// --- REPORTING ---
window.openReport = (id, name) => {
document.getElementById('reportResourceId').value = id;
document.getElementById('reportResourceName').value = name;
document.getElementById('reportTargetName').innerText = `Reporting: ${name}`;
document.getElementById('reportModal').classList.remove('hidden');
};
document.getElementById('reportForm').addEventListener('submit', async (e) => {
e.preventDefault();
const btn = e.target.querySelector('button[type="submit"]');
btn.innerText = 'Sending...';
try {
await addDoc(collection(db, 'reports'), {
resourceId: document.getElementById('reportResourceId').value,
resourceName: document.getElementById('reportResourceName').value,
reason: document.querySelector('input[name="reportReason"]:checked').value,
reportedAt: serverTimestamp(),
status: 'open'
});
showToast('Report submitted. Thank you.');
document.getElementById('reportModal').classList.add('hidden');
e.target.reset();
} catch (err) { showToast('Error submitting report', 'error'); }
finally { btn.innerText = 'Report'; }
});
// --- SUGGESTIONS ---
document.getElementById('suggestionForm').addEventListener('submit', async (e) => {
e.preventDefault();
const btn = e.target.querySelector('button[type="submit"]');
const originalText = btn.innerText;
btn.disabled = true; btn.innerText = 'Sending...';