generated from CloudCannon/hydra-jekyll-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
submissions.html
210 lines (190 loc) · 8.82 KB
/
submissions.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
---
title: Submissions
layout: default
description: Submit your design and view submissions
---
<div class="content">
<section>
<div class="text-container">
<h1>
Submissions
</h1>
<div>
<h2>
First round submissions
</h2>
<table>
<thead>
<tr>
<td>Team members</td>
<td>Link</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="cell-wrapper">William Chen, Skye Wang, Rita Wang</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://drive.google.com/drive/folders/1J3neXekXArLAjQZ2QHNgDaiXeDLMh5vE?usp=share_link"
target="_blank">https://drive.google.com/drive/folders/1J3neXekXArLAjQZ2QHNgDaiXeDLMh5vE?usp=share_link</a>
</div>
</td>
</tr>
<tr>
<td>
<div class="cell-wrapper">Soohoon Oh, Andrea Ham, Hanna Fu, Minju Kim, Chan Lee</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://www.figma.com/file/CeRxaKjzBbVUkvDUTSChGt/Designathon?node-id=10%3A3&t=rLCSMCU1UuP82m7k-1"
target="_blank">https://www.figma.com/file/CeRxaKjzBbVUkvDUTSChGt/Designathon?node-id=10%3A3&t=rLCSMCU1UuP82m7k-1</a>
</div>
</td>
</tr>
<tr>
<td>
<div class="cell-wrapper">Helen Jiang, Brendan Yang</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://www.figma.com/proto/RpVbLjTn90mUdwPNPzIULi/Webstac-Registration?node-id=4-2&scaling=min-zoom&page-id=0%3A1"
target="_blank">https://www.figma.com/proto/RpVbLjTn90mUdwPNPzIULi/Webstac-Registration?node-id=4-2&scaling=min-zoom&page-id=0%3A1</a>
</div>
</td>
</tr>
<tr>
<td>
<div class="cell-wrapper">Gisela Liu and Christine Ling</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://docs.google.com/presentation/d/1bw2U2hL0_PmtYaOl21oRbwmqhPDIyiGRDVWKEuXnh3c/edit?usp=sharing"
target="_blank">https://docs.google.com/presentation/d/1bw2U2hL0_PmtYaOl21oRbwmqhPDIyiGRDVWKEuXnh3c/edit?usp=sharing</a>
</div>
</td>
</tr>
<tr>
<td>
<div class="cell-wrapper">Isha Vasil and Pranav Palakodety</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://docs.google.com/presentation/d/1ZyTIoePjYn-pz0UALwOIIS-mfpjt-Ea6UtnSBfRypFw/edit?usp=sharing"
target="_blank">https://docs.google.com/presentation/d/1ZyTIoePjYn-pz0UALwOIIS-mfpjt-Ea6UtnSBfRypFw/edit?usp=sharing</a>
</div>
</td>
</tr>
<tr>
<td>
<div class="cell-wrapper">Helen Jiang, Brendan Yang</div>
</td>
<td>
<div class="cell-wrapper"><a
href="https://www.figma.com/file/RpVbLjTn90mUdwPNPzIULi/Webstac-Registration?node-id=4%3A2&t=eEegRCoaGl9sYiL8-1"
target="_blank">https://www.figma.com/file/RpVbLjTn90mUdwPNPzIULi/Webstac-Registration?node-id=4%3A2&t=eEegRCoaGl9sYiL8-1</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h2>
Submit second round
</h2>
<p>
Submit your design and presentation for the second round using <a href="https://airtable.com/shrUMpjw9kdZVgepM" target="_blank">this form</a>.
</p>
</div>
<div id="second-round-submissions" aria-busy="true" aria-describedby="second-round-submissions-progress">
<h2>Second round submissions</h2>
<progress id="second-round-submissions-progress" aria-label="Loading submitted designs…"></progress>
</div>
</div>
</section>
</div>
<script>
function getSubmissionsRequest() {
const url = new URL("https://api.airtable.com/v0/app09MJiFZnRepKIA/tblWDSMTh9dmEk8wt");
url.searchParams.append("fields", "teamMembers");
url.searchParams.append("fields", "designLink");
url.searchParams.append("fields", "presentationLink");
const readToken = "patlpZ2uGUGb6DNzB.3438ad9d8a5c7a593f6951f1647f9143e3b4604cc650ee313b0b26dc394aa55b";
return new Request(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${readToken}`
}
})
}
function handleDoneLoading() {
document.getElementById("second-round-submissions").removeAttribute("aria-busy");
document.getElementById("second-round-submissions-progress").setAttribute("hidden", "true");
}
function trInsertCellWrapped(tr, content) {
const td = tr.insertCell();
// Needs wrapper div https://stackoverflow.com/questions/9152042
const wrapper = document.createElement("div");
wrapper.setAttribute("class", "cell-wrapper");
td.appendChild(wrapper);
wrapper.appendChild(content);
}
function createSubmissionsTable(records) {
const table = document.createElement("table");
table.animate([
{opacity: '0'},
{opacity: '1'}
], {
duration: 200,
});
const thead = table.createTHead();
const theadRow = thead.insertRow();
for (const column of ["Team", "Design", "Pres."]) {
const td = theadRow.insertCell();
td.innerText = column;
}
const tbody = table.createTBody();
for (const record of records) {
const tr = tbody.insertRow();
trInsertCellWrapped(tr, document.createTextNode(record.fields.teamMembers));
const designAnchor = document.createElement("a");
designAnchor.setAttribute("href", record.fields.designLink);
designAnchor.setAttribute("target", "_blank");
designAnchor.innerText = record.fields.designLink;
trInsertCellWrapped(tr, designAnchor);
const presentationAnchor = document.createElement("a");
presentationAnchor.setAttribute("href", record.fields.presentationLink);
presentationAnchor.setAttribute("target", "_blank");
presentationAnchor.innerText = record.fields.presentationLink;
trInsertCellWrapped(tr, presentationAnchor);
}
return table;
}
fetch(getSubmissionsRequest())
.then((response) => {
if (response.status === 200) {
return response.json();
} else if (response.status === 429) {
throw new Error("Too many requests are being sent to the server. Please try again a minute.")
} else {
throw new Error("There was an error loading the submitted designs. Please contact us if this problem persists.");
}
})
.then((json) => {
const records = json.records;
if (records.length === 0) {
throw new Error("There aren't any submitted designs yet. Check back later!")
}
const table = createSubmissionsTable(records);
handleDoneLoading();
document.getElementById("second-round-submissions").appendChild(table);
})
.catch((error) => {
const message = document.createElement("p");
message.innerText = error.message;
handleDoneLoading();
document.getElementById("second-round-submissions").appendChild(message);
});
</script>