-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
206 lines (177 loc) · 8.58 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Computing Club Feedback</title>
<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=Karla:wght@400;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/4467197cc4.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="left">
<div id="container">
<p id="segment-header">We'd love to hear from you.</p>
<p id="segment-msg">Feel free to tell us about anything on your mind. <br id="line-break"> We're here for you!</p>
<div id="emotions">
<p id="question">How are we doing so far?</p>
<div id="faces">
<p id="sad-face-btn"><i class="far fa-sad-tear"></i></p>
<p id="meh-face-btn"><i class="far fa-meh"></i></p>
<p id="blank-face-btn"><i class="far fa-meh-blank"></i></p>
<p id="smile-face-btn"><i class="far fa-smile"></i></p>
<p id="grin-face-btn"><i class="far fa-grin-beam"></i></p>
</div>
</div>
<br>
<select id="category">
<option selected disabled value="">Pick a topic</option>
<option value="sugg-fb">Suggestions and Feedback</option>
<option value="gen-queries">General Queries</option>
<option value="gen-requests">General Requests</option>
<option value="acads">Academics</option>
<option value="merch">Merchandise and SOC Store</option>
<option value="events">Events</option>
<option value="elections-recruitment">Elections and Recruitment</option>
<option value="others">Others</option>
</select>
<br>
<textarea placeholder="Hey, ComClub! I want a ..." id="feedback-msg"></textarea>
<br>
<input type="email" placeholder="Email (optional)" id="email">
<br>
<p id="pdpa-msg" style="color: #A8B7C3; padding: 5px 0 5px 0;">This form is PDPA compliant.</p>
<button id="submit-fb">SEND MESSAGE</button>
<p id="ty-header">Thank you!</p>
<p id="ty-subheader">
Your feedback has been duly noted and
sent to the respective wings. <br><br>
The committee will look into it and
reach out to you if needed :)
<br>
<br>
~ 24th Management Committee, ComClub
<br>
<p id="socials" style="width: 200px; display: none; flex-direction: row; justify-content: flex-start;" id="socials">
<a href="http://nuscomputing.com"><i style="padding: 0 15px; font-size: 30px; color: #ffbd30;" class="fas fa-globe"></i></a>
<a href="https://www.instagram.com/nuscomputingclub/"><i style="padding: 0 15px; font-size: 30px; color: #e1306c;" class="fab fa-instagram"></i></a>
<a href="https://www.linkedin.com/company/nus-students-computing-club"><i style="padding: 0 15px; font-size: 30px; color: #2867b2;" class="fab fa-linkedin-in"></i></a>
</p>
</p>
</div>
</div>
<div id="right"></div>
</body>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.0.2/firebase-app.js";
import { getDatabase, child, ref, set, push } from "https://www.gstatic.com/firebasejs/9.0.2/firebase-database.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyCn9v6eXCTzJw7z_OHfpH4NEOw8mEnU62g",
authDomain: "mc-feedback.firebaseapp.com",
projectId: "mc-feedback",
storageBucket: "mc-feedback.appspot.com",
messagingSenderId: "821071166410",
databaseURL: "https://mc-feedback-default-rtdb.asia-southeast1.firebasedatabase.app/",
appId: "1:821071166410:web:e2d3283e7b87b590eced33"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
function writeUserData(msg, email, category, rating) {
const database = getDatabase(app)
const newPostKey = push(child(ref(database), 'posts')).key;
set(ref(database, "24MC/feedback/" + newPostKey), {
msg: msg,
category: category,
email: email,
rating: rating,
status: "active",
fid: newPostKey
})
}
const ratingContainer = document.getElementById('emotions')
const sadFaceBtn = document.getElementById('sad-face-btn')
const mehFaceBtn = document.getElementById('meh-face-btn')
const blankFaceBtn = document.getElementById('blank-face-btn')
const smileFaceBtn = document.getElementById('smile-face-btn')
const grinFaceBtn = document.getElementById('grin-face-btn')
const faces = [sadFaceBtn, mehFaceBtn, blankFaceBtn, smileFaceBtn, grinFaceBtn]
var rating = 2
function selectRating(idx) {
for (var i=0, face; face = faces[i]; i++) {
face.style.borderRadius = "0px"
face.style.backgroundColor = ""
face.style.cursor = "default"
face.style.color = "none"
face.children[0].style.color = "black"
}
faces[idx].style.borderRadius = "7px"
faces[idx].style.backgroundColor = "#DCE1EE"
faces[idx].style.color = "#1DD1A1"
faces[idx].style.cursor = "pointer"
faces[idx].children[0].style.color = "#1DD1A1"
}
sadFaceBtn.addEventListener('click', () => {
selectRating(0)
rating = 1
})
mehFaceBtn.addEventListener('click', () => {
selectRating(1)
rating = 2
})
blankFaceBtn.addEventListener('click', () => {
selectRating(2)
rating = 3
})
smileFaceBtn.addEventListener('click', () => {
selectRating(3)
rating = 4
})
grinFaceBtn.addEventListener('click', () => {
selectRating(4)
rating = 5
})
const submitBtn = document.getElementById('submit-fb')
const topicPicker = document.getElementById('category')
const msgBox = document.getElementById('feedback-msg')
const emailBox = document.getElementById('email')
const tyHeader = document.getElementById('ty-header')
const tySubheader = document.getElementById('ty-subheader')
const segHeader = document.getElementById('segment-header')
const segMsg = document.getElementById('segment-msg')
const pdpaMsg = document.getElementById('pdpa-msg')
const socials = document.getElementById('socials')
function flush() {
msgBox.style.display = "none"
emailBox.style.display = "none"
ratingContainer.style.display = "none"
topicPicker.style.display = "none"
submitBtn.style.display = "none"
pdpaMsg.style.display = "none"
segHeader.style.display = "none"
segMsg.style.display = "none"
tyHeader.style.display = "block"
tySubheader.style.display = "block"
socials.style.display = "flex"
}
submitBtn.addEventListener('click', () => {
var msg = msgBox.value
var email = emailBox.value == "" ? null : emailBox.value
var category = topicPicker.options[topicPicker.selectedIndex].value;
writeUserData(
msg,
email,
category,
rating
)
flush()
})
</script>
<script src="js/app.js"></script>
</html>