Skip to content

Commit

Permalink
Merge pull request #251 from HackGT/248-add-character-limit-on-projec…
Browse files Browse the repository at this point in the history
…t-names

248 add character limit on project names
  • Loading branch information
lyangji1011 authored Jan 27, 2025
2 parents 4bd9936 + 0952afb commit a0fb41a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/create/form/DevpostInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ const DevpostInfoForm: React.FC<Props> = props => {
<Col {...FORM_LAYOUT.full}>
<Form.Item
name="name"
rules={[FORM_RULES.requiredRule]}
rules={[FORM_RULES.requiredRule, FORM_RULES.maxLengthRule]}
label="Project Name (should match Devpost submission name)"
>
<Input placeholder="Alexa Assistant" />
<Input placeholder="Alexa Assistant" maxLength={FORM_RULES.maxLengthRule.max} />

</Form.Item>
</Col>
</Row>
Expand Down
6 changes: 4 additions & 2 deletions src/components/epicenter/JudgingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ const JudgingBox: React.FC<Props> = props => {
<AccordionButton _expanded={{ bg: 'purple.400', color: 'white' }}>
<Box as="span" flex='1' textAlign='left'>
<Flex alignItems='center' justify='space-between'>
<Text><Badge>{props.project.id}</Badge> {props.project.name} </Text>

<Text>
<Badge>{props.project.id}</Badge>
<Text mx={1.5} as="span">{props.project.name}</Text>
</Text>
<Flex gap={4}>
<Badge colorScheme={colorSchemeMapper[props.project.round]}>R: {props.project.round}</Badge>

Expand Down
5 changes: 5 additions & 0 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export const FORM_RULES = {
type: "email",
message: "Please enter a valid email.",
} as Rule,
maxLengthRule: {
type: "number",
max: 30,
message: 'Project name cannot exceed 30 characters',
} as Rule & { max?: number },
};

export const FORM_LAYOUT = {
Expand Down

0 comments on commit a0fb41a

Please sign in to comment.