-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstatus.tsx
More file actions
562 lines (543 loc) · 17.7 KB
/
status.tsx
File metadata and controls
562 lines (543 loc) · 17.7 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
import * as React from "react";
import { useCallback } from "react";
import { useLoginContext } from "../../contexts/login-context";
import { useSettingsContext } from "../../contexts/settings-context";
import { useApi } from "../../hooks/use-api";
import { Routes } from "../../routes";
import { dateToString, isConfirmationExpired } from "../../util";
import { Button } from "../base/button";
import {
FlexRowContainer,
NonGrowingFlexContainer,
Spacer,
} from "../base/flex";
import { Heading } from "../base/headings";
import { InternalLink } from "../base/link";
import { ProgressStep, ProgressStepState } from "../base/progress-step";
import { Text } from "../base/text";
import { Page } from "./page";
import { Divider } from "../base/divider";
import { SimpleCard } from "../base/simple-card";
import { Grid } from "@mui/material";
import { PageHeader } from "../base/page-header";
/**
* The start page every user sees after logging in.
*/
export const Status = () => {
const { settings } = useSettingsContext();
const { user, updateUser } = useLoginContext();
const confirmationDays = Math.floor(settings.application.hoursToConfirm / 24);
const allowProfileFormFrom = dateToString(
settings.application.allowProfileFormFrom,
);
const allowProfileFormUntil = dateToString(
settings.application.allowProfileFormUntil,
);
const acceptanceDeadline = dateToString(
settings.application.acceptanceDeadline,
);
const confirmSpotUntil = dateToString(settings.application.confirmSpotUntil);
const isExpired = user == null ? false : isConfirmationExpired(user);
const isNotAttending = isExpired || user?.declined;
const deadline = user?.confirmationExpiresAt;
const { isFetching: isDecliningSpot, forcePerformRequest: declineSpot } =
useApi(
async (api, wasForced) => {
if (wasForced) {
await api.declineSpot();
updateUser((value) =>
value == null
? null
: {
...value,
declined: true,
},
);
}
},
[updateUser],
);
const handleDeclineSpot = useCallback(() => {
const isSure = confirm(
"Are you sure you want to decline your spot?\n\nThis action is irreversible!",
);
if (!isSure) {
return;
}
declineSpot();
}, [declineSpot]);
return (
<Page>
<PageHeader
pageTitle={`Welcome ${user?.firstName}`}
subTitle="The status of our application and all links for Hackaburg 2026 can be found here."
marginBottom={0}
/>
<SimpleCard>
<ProgressStep
index={1}
title="Register"
state={ProgressStepState.Completed}
>
<Text style={{ fontSize: "1.15rem" }}>
You already registered and that's a good first step.
</Text>
</ProgressStep>
<ProgressStep
index={2}
title="Apply"
state={
user?.initialProfileFormSubmittedAt != null
? ProgressStepState.Completed
: ProgressStepState.Pending
}
>
{!user?.profileSubmitted && (
<>
<Text style={{ fontSize: "1.15rem" }}>
Please fill your{" "}
<InternalLink to={Routes.ProfileForm}>
profile form
</InternalLink>
, any time between{" "}
<b>
{allowProfileFormFrom} - {allowProfileFormUntil}
</b>
</Text>
</>
)}
{!user?.profileSubmitted && (
<>
<Spacer />
<FlexRowContainer>
<NonGrowingFlexContainer>
<InternalLink to={Routes.ProfileForm}>
<Button primary={true}>Fill profile form</Button>
</InternalLink>
</NonGrowingFlexContainer>
</FlexRowContainer>
</>
)}
{user?.profileSubmitted && (
<>
<Text style={{ fontSize: "1.15rem" }}>
You successfully applied. 🎉
{!user?.confirmed && (
<>
{" "}
You can still edit your{" "}
<InternalLink to={Routes.ProfileForm}>
profile form
</InternalLink>
</>
)}
</Text>
</>
)}
</ProgressStep>
<ProgressStep
index={3}
title="Get accepted"
state={
user?.admitted
? ProgressStepState.Completed
: ProgressStepState.Pending
}
>
{!user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
We will come back to you and send you a acceptance mail until{" "}
<b>{acceptanceDeadline}</b>.
</Text>
</>
)}
{user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
Congratulations! You got accepted for Hackaburg 2026. 🎉
</Text>
</>
)}
</ProgressStep>
<ProgressStep
index={4}
title="Confirm your spot"
state={
user?.confirmed && !isNotAttending
? ProgressStepState.Completed
: isNotAttending
? ProgressStepState.Failed
: ProgressStepState.Pending
}
>
{!user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
If you got accepted, you need to confirm your spot until{" "}
<b>{confirmSpotUntil}</b>
{user?.admitted && (
<>
{" "}
in our{" "}
<InternalLink to={Routes.ConfirmationForm}>
confirmation form
</InternalLink>
</>
)}
.
</Text>
</>
)}
{user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
You confirmed your spot. 🎉
</Text>
</>
)}
{user?.admitted && !user?.confirmed && (
<>
<Spacer />
<FlexRowContainer>
<NonGrowingFlexContainer>
<InternalLink to={Routes.ConfirmationForm}>
<Button primary={true}>Fill confirmation form</Button>
</InternalLink>
</NonGrowingFlexContainer>
</FlexRowContainer>
<Spacer />
<Text style={{ fontSize: "1.15rem" }}>
You have{" "}
<b>
{settings.application.hoursToConfirm} hours{" "}
{confirmationDays !== 0 && <> / {confirmationDays} day(s)</>}
</b>{" "}
to do this. If you don't confirm your spot, it'll be given to
someone else after the window has passed.
</Text>
</>
)}
{deadline != null && user?.admitted && !user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
Your confirmation {isExpired ? <b>was</b> : "is"} due on{" "}
<b>{dateToString(deadline)}</b>
{user?.declined && (
<>
, but you <b>declined</b> your spot
</>
)}
. Please let us know if you can not make it so that we can hand
over your spot to someone else.
</Text>
{!isNotAttending && user?.admitted && !user?.confirmed && (
<>
<Spacer />
<FlexRowContainer>
<NonGrowingFlexContainer>
<Button
loading={isDecliningSpot}
disable={isNotAttending}
onClick={handleDeclineSpot}
>
I can't make it
</Button>
</NonGrowingFlexContainer>
</FlexRowContainer>
</>
)}
</>
)}
</ProgressStep>
<ProgressStep
index={5}
title="The event"
state={
user?.confirmed && !isNotAttending
? ProgressStepState.Completed
: isNotAttending
? ProgressStepState.Failed
: ProgressStepState.Pending
}
>
{!isNotAttending && !user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
If all goes well, we'll meet you at the event.
</Text>
</>
)}
{!isNotAttending && user?.confirmed && (
<>
<Text style={{ fontSize: "1.15rem" }}>
See you at the event {user.firstName}! 🎉
</Text>
</>
)}
{!isNotAttending && user?.confirmed && (
<>
<Spacer />
<div
style={{
backgroundColor: "lightgrey",
padding: "1rem",
borderRadius: "1rem",
}}
>
<Text style={{ fontSize: "1.15rem" }}>
If you anyhow can't make it, please let us know as soon as
possible.
</Text>
<Spacer />
<FlexRowContainer>
<NonGrowingFlexContainer>
<Button
loading={isDecliningSpot}
disable={isNotAttending}
onClick={handleDeclineSpot}
>
I can't make it
</Button>
</NonGrowingFlexContainer>
</FlexRowContainer>
</div>
</>
)}
</ProgressStep>
</SimpleCard>
<div style={{ marginTop: "2rem" }}>
<Heading text="Get in Touch" />
<Divider />{" "}
</div>
<Grid container spacing={3} style={{ marginTop: "0rem" }}>
{
<Grid item xs={12} md={6} lg={3} xl={3}>
<div
style={{
borderRadius: "1rem",
boxShadow:
"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
}}
>
<img
src="https://i.imgur.com/3pU0Ycr.png"
alt="discord"
style={{
width: "100%",
height: "10rem",
borderTopLeftRadius: "1rem",
borderTopRightRadius: "1rem",
objectFit: "cover",
}}
/>
<div style={{ padding: "1rem" }}>
<p
style={{
fontSize: "1.5rem",
overflow: "hidden",
whiteSpace: "nowrap",
margin: "0rem",
textOverflow: "ellipsis",
}}
>
Join us on Discord
</p>
<p
style={{
minHeight: "4.5rem",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitLineClamp: 6,
WebkitBoxOrient: "vertical",
}}
>
The discord is open to everyone. Use it to introduce yourself
and tell us what you need (team members, ideas, hardware etc.)
</p>
<a
href="https://discord.gg/hackaburg"
target="_blank"
style={{
color: "black",
textDecoration: "none",
marginTop: "-1rem",
}}
>
<Button>Join Discord</Button>
</a>
</div>
</div>
</Grid>
}
<Grid item xs={12} md={6} lg={3} xl={3}>
<div
style={{
borderRadius: "1rem",
boxShadow:
"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
}}
>
<img
src="https://i.imgur.com/IbQJ7q5.png"
alt="socialmedia"
style={{
width: "100%",
height: "10rem",
borderTopLeftRadius: "1rem",
borderTopRightRadius: "1rem",
objectFit: "cover",
}}
/>
<div style={{ padding: "1rem" }}>
<p
style={{
fontSize: "1.5rem",
overflow: "hidden",
whiteSpace: "nowrap",
margin: "0rem",
textOverflow: "ellipsis",
}}
>
Our Social Media
</p>
<p
style={{
minHeight: "4.5rem",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitLineClamp: 6,
WebkitBoxOrient: "vertical",
}}
>
We post information about the event every week on{" "}
<b>Instagram</b> and <b>LinkedIn</b>. So follow us to stay up to
date.
</p>
<a
href="https://linktr.ee/hackaburg"
target="_blank"
style={{
color: "black",
textDecoration: "none",
marginTop: "-1rem",
}}
>
<Button>Follow</Button>
</a>
</div>
</div>
</Grid>
<Grid item xs={12} md={6} lg={3} xl={3}>
<div
style={{
borderRadius: "1rem",
boxShadow:
"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
}}
>
<img
src="https://i.imgur.com/vhS8tU4.jpeg"
alt="newsletter"
style={{
width: "100%",
height: "10rem",
borderTopLeftRadius: "1rem",
borderTopRightRadius: "1rem",
objectFit: "cover",
}}
/>
<div style={{ padding: "1rem" }}>
<p
style={{
fontSize: "1.5rem",
overflow: "hidden",
whiteSpace: "nowrap",
margin: "0rem",
textOverflow: "ellipsis",
}}
>
Our Newsletter
</p>
<p
style={{
minHeight: "4.5rem",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitLineClamp: 6,
WebkitBoxOrient: "vertical",
}}
>
You know mail is <b>really reliable</b> to stay up to date. And
you can be sure we won't <b>spam</b> you.
</p>
<a
href="https://26490796.sibforms.com/serve/MUIFAPx4aKGKuMbU3UZxk_ODAxapOpxY9oApe-LFK48oC2HcUpuUDG5RfLrplRnzmlE2fhnxFsrLWAO1LoVerg8hegpCyxQDQ85Ac45SzhCZXZlT8m5RRT7wDfIbcv9GgTCPGWiw6QSSK2qQR2n6ST8ezKWg-QTn0tCj8LRENn-vhJpHafi3096LcWLZQXDIx_IzJZaOLL7Chfdk"
target="_blank"
style={{
color: "black",
textDecoration: "none",
marginTop: "-1rem",
}}
>
<Button>Subscribe</Button>
</a>
</div>
</div>
</Grid>
<Grid item xs={12} md={6} lg={3} xl={3}>
<div
style={{
borderRadius: "1rem",
boxShadow:
"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
}}
>
<img
src="https://i.imgur.com/zatzqe3.png"
alt="team"
style={{
width: "100%",
height: "10rem",
borderTopLeftRadius: "1rem",
borderTopRightRadius: "1rem",
objectFit: "cover",
}}
/>
<div style={{ padding: "1rem" }}>
<p
style={{
fontSize: "1.5rem",
overflow: "hidden",
whiteSpace: "nowrap",
margin: "0rem",
textOverflow: "ellipsis",
}}
>
Create / Join a Team
</p>
<p
style={{
minHeight: "4.5rem",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitLineClamp: 6,
WebkitBoxOrient: "vertical",
}}
>
New <b>Feature</b> this year. You can create or join a team.
</p>
<InternalLink to={Routes.Teams}>
<Button>Teams</Button>
</InternalLink>
</div>
</div>
</Grid>
</Grid>
</Page>
);
};