Skip to content

Commit b37f2fa

Browse files
authored
Merge pull request #187 from HackHPI/klaraprigge/hac-22-when-completing-first-step-in-registration-and-going-back
When completing first step in registration and going back the university is gone
2 parents 93c5afe + 3e417b3 commit b37f2fa

File tree

2 files changed

+41
-31
lines changed

2 files changed

+41
-31
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const INPUT_TYPES = {
2+
EMPTY: 0,
3+
TEXT_FIELD: 1,
4+
DATE: 2,
5+
SELECT: 3,
6+
RADIO: 4,
7+
CHECKBOX: 5,
8+
AUTOCOMPLETE: 6,
9+
TYPOGRAPHY: 7,
10+
};

src/components/Registration/Registration.jsx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ import { LoadingButton } from "@mui/lab";
3030
import { RegistrationRest } from "../../rest/RegistrationRest.js";
3131
import { Mail, Send } from "@mui/icons-material";
3232
import universities from "./universitiesDE.json";
33-
import { GroupManager } from "./GroupManager/GroupManager"; // types: 0 = empty, 1 = textfield, 2 = date, 3 = select, 4 = radio
34-
35-
// types: 0 = empty, 1 = textfield, 2 = date, 3 = select, 4 = radio
33+
import { GroupManager } from "./GroupManager/GroupManager";
34+
import { INPUT_TYPES } from "./InputTypes.js";
3635

3736
const registrationClosed = true;
3837
const personalData = [
3938
{
4039
formLabel: "First name",
41-
type: 1,
40+
type: INPUT_TYPES.TEXT_FIELD,
4241
input: ["First Name"],
4342
name: "forename",
4443
max: 50,
@@ -47,7 +46,7 @@ const personalData = [
4746
},
4847
{
4948
formLabel: "Last name",
50-
type: 1,
49+
type: INPUT_TYPES.TEXT_FIELD,
5150
input: ["Last Name"],
5251
name: "surname",
5352
max: 50,
@@ -56,42 +55,42 @@ const personalData = [
5655
},
5756
{
5857
formLabel: "Date of birth",
59-
type: 2,
58+
type: INPUT_TYPES.DATE,
6059
name: "age",
6160
required: true,
6261
},
6362
{
6463
formLabel: "Gender",
65-
type: 3,
64+
type: INPUT_TYPES.SELECT,
6665
input: ["male", "female", "diverse"],
6766
name: "gender",
6867
required: true,
6968
},
7069
{
7170
formLabel: "E-mail",
72-
type: 1,
71+
type: INPUT_TYPES.TEXT_FIELD,
7372
input: ["[email protected]"],
7473
name: "email",
7574
regex: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,
7675
required: true,
7776
},
7877
{
7978
formLabel: "T-shirt size",
80-
type: 3,
79+
type: INPUT_TYPES.SELECT,
8180
input: ["XS", "S", "M", "L", "XL", "XXL"],
8281
name: "shirtSize",
8382
required: true,
8483
},
8584
{
8685
formLabel: "Diet preferences",
87-
type: 3,
86+
type: INPUT_TYPES.SELECT,
8887
input: ["omnivore", "vegetarian", "vegan"],
8988
name: "dietPreference",
9089
required: true,
9190
},
9291
{
9392
formLabel: "Allergies",
94-
type: 1,
93+
type: INPUT_TYPES.TEXT_FIELD,
9594
input: ["e. g. gluten, ..."],
9695
helperText:
9796
"Please let us know if you have severe allergies that we must know about.",
@@ -101,7 +100,7 @@ const personalData = [
101100
},
102101
{
103102
formLabel: "University/School/Institute",
104-
type: 6,
103+
type: INPUT_TYPES.AUTOCOMPLETE,
105104
input: universities,
106105
name: "university",
107106
max: 150,
@@ -110,7 +109,7 @@ const personalData = [
110109
},
111110
{
112111
formLabel: "Course of study",
113-
type: 1,
112+
type: INPUT_TYPES.TEXT_FIELD,
114113
input: ["e. g. Computer Science"],
115114
name: "fieldOfStudy",
116115
max: 150,
@@ -119,7 +118,7 @@ const personalData = [
119118
},
120119
{
121120
formLabel: "Intended degree",
122-
type: 3,
121+
type: INPUT_TYPES.SELECT,
123122
input: ["High School Diploma", "Bachelor", "Master", "PhD"],
124123
name: "intendedDegree",
125124
required: true,
@@ -129,7 +128,7 @@ const personalData = [
129128
const motivation = [
130129
{
131130
formLabel: "How did you hear from us?",
132-
type: 4,
131+
type: INPUT_TYPES.RADIO,
133132
input: [
134133
"university/school/institute",
135134
"friends/other students",
@@ -141,11 +140,11 @@ const motivation = [
141140
},
142141
{
143142
formLabel: "",
144-
type: 0,
143+
type: INPUT_TYPES.EMPTY,
145144
},
146145
{
147146
formLabel: "Your motivation",
148-
type: 1,
147+
type: INPUT_TYPES.TEXT_FIELD,
149148
input: ["My motivation is ..."],
150149
helperText:
151150
"Please write a short text (max. 1200 characters) or 3 key phrases describing your motivation to be part of HackHPI. If you can't think of anything, take the following questions as guidance: Can you share a project, creation, or task that holds a special place as one of your favorites? What motivated you to undertake it, and what aspects make you proud of the outcome?",
@@ -162,7 +161,7 @@ const motivation = [
162161
const skills = [
163162
{
164163
formLabel: "Tech stack",
165-
type: 1,
164+
type: INPUT_TYPES.TEXT_FIELD,
166165
input: ["e. g. Python, ..."],
167166
helperText:
168167
"Please note programming languages, frameworks, etc. you have already worked with.",
@@ -173,7 +172,7 @@ const skills = [
173172
},
174173
{
175174
formLabel: "Previous experiences / studies / projects...",
176-
type: 1,
175+
type: INPUT_TYPES.TEXT_FIELD,
177176
input: ["e. g. working student at HPI, ..."],
178177
helperText:
179178
"Outline the most important steps of your CV like work experiences, studies and projects.",
@@ -184,15 +183,15 @@ const skills = [
184183
},
185184
{
186185
formLabel: "GitHub account",
187-
type: 1,
186+
type: INPUT_TYPES.TEXT_FIELD,
188187
input: ["e. g. maxm90"],
189188
name: "github",
190189
max: 50,
191190
required: false,
192191
},
193192
{
194193
formLabel: "LinkedIn account",
195-
type: 1,
194+
type: INPUT_TYPES.TEXT_FIELD,
196195
input: ["e. g. /in/max-mustermann"],
197196
name: "linkedin",
198197
max: 50,
@@ -205,7 +204,7 @@ const legal = [
205204
formLabel: "Privacy Policy",
206205
input: ["I have read and accept the Privacy Policy."],
207206
name: "privacyPolicy",
208-
type: 5,
207+
type: INPUT_TYPES.CHECKBOX,
209208
required: true,
210209
fullWidth: true,
211210
},
@@ -215,15 +214,15 @@ const legal = [
215214
"I agree that my contact and job-related data may be passed on to participating recruiters (sponsors)",
216215
],
217216
name: "recruiters",
218-
type: 5,
217+
type: INPUT_TYPES.CHECKBOX,
219218
required: false,
220219
fullWidth: true,
221220
},
222221
{
223222
input: [
224223
"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.",
225224
],
226-
type: 7,
225+
type: INPUT_TYPES.TYPOGRAPHY,
227226
name: "photos",
228227
required: false,
229228
fullWidth: true,
@@ -335,7 +334,7 @@ function Registration() {
335334
const rows = props.rows;
336335

337336
switch (type) {
338-
case 1:
337+
case INPUT_TYPES.TEXT_FIELD:
339338
return (
340339
<TextField
341340
type="text"
@@ -349,7 +348,7 @@ function Registration() {
349348
}
350349
/>
351350
);
352-
case 2:
351+
case INPUT_TYPES.DATE:
353352
return (
354353
<TextField
355354
type="date"
@@ -361,7 +360,7 @@ function Registration() {
361360
}
362361
/>
363362
);
364-
case 3:
363+
case INPUT_TYPES.SELECT:
365364
return (
366365
<Select
367366
value={values[name] ?? ""}
@@ -381,7 +380,7 @@ function Registration() {
381380
))}
382381
</Select>
383382
);
384-
case 4:
383+
case INPUT_TYPES.RADIO:
385384
return (
386385
<RadioGroup
387386
value={values[name] ?? ""}
@@ -399,7 +398,7 @@ function Registration() {
399398
))}
400399
</RadioGroup>
401400
);
402-
case 5:
401+
case INPUT_TYPES.CHECKBOX:
403402
return (
404403
<FormControlLabel
405404
control={
@@ -412,10 +411,11 @@ function Registration() {
412411
label={input.join("")}
413412
/>
414413
);
415-
case 6:
414+
case INPUT_TYPES.AUTOCOMPLETE:
416415
return (
417416
<Autocomplete
418417
freeSolo
418+
value={values[name] ?? ""}
419419
options={input}
420420
autoSelect
421421
onChange={(event, value) => handleChange(name, value)}
@@ -428,7 +428,7 @@ function Registration() {
428428
)}
429429
/>
430430
);
431-
case 7:
431+
case INPUT_TYPES.TYPOGRAPHY:
432432
return <Typography>{input}</Typography>;
433433

434434
default:

0 commit comments

Comments
 (0)