LF-5237 Implement immediate validation for unsupported file formats on upload in Farm Note creation#4113
Conversation
| }, | ||
| "HELP": { | ||
| "ATTACHMENT_LABEL": "Upload screenshot or file", | ||
| "ATTACHMENT_LABEL": "Upload screenshot", |
There was a problem hiding this comment.
The Feedback Form DOES accept a file currently, and it will never go through imaginary so there is really no issue with uploading a file via the <ImagePicker /> component (it will just get attached to the support email); however, 1) the image preview is broken in the case of a file:
and 2) it doesn't really make sense to use the <ImagePicker /> component for file upload!
I suspect what happened here was that Loïc requested the new upload component when we revamped Feedback Form, and we had ignored or just overlooked that this new component is specific to images so probably shouldn't have been used (at least, without changing the label string as belatedly done here!)
According to Denis, file upload is not really used in support requests anyway. I think we even discussed this before as a team and had talked about restricting to images? In any case, that is what Denis suggested today when we discussed this ticket, so I have gone with that and updated the label accordingly.
Description
Despite the ticket title, this fix is applied to all image uploads throughout app in this PR
There were two existing patterns:
<ImagePicker />'s delayed upload flow (i.e. Farm Image, Help Request image), and inherited by<ImageUploadCapture />(Farm Notes), which was based on this flow<ImagePickerWrapper />(crop images) and in the immediate upload flow of<ImagePicker />usinguseImagePicker(e.g. animals, market directory). This was fundamentally sound but the snackbar was unhelpful as it didn't explain the cause of the upload errorThis PR:
Jira link: https://lite-farm.atlassian.net/browse/LF-5237
Type of change
How Has This Been Tested?
Checklist:
pnpm i18nto help with this)