Skip to content

Commit 55aa66c

Browse files
committed
Add Travel Scholarship section to registration form and enhance group creation functionality
1 parent 362c8c7 commit 55aa66c

3 files changed

Lines changed: 72 additions & 32 deletions

File tree

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)
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: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,25 @@ const skills = [
199199
},
200200
];
201201

202+
const travelSponsorship = [
203+
{
204+
fullWidth: true,
205+
input:
206+
"Quantco, our partner, is offering travel scholarships to participants worldwide. To apply, simply submit your CV using the checkbox below.",
207+
type: INPUT_TYPES.TYPOGRAPHY,
208+
},
209+
{
210+
formLabel: "",
211+
input: [
212+
"I consent to sharing my contact information and CV with our partner, Quantco, and authorize them to contact me.",
213+
],
214+
name: "travelStipend",
215+
type: INPUT_TYPES.CHECKBOX,
216+
required: false,
217+
fullWidth: true,
218+
},
219+
];
220+
202221
const legal = [
203222
{
204223
formLabel: "Privacy Policy",
@@ -218,16 +237,6 @@ const legal = [
218237
required: false,
219238
fullWidth: true,
220239
},
221-
{
222-
formLabel: "Apply for Travel Stipend",
223-
input: [
224-
"I agree that my contact and job-related data will be passed to our partner Quantco. Quantco will reach out to you, if you will be selected. Stipend applies worldwide.",
225-
],
226-
name: "travelStipend",
227-
type: 5,
228-
required: false,
229-
fullWidth: true,
230-
},
231240
{
232241
input: [
233242
"Film and sound recordings as well as photos will be made at the event, and you agree to their subsequent use by attending the event.",
@@ -262,11 +271,15 @@ function Registration() {
262271
label: "Team members",
263272
children: (
264273
<GroupManager
265-
eventId={"02fc811b-1e67-402e-ac62-3f376cf33b6b"}
274+
eventId={"c11a427e-f679-49b6-8574-b0d3211ad123"}
266275
onGroupChange={(change) => handleChange("group", change)}
267276
/>
268277
),
269278
},
279+
{
280+
label: "Travel Scholarship",
281+
content: travelSponsorship,
282+
},
270283
{
271284
label: "Confirmation",
272285
content: legal,
@@ -439,7 +452,7 @@ function Registration() {
439452
/>
440453
);
441454
case INPUT_TYPES.TYPOGRAPHY:
442-
return <Typography>{input}</Typography>;
455+
return <Typography fullWidth>{input}</Typography>;
443456

444457
default:
445458
return null;

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)