community-platform
community-platform copied to clipboard
Refactor: Image upload
On the user Settings page (SettingsPage
), the user profile image component in UserInfosSection
uses ImageInputField
which in turn uses ImageInput
which has a lot going on in it!
We’re looking to add a feature so that users can select a crop of the image they select but due to the current architecture, this is difficult to implement.
Task
Change ImageInputField
so that it is more responsible for:
- Determining if an image is empty and thus renders a more simple ‘Upload image’ button.
- If the user has selected an image, present the user with the
CropImage
component (https://github.com/ONEARMY/community-platform/pull/3269). - If the user has selected a crop for the image, begin uploading the cropped image and thus rendering a Loader.
- If errored, present that error to the user.
- If successful, render the uploaded image to the user with a delete button beneath - Not an overlay, it’s bad UX for mobile.
Notes:
- This is more complex for the multi-image implementation for the multi-image implementations of the image upload feature used for workspaces, etc. Don’t worry about that for the moment, let’s get it right for single image use.
- Please move as much responsibility to the component library as possible.
Can i work on this one?
@manacespereira it looks like @benfurber has started work on this item in #3287
Hi @manacespereira. I’d be delighted for you to pick this up.
As @thisislawatts says, there’s #3287 - which doesn’t change the functionality (as this issue proposes) but was meant to be a tidy up to support this ticket. But as you can see from the failing tests, I eeerrr, must have broken something.
Early next week I can finish #3287 and get confirmed that #3269 is the direction we want to travel.
As I want to move as much functionality to the component library as possible you could probably start playing around/architecting/planning this issue now and we have a chat next week about details?
How does that sound?