Skip to content

Commit 4901199

Browse files
committed
Modified challenge validations
1 parent 9457f34 commit 4901199

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

frontend/src/pages/_dashboard/renderDashboard/organiser/edit/challenges/ChallengesForm.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,20 @@ export default ({ value, onChange }) => {
203203
)
204204
}
205205

206+
const styling = {
207+
challengeNameMaxLength: 200,
208+
challengeSlugMaxLength: 200,
209+
textAreaMaxLength: styling.textAreaMaxLength,
210+
}
211+
206212
const renderForm = () => (
207213
<>
208214
<Grid item xs={12}>
209215
<TextInput
210216
label="Challenge name"
211217
value={name}
212218
onChange={handleNameChange}
213-
maxLength={50}
219+
maxLength={styling.challengeNameMaxLength}
214220
/>
215221
<Typography variant="caption">
216222
The unique publicly visible name of the challenge.
@@ -221,7 +227,7 @@ export default ({ value, onChange }) => {
221227
label="Unique slug"
222228
value={slug}
223229
onChange={setSlug}
224-
maxLength={50}
230+
maxLength={styling.challengeSlugMaxLength}
225231
/>
226232
<Typography variant="caption">
227233
A unique slug for the challenge. This will be used in e.g.
@@ -280,7 +286,7 @@ export default ({ value, onChange }) => {
280286
value={description}
281287
onChange={setDescription}
282288
placeholder="Description goes here"
283-
maxLength={1000}
289+
maxLength={styling.textAreaMaxLength}
284290
/>
285291
<Typography variant="caption">
286292
Challenge description.
@@ -293,7 +299,7 @@ export default ({ value, onChange }) => {
293299
value={insights}
294300
onChange={setInsights}
295301
placeholder="Insights go here"
296-
maxLength={1000}
302+
maxLength={styling.textAreaMaxLength}
297303
/>
298304
<Typography variant="caption">Challenge insights.</Typography>
299305
</Grid>
@@ -304,7 +310,7 @@ export default ({ value, onChange }) => {
304310
value={resources}
305311
onChange={setResources}
306312
placeholder="Resource go here"
307-
maxLength={1000}
313+
maxLength={styling.textAreaMaxLength}
308314
/>
309315
<Typography variant="caption">Challenge resources.</Typography>
310316
</Grid>
@@ -315,7 +321,7 @@ export default ({ value, onChange }) => {
315321
value={prizes}
316322
onChange={setPrizes}
317323
placeholder="Prizes go here"
318-
maxLength={1000}
324+
maxLength={styling.textAreaMaxLength}
319325
/>
320326
<Typography variant="caption">Challenge Prizes.</Typography>
321327
</Grid>
@@ -326,7 +332,7 @@ export default ({ value, onChange }) => {
326332
value={criteria}
327333
onChange={setCriteria}
328334
placeholder="Criteria go here"
329-
maxLength={1000}
335+
maxLength={styling.textAreaMaxLength}
330336
/>
331337
<Typography variant="caption">Challenge criteria.</Typography>
332338
</Grid>
@@ -337,7 +343,7 @@ export default ({ value, onChange }) => {
337343
value={companyInfo}
338344
onChange={setCompanyInfo}
339345
placeholder="Company info goes here"
340-
maxLength={1000}
346+
maxLength={styling.textAreaMaxLength}
341347
/>
342348
<Typography variant="caption">Company Info</Typography>
343349
</Grid>

shared/schemas/Challenge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const ChallengeSchema = new mongoose.Schema({
1111
name: {
1212
type: String,
1313
required: true,
14-
length: 50,
14+
length: 200,
1515
},
1616
partner: {
1717
type: String,

0 commit comments

Comments
 (0)