-
Notifications
You must be signed in to change notification settings - Fork 226
/
RateUs.html
355 lines (312 loc) · 11.4 KB
/
RateUs.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
343
344
345
346
347
348
349
350
351
352
353
354
355
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emoji Rating App</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
@keyframes shine {
0% {
text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
50% {
text-shadow: 0 0 20px rgba(255, 255, 255, 1);
}
100% {
text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
}
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #1a1a2e;
}
.navbar {
background-color: #16213e;
/* Dark background for the navbar */
color: white;
padding: 15px 0;
position: fixed;
top: 0;
width: 100%;
display: flex;
justify-content: center;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
z-index: 1000;
}
.navbar .nav-wrapper {
display: flex;
gap: 160px;
margin-top: 7px;
}
.navbar .nav-link {
position: relative;
color: white;
text-decoration: none;
font-size: 1.4rem;
display: flex;
align-items: center;
padding: 5px;
transition: color 0.3s ease;
}
.navbar .nav-link i {
margin-right: 8px;
}
.navbar .nav-link::after {
content: "";
position: absolute;
left: 0;
bottom: -2px;
width: 0%;
height: 2px;
background-color: #007bff;
transition: width 0.4s ease;
}
.navbar .nav-link:hover {
color: #007bff;
}
.navbar .nav-link:hover::after {
width: 100%;
}
.stargaze {
top: 50%;
left: 50%;
width: 100%;
height: 100%;
z-index: -1;
pointer-events: none;
position: fixed;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.stargaze video {
width: 100%;
height: 100%;
object-fit: cover;
filter: brightness(0.5) contrast(1.2) saturate(1.5);
}
.container {
border: 2px solid #007bff;
height: auto;
padding: 20px;
text-align: center;
background-color: rgba(22, 33, 62, 0.9);
color: white;
transition: transform 0.2s, box-shadow 0.2s;
border-radius: 15px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80%;
max-width: 600px;
}
.container:hover {
transform: translate(-50%, -50%) scale(1.05);
box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
}
.emoji {
font-size: 2.5rem;
cursor: pointer;
margin: 0 15px;
transition: transform 0.2s, text-shadow 0.2s;
}
.emoji:hover {
transform: scale(3.5);
text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
.emoji.selected {
transform: scale(1.5);
animation: shine 1s infinite;
}
.textarea-container {
margin-top: 20px;
}
textarea {
width: 90%;
height: 120px;
padding: 10px;
font-size: 1rem;
border: 1px solid #007bff;
border-radius: 5px;
background-color: #1a1a2e;
color: white;
}
.email-container {
margin: 20px 0;
padding: 4px;
}
.email-container input {
width: 90%;
padding: 10px;
font-size: 1rem;
border: 1px solid #007bff;
border-radius: 5px;
background-color: #1a1a2e;
color: white;
}
.submit-button {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: 2px solid transparent;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.4s ease;
}
.submit-button:hover {
background-color: #0056b3;
transform: scale(1.1);
box-shadow: 0px 4px 15px rgba(0, 123, 255, 0.4);
border-color: #00aaff;
}
.submit-button:active {
transform: scale(1);
box-shadow: none;
}
</style>
</head>
<body>
<div class="navbar">
<div class="nav-wrapper">
<a id="aid" class="nav-link" href="./index.html">
<i class="fas fa-home"></i> Home
</a>
<a id="aid" class="nav-link" href="./about.html">
<i class="fas fa-info-circle"></i> About
</a>
<a id="aid" class="nav-link" href="./contact.html">
<i class="fas fa-envelope"></i> Contact
</a>
<a id="aid" class="nav-link" href="RateUs.html">
<i class="fas fa-star"></i> Rate Us
</a>
<a id="aid" class="nav-link" href="./contributor.html">
<i class="fas fa-users"></i> Contributors
</a>
</div>
</div>
<div class="stargaze">
<video autoplay loop muted playsinline>
<source src="./assets/main.webm" type="video/webm">
<p>Your browser does not support HTML5 video.</p>
</video>
</div>
<div class="container">
<div class="emojis">
<span class="emoji" role="img" aria-label="cry">😢</span>
<span class="emoji" role="img" aria-label="neutral">😐</span>
<span class=" emoji" role="img" aria-label="smile">😊</span>
<span class="emoji" role="img" aria-label="laugh">😂</span>
<span class="emoji" role="img" aria-label="super">😎</span>
</div>
<div class="textarea-container">
<textarea placeholder="Leave your feedback here..."></textarea>
</div>
<div class="email-container">
<input type="email" placeholder="Enter your email" id="email-input" required>
</div>
<button class="submit-button">Submit</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
<script>
let feedbackSubmitted = false;
document.querySelectorAll('.emoji').forEach(emoji => {
emoji.addEventListener('click', () => {
if (feedbackSubmitted) {
// Allow selecting an emoji again even if feedback was submitted
document.querySelectorAll('.emoji').forEach(e => e.classList.remove('selected'));
emoji.classList.add('selected');
} else {
document.querySelectorAll('.emoji').forEach(e => e.classList.remove('selected'));
emoji.classList.add('selected');
}
});
});
document.querySelector('.submit-button').addEventListener('click', async () => {
const selectedEmoji = document.querySelector('.emoji.selected');
const feedback = document.querySelector('textarea').value;
const email = document.querySelector('#email-input').value.trim(); // Get the email input value
if (feedbackSubmitted) {
Toastify({
text: "Review already submitted.",
backgroundColor: "orange",
gravity: "top",
position: "center",
duration: 3000
}).showToast();
// Clear textarea and stop emoji blinking on resubmit attempt
document.querySelector('textarea').value = '';
document.querySelector('#email-input').value = ''; // Clear email input
if (selectedEmoji) {
selectedEmoji.classList.remove('selected');
}
return;
}
if (selectedEmoji && feedback.trim() !== '' && email) {
try {
const result = await fetch("http://localhost:3000/rate-us", {
method: "POST",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
emoji: selectedEmoji.innerHTML, // Get the selected emoji
feedback: feedback,
email: email // Include email in the body
}),
});
const res = await result.json();
if (res.success) {
Toastify({
text: "Feedback submitted successfully!",
backgroundColor: "green",
gravity: "top",
position: "center",
duration: 3000
}).showToast();
// Clear the textarea and email input
document.querySelector('textarea').value = '';
document.querySelector('#email-input').value = '';
// Remove the 'selected' class from the emoji to stop blinking
selectedEmoji.classList.remove('selected');
// Mark feedback as submitted
feedbackSubmitted = true;
} else {
Toastify({
text: "Failed to submit feedback. Please try again.",
backgroundColor: "red",
gravity: "top",
position: "center",
duration: 3000
}).showToast();
}
} catch (e) {
Toastify({
text: "Server error",
backgroundColor: "red",
gravity: "top",
position: "center",
duration: 3000
}).showToast();
}
} else {
Toastify({
text: "Please select an emoji, provide feedback, and enter your email.",
backgroundColor: "red",
gravity: "top",
position: "center",
duration: 3000
}).showToast();
}
});
</script>
</body>
</html>