Skip to content

Some improvements to the Upload component #162

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

Merged
merged 4 commits into from
Jun 23, 2020

Conversation

arthurxavierx
Copy link
Contributor

@arthurxavierx arthurxavierx commented Jun 19, 2020

This PR contains breaking changes.

  • Remove the onChange prop from Upload and replace it with onUpload :: Array FileId -> Effect Unit and onRemove :: FileId -> Maybe (Effect Unit).
    • The Maybe in onRemove lets us make some files non-removable.
  • Add a readonly :: Boolean field to FileInfo that indicates whether a given file may be removed or not.
  • Add a remove :: FileId -> Aff Boolean field to UploadBackend that allows for running an async action to check whether the file should be removed (e.g. a confirmation modal).
  • Add the onClick :: FileId -> Maybe (Effect Unit) prop to Upload so that users can interact with the uploaded files — e.g. for downloading them.
  • Add FormDefaults instances for Set and Map.

@arthurxavierx arthurxavierx self-assigned this Jun 19, 2020
@arthurxavierx arthurxavierx force-pushed the arthur/upload-improvements branch from f4f9293 to 7de59a3 Compare June 19, 2020 13:09
Copy link
Member

@maddie927 maddie927 left a comment

Choose a reason for hiding this comment

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

nice

@arthurxavierx arthurxavierx force-pushed the arthur/upload-improvements branch 2 times, most recently from 43483b2 to f113b34 Compare June 22, 2020 16:26
@arthurxavierx arthurxavierx force-pushed the arthur/upload-improvements branch from f113b34 to d679eae Compare June 22, 2020 16:34
@arthurxavierx
Copy link
Contributor Author

@kimispencer @spicydonuts I've updated this PR with some feedback from @hdgarrood. Could you review it again, please?

@maddie927 maddie927 self-requested a review June 22, 2020 19:21
@maddie927 maddie927 changed the base branch from master to main June 22, 2020 19:28
Copy link
Member

@maddie927 maddie927 left a comment

Choose a reason for hiding this comment

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

👍 (updated the base branch here as well)

@@ -124,6 +126,8 @@ type UploadProps =

type UploadBackend =
{ fetch :: FileId -> Aff FileInfo
-- | Allows for running arbitrary
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there suppose to be more to this comment? As is it doesn't seem that useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, thanks for catching that!

@arthurxavierx arthurxavierx merged commit 41a37c4 into main Jun 23, 2020
@arthurxavierx arthurxavierx deleted the arthur/upload-improvements branch June 23, 2020 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants