Skip to content

Commit 26ef252

Browse files
authored
Merge pull request #190 from HackHPI/feature/reactivate-registration-for-2026
Feature/reactivate registration for 2026
2 parents f54c964 + 89c6a13 commit 26ef252

4 files changed

Lines changed: 88 additions & 26 deletions

File tree

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Page() {
2323
<Sponsors26/>
2424
<Gallery/>
2525
<Newsletter/>
26-
{/* <Registration /> */}
26+
<Registration />
2727
<Location />
2828
<Speakers/>
2929
<Jury/>

src/components/Registration/GroupManager/GroupManager.jsx

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Typography,
99
} from "@mui/material";
1010
import { LoadingButton } from "@mui/lab";
11-
import {useEffect, useMemo, useState} from "react";
11+
import { useEffect, useMemo, useState } from "react";
1212
import { GroupRest } from "../../../rest/GroupRest";
1313

1414
export function GroupManager(props) {
@@ -17,21 +17,27 @@ export function GroupManager(props) {
1717
const [group, setGroup] = useState(false);
1818
const [groupInput, setGroupInput] = useState("");
1919
const [groupInputError, setGroupInputError] = useState(false);
20+
const [groupName, setGroupName] = useState("");
2021
const groupRest = useMemo(() => new GroupRest(), []);
2122

22-
2323
function createNewGroup() {
2424
setLoadingNewTeam(true);
25-
setGroupInputError(false)
26-
groupRest.createGroup(props.eventId).then((response) => {
27-
setLoadingNewTeam(false);
28-
setGroup(response.data);
29-
});
25+
setGroupInputError(false);
26+
groupRest
27+
.createGroup(props.eventId, groupName)
28+
.then((response) => {
29+
setLoadingNewTeam(false);
30+
setGroup(response.data);
31+
})
32+
.catch((err) => {
33+
console.error(err);
34+
setLoadingNewTeam(false);
35+
});
3036
}
3137

3238
function getGroup() {
3339
setFetchingExistingTeam(true);
34-
setGroupInputError(false)
40+
setGroupInputError(false);
3541
groupRest
3642
.getGroup(props.eventId, groupInput)
3743
.then((response) => {
@@ -45,17 +51,17 @@ export function GroupManager(props) {
4551
});
4652
}
4753

48-
useEffect(() => {
49-
props.onGroupChange(group)
50-
}, [group]);
54+
useEffect(() => {
55+
props.onGroupChange(group);
56+
}, [group]);
5157

5258
function renderGroupSelection() {
5359
return (
5460
<Box sx={{ pt: 5, pb: 5 }}>
5561
<Stack direction="row" spacing={2}>
5662
<TextField
5763
fullWidth
58-
label={"Enter team name (e.g. chalk-increase-vague)"}
64+
label={"Enter team identification (e.g. chalk-increase-vague)"}
5965
value={groupInput}
6066
onChange={(event) => setGroupInput(event.target.value)}
6167
error={groupInputError}
@@ -72,26 +78,47 @@ export function GroupManager(props) {
7278
Join
7379
</LoadingButton>
7480
</Stack>
81+
<Typography variant={"body2"} color={"text.disabled"} pt={1}>
82+
Identifier given by the group creator
83+
</Typography>
7584
<Divider sx={{ pt: 2, pb: 2 }}> or </Divider>
76-
<Box sx={{ width: "100%", display: "flex", justifyContent: "center" }}>
85+
<Stack direction="row" spacing={2}>
86+
<TextField
87+
fullWidth
88+
label={"Enter team name (e.g. Carbon Coders)"}
89+
value={groupName}
90+
onChange={(event) => setGroupName(event.target.value)}
91+
disabled={fetchingExistingTeam}
92+
/>
7793
<LoadingButton
94+
sx={{ flexWrap: "nowrap" }}
95+
width={"100px"}
7896
variant={"outlined"}
7997
color={"primary"}
8098
onClick={createNewGroup}
8199
loading={loadingNewTeam}
82-
disabled={fetchingExistingTeam}
100+
disabled={
101+
fetchingExistingTeam ||
102+
groupName.length < 3 ||
103+
groupName.length > 30
104+
}
83105
>
84-
Create new Team
106+
Create
85107
</LoadingButton>
86-
</Box>
108+
</Stack>
109+
<Typography variant={"body2"} color={"text.disabled"} pt={1}>
110+
This will be your team name at the event
111+
</Typography>
87112
</Box>
88113
);
89114
}
90115

91116
function renderGroup() {
92117
return (
93118
<Box sx={{ pt: 5, pb: 5 }}>
94-
<Typography gutterBottom>You are assigned to the group</Typography>
119+
<Typography gutterBottom>
120+
You are assigned to the group with identifier
121+
</Typography>
95122
<Typography sx={{ fontWeight: 800, pb: 3 }} variant={"h5"}>
96123
{group.phrase}
97124
</Typography>
@@ -100,7 +127,7 @@ export function GroupManager(props) {
100127
</Button>
101128

102129
<Typography sx={{ pt: 4 }}>
103-
share this name to your team members
130+
share this identifier to your team members
104131
</Typography>
105132
<Typography color={"text.secondary"}>
106133
This is not your actual team name at the event

src/components/Registration/Registration.jsx

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import universities from "./universitiesDE.json";
3333
import { GroupManager } from "./GroupManager/GroupManager";
3434
import { INPUT_TYPES } from "./InputTypes.js";
3535

36-
const registrationClosed = true;
36+
const registrationClosed = false;
3737
const personalData = [
3838
{
3939
formLabel: "First name",
@@ -71,7 +71,8 @@ const personalData = [
7171
type: INPUT_TYPES.TEXT_FIELD,
7272
input: ["example@example.com"],
7373
name: "email",
74-
regex: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,
74+
regex:
75+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
7576
required: true,
7677
},
7778
{
@@ -199,6 +200,31 @@ const skills = [
199200
},
200201
];
201202

203+
const travelSponsorship = [
204+
{
205+
fullWidth: true,
206+
input:
207+
"Our partner, Quantco, provides travel scholarships for participants from around the globe. Applying is easy — just submit your CV and select the checkbox below.",
208+
type: INPUT_TYPES.TYPOGRAPHY,
209+
},
210+
{
211+
fullWidth: true,
212+
input:
213+
"Please email your CV in PDF format to travel-scholarship@hackhpi.org.",
214+
type: INPUT_TYPES.TYPOGRAPHY,
215+
},
216+
{
217+
formLabel: "",
218+
input: [
219+
"I consent to sharing my contact information and CV with our partner, Quantco, and authorize them to contact me.",
220+
],
221+
name: "travelStipend",
222+
type: INPUT_TYPES.CHECKBOX,
223+
required: false,
224+
fullWidth: true,
225+
},
226+
];
227+
202228
const legal = [
203229
{
204230
formLabel: "Privacy Policy",
@@ -252,11 +278,15 @@ function Registration() {
252278
label: "Team members",
253279
children: (
254280
<GroupManager
255-
eventId={"02fc811b-1e67-402e-ac62-3f376cf33b6b"}
281+
eventId={"c11a427e-f679-49b6-8574-b0d3211ad123"}
256282
onGroupChange={(change) => handleChange("group", change)}
257283
/>
258284
),
259285
},
286+
{
287+
label: "Travel Scholarship",
288+
content: travelSponsorship,
289+
},
260290
{
261291
label: "Confirmation",
262292
content: legal,
@@ -314,6 +344,11 @@ function Registration() {
314344
) {
315345
return previous && false;
316346
}
347+
348+
if (current.regex && !values[current.name].match(current.regex)){
349+
return previous && false;
350+
}
351+
317352
const meetsMax = current.max
318353
? values[current.name]?.length <= current.max
319354
: true;
@@ -429,7 +464,7 @@ function Registration() {
429464
/>
430465
);
431466
case INPUT_TYPES.TYPOGRAPHY:
432-
return <Typography>{input}</Typography>;
467+
return <Typography fullWidth>{input}</Typography>;
433468

434469
default:
435470
return null;
@@ -461,7 +496,7 @@ function Registration() {
461496
email: values.email,
462497
fieldData: JSON.stringify(values),
463498
signUpForm: {
464-
id: "283db119-046c-4418-939d-ab9bee06c996",
499+
id: "e73735ad-c930-44ee-8631-6c5bc3aed029",
465500
//id: "2f1c60f2-f30b-4432-8129-9131c6e398dd",
466501
},
467502
group: values.group ? values.group : undefined,

src/rest/GroupRest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import axios from "axios";
22
import { AbstractRest } from "./AbstractRest";
33

44
export class GroupRest extends AbstractRest {
5-
createGroup(signUpFormId) {
6-
return axios.post(this.baseUrl + "/group", { event: { id: signUpFormId } });
5+
createGroup(signUpFormId, name) {
6+
return axios.post(this.baseUrl + "/group", { event: { id: signUpFormId }, name });
77
}
88

99
getGroup(eventId, groupName) {

0 commit comments

Comments
 (0)