Skip to content

Commit

Permalink
fix(launchpad): Make input optional
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Feb 18, 2025
1 parent 704fa0c commit e581e04
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,43 @@ export const LaunchpadDetails: FC<Props> = ({ collectionForm }) => {
</BrandText>
<SpacerColumn size={2} />

<Controller<CollectionFormValues>
name="projectTypes"
control={collectionForm.control}
render={({ field: { onChange } }) => (
<>
<MultipleSelectInput
dropdownOptions={[
"PFP",
"Utility",
"Metaverse",
"P2E",
"Other",
]}
placeHolder="Select Option"
items={projectTypes}
onPressItem={(item) => {
const selectedProjectTypes = projectTypes.includes(item)
? projectTypes.filter((data) => data !== item)
: [...projectTypes, item];
onChange(selectedProjectTypes);
}}
label="Project types"
sublabel={
<BrandText style={[fontMedium13, { color: neutral55 }]}>
Multiple answers allowed
</BrandText>
}
style={{ zIndex: 2 }}
/>
<ErrorText>
{collectionForm.getFieldState("projectTypes").error?.message}
</ErrorText>
</>
)}
/>
<SpacerColumn size={2} />

<TextInputLaunchpad<CollectionFormValues>
label="Website Link"
sublabel={
Expand Down Expand Up @@ -73,43 +110,6 @@ export const LaunchpadDetails: FC<Props> = ({ collectionForm }) => {
name="artworkDescription"
form={collectionForm}
/>

<Controller<CollectionFormValues>
name="projectTypes"
control={collectionForm.control}
render={({ field: { onChange } }) => (
<>
<MultipleSelectInput
dropdownOptions={[
"PFP",
"Utility",
"Metaverse",
"P2E",
"Other",
]}
placeHolder="Select Option"
items={projectTypes}
onPressItem={(item) => {
const selectedProjectTypes = projectTypes.includes(item)
? projectTypes.filter((data) => data !== item)
: [...projectTypes, item];
onChange(selectedProjectTypes);
}}
label="Project type:"
sublabel={
<BrandText style={[fontMedium13, { color: neutral55 }]}>
Multiple answers allowed
</BrandText>
}
style={{ zIndex: 2 }}
/>
<ErrorText>
{collectionForm.getFieldState("projectTypes").error?.message}
</ErrorText>
</>
)}
/>
<SpacerColumn size={2} />
</View>
</View>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/types/launchpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const ZodCollectionFormValues = z.object({
.trim()
.refine((value) => EMAIL_REGEXP.test(value), DEFAULT_FORM_ERRORS.onlyEmail)
.optional(),
projectTypes: z.array(z.string().trim()).min(1, DEFAULT_FORM_ERRORS.required),
projectTypes: z.array(z.string().trim()),
revealTime: z.number().optional(),
teamDescription: z.string().trim().optional(),
partnersDescription: z.string().trim().optional(),
Expand Down

0 comments on commit e581e04

Please sign in to comment.