-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
2311 lines (2009 loc) · 105 KB
/
dashboard.html
File metadata and controls
2311 lines (2009 loc) · 105 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">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unlock the Lab - Live Dashboard</title>
<link rel="icon" type="image/x-icon" href="img/favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.container {
max-width: 1400px;
margin: 0 auto;
}
header {
background: white;
border-radius: 12px;
padding: 20px 30px 12px;
margin-bottom: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
header h1 {
background: linear-gradient(135deg, #20B2AA 0%, #48d1cc 30%, #ff9a56 70%, #ff6b35 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
text-shadow: none;
font-size: 2rem;
display: flex;
align-items: center;
gap: 0.3rem;
line-height: 1;
}
.dashboard-logo {
height: 2rem;
flex-shrink: 0;
margin-bottom: 0.3rem;
cursor: pointer;
animation: logoShake 2s ease-in-out infinite;
transform-origin: center;
}
.dashboard-logo.shake-intense {
animation: logoShakeIntense 0.3s ease-in-out infinite;
}
.dashboard-logo.flipping {
animation: logoFlipWithShake 4s ease-in-out forwards;
}
@keyframes logoShake {
0% { transform: rotate(0deg); }
12.5% { transform: rotate(-4deg); }
25% { transform: rotate(-8deg); }
37.5% { transform: rotate(-4deg); }
50% { transform: rotate(0deg); }
62.5% { transform: rotate(4deg); }
75% { transform: rotate(8deg); }
87.5% { transform: rotate(4deg); }
100% { transform: rotate(0deg); }
}
@keyframes logoShakeIntense {
0%, 100% { transform: rotate(0deg); }
25% { transform: rotate(-15deg); }
75% { transform: rotate(15deg); }
}
@keyframes logoFlipWithShake {
0% { transform: rotate(0deg); }
2% { transform: rotate(-15deg); }
4% { transform: rotate(15deg); }
6% { transform: rotate(-12deg); }
8% { transform: rotate(12deg); }
10% { transform: rotate(-8deg); }
12% { transform: rotate(8deg); }
15% { transform: rotate(180deg); }
85% { transform: rotate(180deg); }
100% { transform: rotate(360deg); }
}
.droplet-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 9999;
overflow: hidden;
}
.droplet {
position: absolute;
background: radial-gradient(ellipse at 50% 30%, #ffaa33 0%, #ff8c42 40%, #ff6b35 70%, #cc5528 100%);
border-radius: 50%;
opacity: 0;
box-shadow:
0 2px 6px rgba(255, 107, 53, 0.5),
0 4px 12px rgba(255, 107, 53, 0.3),
inset 0 -2px 4px rgba(0, 0, 0, 0.2),
inset 0 2px 4px rgba(255, 200, 100, 0.3);
animation: dropletDrop 3s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
@keyframes dropletDrop {
0% {
opacity: 0;
transform: translateY(0) scale(0.5);
}
5% {
opacity: 0.9;
transform: translateY(10px) scale(1);
}
15% {
transform: translateY(30px) scale(2);
}
40% {
transform: translateY(50vh) scale(4);
}
70% {
transform: translateY(80vh) scale(6);
}
100% {
opacity: 0.3;
transform: translateY(120vh) scale(8);
}
}
.droplet-star {
background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffaa00 100%);
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
border-radius: 0;
box-shadow:
0 0 10px rgba(255, 215, 0, 0.8),
0 0 20px rgba(255, 215, 0, 0.5),
0 2px 6px rgba(255, 170, 0, 0.5);
}
.droplet-heart {
background: linear-gradient(135deg, #ff69b4 0%, #ff1493 50%, #c71585 100%);
border-radius: 0;
box-shadow:
0 0 8px rgba(255, 105, 180, 0.6),
0 2px 6px rgba(255, 20, 147, 0.4);
}
.droplet-heart::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: inherit;
border-radius: 50% 50% 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.droplet-heart::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: inherit;
border-radius: 50% 50% 0 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
.droplet-sparkle {
background: radial-gradient(circle, #ffffff 0%, #add8e6 40%, #4bb3e3 100%);
border-radius: 50%;
box-shadow:
0 0 15px rgba(255, 255, 255, 1),
0 0 30px rgba(173, 216, 230, 0.8),
0 0 45px rgba(75, 179, 227, 0.6);
}
.droplet-bubble {
background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9) 0%, rgba(173, 216, 230, 0.6) 50%, rgba(135, 206, 235, 0.3) 100%);
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.5);
box-shadow:
inset 0 -10px 20px rgba(135, 206, 235, 0.3),
inset 0 10px 20px rgba(255, 255, 255, 0.5),
0 0 10px rgba(173, 216, 230, 0.4);
}
@keyframes dropletRefill {
0% {
opacity: 0;
transform: translateY(0) scale(2.5);
}
8% {
opacity: 0.95;
transform: translateY(calc(var(--travel-distance) * 0.15)) scale(2);
}
25% {
opacity: 1;
transform: translateY(calc(var(--travel-distance) * 0.4)) scale(1.2);
}
50% {
opacity: 0.9;
transform: translateY(calc(var(--travel-distance) * 0.65)) scale(0.6);
}
75% {
opacity: 0.6;
transform: translateY(calc(var(--travel-distance) * 0.85)) scale(0.25);
}
90% {
opacity: 0.3;
transform: translateY(calc(var(--travel-distance) * 0.95)) scale(0.1);
}
100% {
opacity: 0;
transform: translateY(var(--travel-distance)) scale(0.05);
}
}
.droplet-refill {
animation: dropletRefill 1.1s cubic-bezier(0.25, 0, 0.1, 1) forwards;
}
h1 {
color: #20B2AA;
font-size: 2rem;
margin-bottom: 4px;
}
.status {
display: flex;
align-items: center;
gap: 10px;
color: #666;
font-size: 0.9rem;
}
.status-indicator {
width: 10px;
height: 10px;
border-radius: 50%;
background: #10b981;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.stat-card {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.stat-value {
font-size: 2.5rem;
font-weight: bold;
color: #20B2AA;
}
.stat-label {
color: #666;
font-size: 0.9rem;
margin-top: 5px;
}
.charts-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.chart-card {
background: white;
border-radius: 12px;
padding: 25px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.chart-card h2 {
color: #20B2AA;
font-size: 1.3rem;
margin-bottom: 20px;
}
.chart-container {
position: relative;
height: 400px;
cursor: pointer;
}
.data-table {
background: white;
border-radius: 12px;
padding: 25px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #e5e7eb;
}
th {
background: #f9fafb;
color: #20B2AA;
font-weight: 600;
cursor: pointer;
user-select: none;
position: relative;
padding-right: 25px;
}
th:hover {
background: #f3f4f6;
}
th.sortable::after {
content: '⇅';
position: absolute;
right: 8px;
color: #9ca3af;
font-size: 0.8em;
}
th.sort-asc::after {
content: '↑';
color: #20B2AA;
}
th.sort-desc::after {
content: '↓';
color: #20B2AA;
}
tbody tr:hover {
background: #f9fafb;
}
/* Color scale cells */
.color-scale {
font-weight: 600;
border-radius: 4px;
padding: 6px 12px !important;
}
.quality-indicator {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 8px;
}
.quality-high { background: #10b981; }
.quality-medium { background: #f59e0b; }
.quality-low { background: #ef4444; }
.admin-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.8);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
}
.admin-overlay.active {
display: flex;
}
.admin-panel {
background: white;
border-radius: 12px;
padding: 30px;
max-width: 400px;
width: 90%;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.admin-panel h3 {
color: #20B2AA;
margin-bottom: 20px;
font-size: 1.5rem;
}
.admin-input {
width: 100%;
padding: 12px;
border: 2px solid #e5e7eb;
border-radius: 8px;
font-size: 16px;
margin-bottom: 15px;
}
.admin-input:focus {
outline: none;
border-color: #20B2AA;
}
.admin-timer {
text-align: center;
color: #666;
font-size: 0.9rem;
margin-bottom: 15px;
}
.admin-timer.warning {
color: #ef4444;
font-weight: bold;
}
.admin-buttons {
display: flex;
gap: 10px;
}
.admin-buttons button {
flex: 1;
padding: 12px;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
}
.btn-cancel {
background: #e5e7eb;
color: #666;
}
.btn-cancel:hover {
background: #d1d5db;
}
.btn-submit {
background: #667eea;
color: white;
}
.btn-submit:hover {
background: #5568d3;
}
.admin-actions {
margin-top: 20px;
}
.btn-danger {
width: 100%;
padding: 15px;
background: #ef4444;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.btn-danger:hover {
background: #dc2626;
}
.btn-danger:disabled {
background: #d1d5db;
cursor: not-allowed;
}
@media (max-width: 768px) {
body {
padding: 12px 8px;
}
header {
padding: 16px 14px 10px;
}
.stat-card,
.chart-card,
.data-table {
padding: 16px 12px;
}
.section-panel {
padding: 1.25rem 0.875rem !important;
}
#results-access-section {
padding: 16px 12px !important;
}
.charts-grid {
grid-template-columns: 1fr;
}
h1 {
font-size: 1.5rem;
}
#leaderboardGrid {
grid-template-columns: repeat(2, 1fr) !important;
}
}
@media (max-width: 480px) {
body {
padding: 8px 4px;
}
header {
padding: 12px 10px 8px;
}
.stat-card,
.chart-card,
.data-table {
padding: 12px 8px;
}
.section-panel {
padding: 1rem 0.625rem !important;
}
#results-access-section {
padding: 12px 8px !important;
}
#leaderboardGrid {
grid-template-columns: 1fr !important;
}
}
/* Study Details Modal */
.study-modal {
display: none;
position: fixed;
z-index: 2000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
align-items: center;
justify-content: center;
}
.study-modal.active {
display: flex;
}
.study-modal-content {
background: white;
border-radius: 12px;
padding: 2rem;
max-width: 600px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.study-modal-close {
float: right;
font-size: 2rem;
font-weight: bold;
color: #9ca3af;
cursor: pointer;
line-height: 1;
}
.study-modal-close:hover {
color: #374151;
}
.leaderboard-tab:hover {
color: #20B2AA !important;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1><img id="dashboard-logo" src="unlock-lab-icon.svg" alt="Unlock the Lab" class="dashboard-logo"> Unlock the Lab - Live Dashboard</h1>
</header>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value" id="avgScore">0</div>
<div class="stat-label">Average Score</div>
<p style="font-size: 0.75rem; color: #9ca3af; margin-top: 0.5rem;">Mean prediction accuracy score across all participants</p>
</div>
<div class="stat-card">
<div class="stat-value" id="totalRatings">0</div>
<div class="stat-label">Total Ratings</div>
<p style="font-size: 0.75rem; color: #9ca3af; margin-top: 0.5rem;">Number of study ratings submitted by all participants</p>
</div>
<div class="stat-card">
<div class="stat-value" id="uniqueParticipants">0</div>
<div class="stat-label">Participants</div>
<p style="font-size: 0.75rem; color: #9ca3af; margin-top: 0.5rem;">Total number of different users who have submitted ratings</p>
</div>
<div class="stat-card">
<div class="stat-value" id="activeParticipants">0</div>
<div class="stat-label">Active Now</div>
<p style="font-size: 0.75rem; color: #9ca3af; margin-top: 0.5rem;">Users currently rating studies (active in last 60 seconds)</p>
</div>
</div>
<!-- Review Your Results Section -->
<div id="results-access-section" class="stat-card" style="margin-bottom: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 25px; text-shadow: 0 1px 3px rgba(0,0,0,0.3);">
<h2 style="color: white; margin-bottom: 15px; font-weight: 600;">📊 Review Your Results</h2>
<p style="margin-bottom: 15px; font-size: 0.95rem; font-weight: 400;">Completed the workshop? Enter your username below to view your personalised results page.</p>
<div id="results-link-display" style="display: none; padding: 15px; background: rgba(255,255,255,0.2); border-radius: 8px; margin-bottom: 10px;">
<p style="margin-bottom: 10px; font-size: 0.9rem;">Your session was detected!</p>
<button onclick="goToMyResults()" style="padding: 12px 24px; background: white; color: #667eea; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s;">
🔍 View my results
</button>
</div>
<div id="results-manual-entry">
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
<input type="text" id="sessionLinkInput" placeholder="Enter your username..." style="flex: 1; min-width: 250px; max-width: 400px; padding: 12px; border: 2px solid rgba(255,255,255,0.3); border-radius: 8px; font-size: 0.95rem; background: rgba(255,255,255,0.9);">
<button onclick="loadFromLink()" style="padding: 12px 24px; background: white; color: #667eea; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s; white-space: nowrap;">
🔍 View my results
</button>
</div>
<p id="link-error" style="display: none; color: #fecaca; font-size: 0.85rem; margin-top: 10px;">⚠️ Please enter a valid username.</p>
</div>
</div>
<!-- SECTION 1: PREDICTION PERFORMANCE -->
<div class="section-panel" style="margin-bottom: 2rem; padding: 1.5rem; background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-radius: 12px; color: white;">
<h2 style="margin-top: 0; color: white; font-size: 1.8rem; border-bottom: 2px solid rgba(255,255,255,0.3); padding-bottom: 0.75rem;">
🎯 Part 1: Prediction Performance
</h2>
<p style="font-size: 1rem; margin-bottom: 0; opacity: 0.95;">
How well did participants predict what others would rate each study?
</p>
</div>
<!-- Leaderboard Section -->
<div class="data-table" style="margin-bottom: 40px;">
<h2 style="color: #059669; margin-bottom: 10px;">🏆 Top Predictors</h2>
<p style="font-size: 0.85rem; color: #6b7280; margin-bottom: 15px;">Top performers ranked by prediction accuracy. Scores show how well participants predicted crowd ratings. The leaderboard includes all participants who have submitted at least one rating. <strong>Click any entry to view that participant's personalised results page.</strong></p>
<!-- Leaderboard Tabs -->
<div style="display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #e5e7eb;">
<button id="tabAllTime" class="leaderboard-tab active" onclick="switchLeaderboardTab('allTime')" style="padding: 10px 20px; border: none; background: none; color: #059669; font-weight: bold; cursor: pointer; border-bottom: 3px solid #059669; transition: all 0.2s;">
🌟 All-time leaders
</button>
<button id="tab24h" class="leaderboard-tab" onclick="switchLeaderboardTab('24h')" style="padding: 10px 20px; border: none; background: none; color: #6b7280; font-weight: normal; cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s;">
📅 Past 24 hours
</button>
</div>
<div id="leaderboardGrid" style="display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;">
<div style="text-align: center; color: #999; grid-column: 1 / -1;">Loading leaderboard...</div>
</div>
</div>
<!-- SECTION 1b: CRITERION IMPORTANCE -->
<div class="data-table" style="margin-bottom: 40px;">
<h2 id="criterion-importance-heading" style="color: #d97706; margin-bottom: 10px;">⚖️ Criterion Importance</h2>
<p style="font-size: 0.85rem; color: #6b7280; margin-bottom: 20px;">Average percentage of tokens assigned to each criterion by participants, reflecting what they considered most important when evaluating study quality. Error bars show 95% confidence intervals for the mean percentage across participants. <span id="criterion-importance-count"></span></p>
<div id="criterion-importance-container">
<p style="text-align: center; color: #999; padding: 2rem 0;">No data yet.</p>
</div>
</div>
<!-- SECTION 2: RATING PATTERNS -->
<div class="section-panel" style="margin-bottom: 2rem; padding: 1.5rem; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 12px; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.3);">
<h2 style="margin-top: 0; color: white; font-size: 1.8rem; border-bottom: 2px solid rgba(255,255,255,0.3); padding-bottom: 0.75rem; font-weight: 600;">
📊 Part 2: Rating Patterns
</h2>
<p style="font-size: 1rem; margin-bottom: 0; opacity: 0.95; font-weight: 400;">
How did participants actually rate the quality of each study?
</p>
</div>
<div class="charts-grid">
<div class="chart-card" style="grid-column: 1 / -1;">
<h2 id="ratings-chart-heading">📊 Average Quality Ratings by Study</h2>
<p id="ratings-chart-desc" style="font-size: 0.85rem; color: #6b7280; margin-bottom: 1rem;">Mean quality rating (1-7 scale) with 95% confidence intervals. Error bars show rating variability—wider bars indicate less agreement among participants. All participants with at least one valid rating are included. The leaderboard shows the subset who completed the full workshop. <strong>Click on any bar to view detailed statistics and study information.</strong></p>
<div class="chart-container">
<canvas id="ratingsChart"></canvas>
</div>
</div>
</div>
<div class="data-table">
<h2 style="color: #20B2AA; margin-bottom: 10px;">📈 Detailed Rating Statistics</h2>
<p style="font-size: 0.85rem; color: #6b7280; margin-bottom: 20px;">Complete breakdown of how participants rated each study's quality. Std Dev measures disagreement (higher = more variable ratings). Agreement % shows consensus level. Color scales highlight relative values. <strong>Click study names to view detailed information.</strong> Click column headers to sort.</p>
<table id="statsTable">
<thead>
<tr>
<th class="sortable" onclick="sortTable(0, 'string')" title="Click to sort">Study</th>
<th class="sortable" onclick="sortTable(1, 'string')" title="Click to sort">Quality</th>
<th class="sortable" onclick="sortTable(2, 'number')" title="Click to sort">Responses</th>
<th class="sortable" onclick="sortTable(3, 'number')" title="Click to sort">Mean Rating</th>
<th class="sortable" onclick="sortTable(4, 'number')" title="Click to sort">Std Dev</th>
<th class="sortable" onclick="sortTable(5, 'number')" title="Click to sort">Min</th>
<th class="sortable" onclick="sortTable(6, 'number')" title="Click to sort">Max</th>
<th class="sortable" onclick="sortTable(7, 'number')" title="Click to sort">Agreement %</th>
</tr>
</thead>
<tbody id="statsTableBody">
<tr><td colspan="8" style="text-align: center; color: #999;">Loading data...</td></tr>
</tbody>
</table>
</div>
</div>
<!-- Study Details Modal -->
<div class="study-modal" id="studyModal" onclick="closeStudyModal()">
<div class="study-modal-content" onclick="event.stopPropagation()">
<span class="study-modal-close" onclick="closeStudyModal()">×</span>
<div id="studyDetailsContent">
<h2 id="studyTitle"></h2>
<p id="studyQuality"></p>
<div id="studyStats"></div>
</div>
</div>
</div>
<!-- Authorship & Project Info -->
<div style="max-width: 1400px; margin: 2rem auto 0; padding: 1.25rem; background: #f8fafc; border-radius: 8px; font-size: 0.9rem; color: #64748b;">
<p style="margin-bottom: 0.5rem;"><strong>Author:</strong> Dr Pablo Bernabeu, Department of Education, University of Oxford</p>
<p style="margin-bottom: 0.5rem; font-size: 0.85rem; color: #64748b;"><strong>Legal disclaimer:</strong> This app and workshop were created by Dr Pablo Bernabeu in a personal capacity during spare time. The employer is not affiliated with, does not endorse, and bears no liability for this app or workshop.</p>
<p style="margin-bottom: 0.5rem;"><strong>Materials:</strong> <a href="https://github.com/pablobernabeu/Unlock_the_Lab" target="_blank" rel="noopener noreferrer" style="color: #2563eb; text-decoration: none; border-bottom: 1px solid #2563eb;">github.com/pablobernabeu/Unlock_the_Lab</a></p>
<p style="margin-bottom: 0.5rem;"><strong>Licence:</strong> <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer" style="color: #2563eb; text-decoration: none;">CC BY 4.0</a> — Free to use with attribution</p>
<p style="margin-bottom: 0; font-size: 0.85rem; font-style: italic;">💡 Contributions welcome! Suggest improvements or report issues on <a href="https://github.com/pablobernabeu/Unlock_the_Lab/issues" target="_blank" rel="noopener noreferrer" style="color: #2563eb; text-decoration: none; border-bottom: 1px solid #2563eb;">GitHub</a>.</p>
</div>
<!-- Admin Link -->
<p style="max-width: 1400px; margin: 2rem auto; padding-right: 20px; text-align: right; font-size: 0.8rem;"><a href="#" onclick="openAdminPanel(); return false;" style="color: #94a3b8; text-decoration: none; cursor: pointer;">Admin</a></p>
<!-- Admin Overlay -->
<div class="admin-overlay" id="adminOverlay" onclick="closeAdminPanel(event)">
<div class="admin-panel" onclick="event.stopPropagation()">
<h3 id="adminTitle">🔐 Admin Access</h3>
<div id="passwordSection">
<input
type="email"
id="adminEmail"
class="admin-input"
placeholder="Admin email"
onkeypress="handlePasswordKeyPress(event)"
autofocus
>
<input
type="password"
id="adminPassword"
class="admin-input"
placeholder="Password"
onkeypress="handlePasswordKeyPress(event)"
>
<div class="admin-timer" id="adminTimer">Time remaining: 10s</div>
<div class="admin-buttons">
<button class="btn-cancel" onclick="closeAdminPanel()">Cancel</button>
<button class="btn-submit" onclick="verifyPassword()" id="loginBtn">Sign in</button>
</div>
</div>
<div id="adminActions" style="display: none;">
<p style="color: #666; margin-bottom: 15px;" id="adminEmail"></p>
<!-- Firebase Usage Statistics (Admin Only) -->
<div style="margin-bottom: 20px; padding: 15px; background: #f8fafc; border: 2px solid #e5e7eb; border-radius: 8px;">
<h4 style="color: #20B2AA; margin-bottom: 12px; font-size: 1rem;">📊 Firebase Usage (Free Tier Limits)</h4>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;">
<div style="padding: 12px; background: white; border-radius: 6px; border-left: 4px solid #20B2AA;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-weight: 600; color: #374151; font-size: 0.85rem;">Connections</span>
<span id="connectionUsage" style="font-size: 1.1rem; font-weight: bold; color: #10b981;">0/100</span>
</div>
<div style="height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;">
<div id="connectionBar" style="height: 100%; background: #10b981; width: 0%; transition: all 0.3s;"></div>
</div>
<p style="font-size: 0.7rem; color: #6b7280; margin-top: 6px; margin-bottom: 0;">Active in last 60s</p>
</div>
<div style="padding: 12px; background: white; border-radius: 6px; border-left: 4px solid #3b82f6;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-weight: 600; color: #374151; font-size: 0.85rem;">Storage</span>
<span id="storageUsage" style="font-size: 1.1rem; font-weight: bold; color: #10b981;">~0 MB</span>
</div>
<div style="height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;">
<div id="storageBar" style="height: 100%; background: #10b981; width: 0%; transition: all 0.3s;"></div>
</div>
<p style="font-size: 0.7rem; color: #6b7280; margin-top: 6px; margin-bottom: 0;">1 GB limit</p>
</div>
<div style="padding: 12px; background: white; border-radius: 6px; border-left: 4px solid #f59e0b;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-weight: 600; color: #374151; font-size: 0.85rem;">Sessions</span>
<span id="sessionCount" style="font-size: 1.1rem; font-weight: bold; color: #20B2AA;">0</span>
</div>
<p style="font-size: 0.7rem; color: #6b7280; margin-top: 6px; margin-bottom: 0;">Completed</p>
</div>
</div>
<p style="font-size: 0.75rem; color: #64748b; margin-top: 12px; margin-bottom: 0;"><strong>Note:</strong> Free tier: 100 connections, 1 GB storage, 10 GB/month downloads.</p>
</div>
<div class="admin-actions">
<button class="btn-danger" onclick="endAllSessions()" id="endSessionsBtn">
⏹️ End all active sessions
</button>
<button class="btn-danger" onclick="deleteAllRatingsData()" id="deleteDataBtn" style="margin-top: 10px;">
🗑️ Delete all ratings data
</button>
</div>
<div class="admin-buttons" style="margin-top: 15px;">
<button class="btn-cancel" onclick="adminSignOut()" style="background: #ef4444; color: white;">Sign out</button>
<button class="btn-cancel" onclick="closeAdminPanel()">Close</button>
</div>
</div>
</div>
</div>
<script type="module">
import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js';
import { getDatabase, ref, onValue, set, remove, get } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-database.js';
import { getAuth, signInWithEmailAndPassword, onAuthStateChanged, signOut } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js';
const firebaseConfig = {
apiKey: "AIzaSyCjLzq8QNQqhGOpTJy3tzwuQrovMm6Vdi4",
authDomain: "unlock-the-lab-workshop.firebaseapp.com",
databaseURL: "https://unlock-the-lab-workshop-default-rtdb.europe-west1.firebasedatabase.app",
projectId: "unlock-the-lab-workshop",
storageBucket: "unlock-the-lab-workshop.firebasestorage.app",
messagingSenderId: "604889899913",
appId: "1:604889899913:web:d46afe88111e8bcb7d3758",
measurementId: "G-VEVYY65K1M"
};
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
const auth = getAuth(app);
// Load papers data for study details
let papersData = {};
fetch('papers.json')
.then(response => response.json())
.then(papers => {
papers.forEach(paper => {
papersData[paper.id] = paper;
});
})
.catch(error => console.error('Error loading papers:', error));
const paperIds = ['STUDY-1', 'STUDY-2', 'STUDY-3', 'STUDY-4', 'STUDY-5', 'STUDY-6',
'STUDY-7', 'STUDY-8', 'STUDY-9', 'STUDY-10', 'STUDY-11', 'STUDY-12',
'STUDY-13', 'STUDY-14', 'STUDY-15', 'STUDY-16', 'STUDY-17', 'STUDY-18',
'STUDY-19', 'STUDY-20', 'STUDY-21', 'STUDY-22', 'STUDY-23', 'STUDY-24',
'STUDY-25', 'STUDY-26', 'STUDY-27', 'STUDY-28', 'STUDY-29', 'STUDY-30',
'STUDY-31', 'STUDY-32', 'STUDY-33', 'STUDY-34', 'STUDY-35', 'STUDY-36',
'STUDY-37', 'STUDY-38', 'STUDY-39', 'STUDY-40', 'STUDY-41', 'STUDY-42',
'STUDY-43', 'STUDY-44', 'STUDY-45', 'STUDY-46', 'STUDY-47', 'STUDY-48'];
const paperQualities = {
'STUDY-1': 'low', 'STUDY-2': 'high', 'STUDY-3': 'medium', 'STUDY-4': 'low',
'STUDY-5': 'medium', 'STUDY-6': 'medium', 'STUDY-7': 'low', 'STUDY-8': 'high',
'STUDY-9': 'medium', 'STUDY-10': 'high', 'STUDY-11': 'low', 'STUDY-12': 'medium',
'STUDY-13': 'medium', 'STUDY-14': 'medium', 'STUDY-15': 'medium', 'STUDY-16': 'medium',
'STUDY-17': 'medium', 'STUDY-18': 'medium', 'STUDY-19': 'high', 'STUDY-20': 'low',
'STUDY-21': 'medium', 'STUDY-22': 'high', 'STUDY-23': 'medium', 'STUDY-24': 'high',
'STUDY-25': 'medium', 'STUDY-26': 'medium', 'STUDY-27': 'medium', 'STUDY-28': 'low',
'STUDY-29': 'low', 'STUDY-30': 'medium', 'STUDY-31': 'high', 'STUDY-32': 'low',
'STUDY-33': 'high', 'STUDY-34': 'low', 'STUDY-35': 'medium', 'STUDY-36': 'low',
'STUDY-37': 'high', 'STUDY-38': 'low', 'STUDY-39': 'high', 'STUDY-40': 'low',
'STUDY-41': 'high', 'STUDY-42': 'low', 'STUDY-43': 'high', 'STUDY-44': 'medium',
'STUDY-45': 'medium', 'STUDY-46': 'low', 'STUDY-47': 'high', 'STUDY-48': 'medium'
};
// Seed scores (vetted expert ratings) - weighted as 100 participants each
// Distribution: ~7 papers per quality score (1-7) for balanced assessment
const seedScores = {
// Score 1 (Predatory/Pseudoscience) - 7 papers
'STUDY-1': 1, 'STUDY-4': 1, 'STUDY-29': 1, 'STUDY-32': 1, 'STUDY-34': 1, 'STUDY-40': 1, 'STUDY-46': 1,
// Score 2 (Marketing/Severe Conflicts) - 7 papers
'STUDY-7': 2, 'STUDY-11': 2, 'STUDY-20': 2, 'STUDY-28': 2, 'STUDY-36': 2, 'STUDY-38': 2, 'STUDY-42': 2,
// Score 3 (Weak but Legitimate) - 7 papers
'STUDY-9': 3, 'STUDY-12': 3, 'STUDY-15': 3, 'STUDY-17': 3, 'STUDY-23': 3, 'STUDY-25': 3, 'STUDY-44': 3,
// Score 4 (Decent but Limited) - 8 papers
'STUDY-6': 4, 'STUDY-14': 4, 'STUDY-18': 4, 'STUDY-26': 4, 'STUDY-27': 4, 'STUDY-30': 4, 'STUDY-35': 4, 'STUDY-48': 4,
// Score 5 (Good Methods with Limitations) - 6 papers
'STUDY-3': 5, 'STUDY-5': 5, 'STUDY-13': 5, 'STUDY-16': 5, 'STUDY-21': 5, 'STUDY-45': 5,
// Score 6 (Rigorous, Top Journals) - 7 papers
'STUDY-2': 6, 'STUDY-10': 6, 'STUDY-22': 6, 'STUDY-31': 6, 'STUDY-33': 6, 'STUDY-37': 6, 'STUDY-41': 6,
// Score 7 (Gold Standard) - 6 papers
'STUDY-8': 7, 'STUDY-19': 7, 'STUDY-24': 7, 'STUDY-39': 7, 'STUDY-43': 7, 'STUDY-47': 7
};
const seedWeight = 100;
// Check if user has a session ID from completing the workshop
const userSessionId = localStorage.getItem('sessionId');
if (userSessionId) {
// Show the auto-detected session UI
document.getElementById('results-link-display').style.display = 'block';
document.getElementById('results-manual-entry').style.display = 'none';
}
function setupDashboardLogoAnimation() {
const dashboardLogo = document.getElementById('dashboard-logo');
if (!dashboardLogo) return;
let isAnimating = false;
let hoverTimer = null;
const dropTypes = ['droplet', 'droplet-star', 'droplet-heart', 'droplet-sparkle', 'droplet-bubble'];
dashboardLogo.addEventListener('mouseenter', () => {
if (isAnimating) return;
hoverTimer = setTimeout(() => {
startLogoDropAnimation();
}, 900);
});
dashboardLogo.addEventListener('mouseleave', () => {
if (hoverTimer) {
clearTimeout(hoverTimer);
hoverTimer = null;
}
});
dashboardLogo.addEventListener('click', (event) => {
if (isAnimating) return;
event.preventDefault();
if (hoverTimer) {
clearTimeout(hoverTimer);
hoverTimer = null;
}
startLogoDropAnimation();
});
dashboardLogo.addEventListener('touchstart', (event) => {
if (isAnimating) return;
event.preventDefault();
startLogoDropAnimation();
}, { passive: false });
setInterval(() => {
if (!isAnimating) {
dashboardLogo.classList.add('shake-intense');
setTimeout(() => {
dashboardLogo.classList.remove('shake-intense');
}, 2000);
}
}, 8000);
function startLogoDropAnimation() {
if (isAnimating) return;
isAnimating = true;
dashboardLogo.classList.add('flipping');
const originalSrc = dashboardLogo.src;
const invertedSrc = originalSrc.replace('unlock-lab-icon.svg', 'unlock-lab-icon-inverted.svg');
setTimeout(() => {
dashboardLogo.src = invertedSrc;
}, 600);
setTimeout(() => {