-
Notifications
You must be signed in to change notification settings - Fork 3
/
dashboard.html
333 lines (295 loc) · 12.5 KB
/
dashboard.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Host Dashboard| KNIT</title>
<!-- google fonts - dm sans , inter -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:[email protected]&family=Inter&display=swap" rel="stylesheet">
<!-- font-awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
<!-- page stylesheet -->
<link rel="stylesheet" href="public/css/dashboard.css">
<link rel="stylesheet" href="public/css/common.css">
</head>
<body>
<header class="header">
<div class="nav-logo-container">
<a href="#" class="nav-logo"><img src="css/assets/knit.png"></a>
<div class="vertical-line"></div>
<a href="#" class="nav-logo"><img src="css/assets/bvp_c.png"></a>
<div class="header-text">भारत विकास परिषद</div>
</div>
<div class="header-info">
<div class="left">
<p>Players : <span>00</span></p>
<p>Answered : <span>00</span></p>
</div>
<div class="line"></div>
<div class="right">
<p>Questions : <span>20</span></p>
<p>Round : <span>1/2</span></p>
</div>
</div>
</header>
<main>
<div class="rotating-image">
<img src="public/css/assets/floral-1.png" alt="">
</div>
<section class="main-display flex-section">
<div class="left-panel">
<div class="question-card">
<div class="marks-container">
<div class="circle positive">10</div>
<div class="circle negative">05</div>
</div>
<div class="que-header">
<div class="circle count">01</div>
</div>
<div class="que-body">
<div class="text">
<p class="hindi">भारत की राजधानी क्या है?</p>
<p class="english">What is the capital of India?</p>
<!-- only appears for some questions -->
<audio controls>
<source src="public/css/assets/audioSec.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<div class="image-wrapper">
<!-- only appears for some questions -->
<img src="public/css/assets/back2.jpg" alt="">
</div>
</div>
</div>
<div class="option-panel">
<div class="option">op1</div>
<div class="option">op2</div>
<div class="option">op3</div>
<div class="option">op4</div>
</div>
</div>
<div class="right-panel">
<div class="timer">
<div class="time-remaining" id="time-display">60</div>
</div>
<div class="control-strip">
<button id="view-leader"><i class="fa-solid fa-award"></i></button>
<button id="next-question">
<i class="fa-solid fa-angles-right"></i>
<i class="fa-solid fa-check" style="display: none;"></i>
</button>
<button id="view-response"><i class="fa-regular fa-eye"></i></button>
</div>
</div>
</section>
</main>
<div class="leaderboard-section">
<div class="hide-leaderboard" id="hide-leaderboard"><i class="fa-solid fa-xmark"></i></div>
<div class="leaderboard-wrapper">
<p>LEADERBOARD</p>
<div class="tab-menu">
<div class="overall active">Overall</div>
<div class="buzzer-round">Buzzer</div>
<div class="mcq-round">MCQ</div>
</div>
<div class="leaderboard-items overall-tab active">
<div class="item">
<span>01.</span>
<span>Shivam Ray</span>
<span>1080 Pts</span>
</div>
<div class="item">
<span>02.</span>
<span>Vikas Kumar</span>
<span>1060 Pts</span>
</div>
<div class="item">
<span>03.</span>
<span>Somnath</span>
<span>1040 Pts</span>
</div>
</div>
<div class="leaderboard-items buzzer-tab">
<div class="item">
<span>01.</span>
<span>Shivam Ray</span>
<span>540 Pts</span>
</div>
<div class="item">
<span>02.</span>
<span>Somnath</span>
<span>530 Pts</span>
</div>
</div>
<div class="leaderboard-items mcq-tab">
<div class="item">
<span>01.</span>
<span>Shivam Ray</span>
<span>540 Pts</span>
</div>
<div class="item">
<span>02.</span>
<span>Vikas Kumar</span>
<span>530 Pts</span>
</div>
</div>
</div>
</div>
<div class="responses-section">
<div class="hide-responses"><i class="fa-solid fa-xmark"></i></div>
<div class="wrapper">
<div class="answer"><p>Answer</p></div>
<div class="mcq-response-display ">
<p>Responses by Participants</p>
<div class="item">
<span>01</span>
<span>Shivam Ray</span>
<span><i class="fa-solid fa-circle-check"></i></span>
</div>
<div class="item">
<span>02</span>
<span>Vikas</span>
<span><i class="fa-solid fa-circle-xmark"></i></span>
</div>
<div class="item">
<span>03</span>
<span>Somnath</span>
<span><i class="fa-solid fa-circle-check"></i></span>
</div>
</div>
<div class="buzzer-response-display active">
<p>The answer from <span>Shivam</span> was:</p>
<button id="correct-buzzer"><i class="fa-solid fa-circle-check"></i></button>
<button id="incorrect-buzzer"><i class="fa-solid fa-circle-xmark"></i></button>
</div>
</div>
</div>
<div id="toast-container"></div>
<!-- java-script -->
<!-- <script src = "../socket.io/socket.io.js"></script> -->
<!-- <script src="js/common.js"></script> -->
<!-- <script src="js/index.js"></script> -->
</body>
<script>
let timerInterval;
startTimer(30)
function startTimer(duration) {
const timerElement = document.querySelector('.timer');
const timeDisplay = document.getElementById('time-display');
let timeLeft = duration;
timerInterval = setInterval(() => {
if (timeLeft <= 0) {
clearInterval(timerInterval);
timeDisplay.innerText = "0";
return;
}
timeLeft--;
const percentage = (timeLeft / duration) * 100;
// Update the timer text
timeDisplay.innerText = timeLeft;
// Update the circular border
timerElement.style.background = `conic-gradient(#00ff00 ${percentage}%, #ff0000 ${percentage}%)`;
}, 1000);
}
function stopTimer() {
clearInterval(timerInterval);
}
const timer = document.querySelector(".timer")
const mainDisplay = document.querySelector(".main-display")
const leaderboardSection = document.querySelector(".leaderboard-section")
document.getElementById("view-leader").addEventListener('click',()=>{
leaderboardSection.style.right = '10rem';
mainDisplay.style.visibility = 'hidden';
})
document.getElementById("hide-leaderboard").addEventListener('click',()=>{
leaderboardSection.style.right = '-60rem';
mainDisplay.style.visibility = 'visible';
})
//leaderboard
document.addEventListener("DOMContentLoaded", function() {
const hideBtn = document.querySelector('.hide-leaderboard');
const leaderboardSection = document.querySelector('.leaderboard-section');
const tabButtons = document.querySelectorAll('.tab-menu div');
const tabs = document.querySelectorAll('.leaderboard-items');
// Close leaderboard when 'X' is clicked
hideBtn.addEventListener('click', () => {
leaderboardSection.style.right = '-60rem'; // Hide leaderboard
});
// Function to switch between tabs
tabButtons.forEach((button, index) => {
button.addEventListener('click', () => {
// Remove active class from all buttons and tabs
tabButtons.forEach(btn => btn.classList.remove('active'));
tabs.forEach(tab => tab.classList.remove('active'));
// Add active class to clicked button and corresponding tab
button.classList.add('active');
tabs[index].classList.add('active');
});
});
const hideResponsesBtn = document.querySelector('.hide-responses');
const responsesSection = document.querySelector('.responses-section');
const mcqDisplay = document.querySelector('.mcq-response-display');
const buzzerDisplay = document.querySelector('.buzzer-response-display');
// Hide responses when 'X' is clicked
hideResponsesBtn.addEventListener('click', () => {
responsesSection.style.right = '-82rem'; // Hide responses section
mainDisplay.style.visibility = 'visible';
});
// Toggle between MCQ and Buzzer response displays
function toggleResponseDisplay(type = 'mcq') {
console.log("called")
if (type === 'mcq') {
mcqDisplay.classList.add('active');
buzzerDisplay.classList.remove('active');
} else if (type === 'buzzer') {
buzzerDisplay.classList.add('active');
mcqDisplay.classList.remove('active');
}
}
document.getElementById("view-response").addEventListener('click',()=>{
toggleResponseDisplay('mcq');
mainDisplay.style.visibility = 'hidden';
responsesSection.style.right = '10rem';
// toggleResponseDisplay('buzzer');
})
function displayQues(type = 'text'){
const text = document.querySelector(".text");
const audio = document.querySelector('audio');
const image = document.querySelector(".image-wrapper");
if(type === "text"){
audio.classList.add('hidden');
image.classList.add('hidden');
text.style.flexBasis = '100%';
text.style.width = '100%';
}else if(type === "audio"){
audio.classList.remove('hidden')
image.classList.add('hidden')
text.style.flexBasis = '100%';
text.style.width = '100%';
}else if(type === "image"){
image.classList.remove('hidden')
text.style.flexBasis = '50%';
text.style.width = '50%';
audio.classList.add('hidden')
}
}
// displayQues('text')
// displayQues('audio')
displayQues('image')
// const queBody = document.querySelector('.que-body');
// const audioElement = queBody.querySelector('audio');
// const imageElement = queBody.querySelector('img');
// // Check if audio exists
// if (audioElement && !audioElement.hasAttribute('hidden')) {
// queBody.classList.add('text-with-audio');
// }
// // Check if image exists
// if (imageElement && imageElement.getAttribute('src') !== "") {
// queBody.classList.add('text-with-image');
// }
});
</script>
</html>