Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixCreateForm #378

Merged
merged 5 commits into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 75 additions & 66 deletions apps/web/src/modules/create-dao/components/Artwork/ArtworkForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const Artwork: React.FC<ArtworkProps> = ({ title }) => {
setActiveSection,
ipfsUpload,
isUploadingToIPFS,
setSetUpArtwork,
} = useFormStore()

const initialValues = {
Expand All @@ -34,9 +35,13 @@ export const Artwork: React.FC<ArtworkProps> = ({ title }) => {
setActiveSection(activeSection - 1)
}

const handleSubmit = (_values: ArtworkFormValues) => {
const handleSubmit = (values: ArtworkFormValues) => {
setFulfilledSections(title)
setActiveSection(activeSection + 1)
setSetUpArtwork({
...setUpArtwork,
projectDescription: values.projectDescription,
})
}

return (
Expand All @@ -49,73 +54,77 @@ export const Artwork: React.FC<ArtworkProps> = ({ title }) => {
validationSchema={validationSchemaArtwork}
onSubmit={handleSubmit}
>
{(formik) => (
<Form>
<TextArea
{...formik.getFieldProps('projectDescription')}
inputLabel={'Collection Description'}
formik={formik}
id={'projectDescription'}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
errorMessage={
formik.touched?.projectDescription && formik.errors?.projectDescription
? formik.errors?.projectDescription
: undefined
}
placeholder={'Nouns is an experiment which combines...'}
/>

<ArtworkUpload
{...formik.getFieldProps('artwork')}
inputLabel={'Artwork'}
formik={formik}
id={'artwork'}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
'Builder uses folder hierarchy to organize your assets. Upload a single folder containing a subfolder for each trait. Each subfolder should contain every variant for that trait.'
}
errorMessage={
formik.touched.artwork && formik.errors?.artwork
? formik.errors?.artwork
: undefined
}
/>
{(formik) => {
return (
<Form>
<TextArea
{...formik.getFieldProps('projectDescription')}
inputLabel={'Collection Description'}
formik={formik}
id={'projectDescription'}
onChange={(e) => {
formik.handleChange(e)
Copy link
Member

@taayyohh taayyohh Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the pattern established in the other forms is that we update the store in the handleSubmit -- perhaps we should keep that pattern in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure!

}}
onBlur={formik.handleBlur}
errorMessage={
formik.touched?.projectDescription && formik.errors?.projectDescription
? formik.errors?.projectDescription
: undefined
}
placeholder={'Nouns is an experiment which combines...'}
/>

<Flex justify={'space-between'} mt={'x8'}>
<Button
justify={'center'}
align={'center'}
borderRadius={'curved'}
h={'x15'}
minH={'x15'}
minW={'x15'}
variant={'secondary'}
onClick={handlePrevious}
aria-label="Back"
>
<Icon id="arrowLeft" />
</Button>
<Button
flex={1}
borderRadius={'curved'}
width={'auto'}
ml={'x2'}
minH={'x15'}
type="submit"
disabled={
!isEmpty(formik.errors) ||
formik.isSubmitting ||
isUploadingToIPFS ||
ipfsUpload.length === 0
<ArtworkUpload
{...formik.getFieldProps('artwork')}
inputLabel={'Artwork'}
formik={formik}
id={'artwork'}
onChange={formik.handleChange}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be sure to update the store on submit for this field as well -- in the current build you cannot reupload artwork (which has been a known bug) but this PR reveals the issue, would be great to fix this as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just took a little dive on this one.

There's definitely the issue with not being to upload properly, but it looks like there's another issue with the preview (it still sticks to the old artwork preview, even if I upload new files) , which I suspect is why the formValues weren't being to the store in the first place.

Since there are users who are having issues with the description rn, would it be okay if we get this fix in and then fix the Artwork issue on a separate PR? Seems like there's a lot going on under the hood that I'll need to wade through.

Copy link
Collaborator

@isaaczaak isaaczaak Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried again and the entire app crashes for me. I agree with @jordanlesich 's suggestion that we should fix the artwork upload issue in a separate PR.

onBlur={formik.handleBlur}
helperText={
'Builder uses folder hierarchy to organize your assets. Upload a single folder containing a subfolder for each trait. Each subfolder should contain every variant for that trait.'
}
>
Continue
</Button>
</Flex>
</Form>
)}
errorMessage={
formik.touched.artwork && formik.errors?.artwork
? formik.errors?.artwork
: undefined
}
/>

<Flex justify={'space-between'} mt={'x8'}>
<Button
justify={'center'}
align={'center'}
borderRadius={'curved'}
h={'x15'}
minH={'x15'}
minW={'x15'}
variant={'secondary'}
onClick={handlePrevious}
aria-label="Back"
>
<Icon id="arrowLeft" />
</Button>
<Button
flex={1}
borderRadius={'curved'}
width={'auto'}
ml={'x2'}
minH={'x15'}
type="submit"
disabled={
!isEmpty(formik.errors) ||
formik.isSubmitting ||
isUploadingToIPFS ||
ipfsUpload.length === 0
}
>
Continue
</Button>
</Flex>
</Form>
)
}}
</Formik>
)
}
Loading