opencrvs / opencrvs-core

A global solution to civil registration
https://www.opencrvs.org
Other
88 stars 72 forks source link

Change profile image #1618

Closed euanmillar closed 2 years ago

euanmillar commented 4 years ago

AS a user I WANT to be able to change my profile icon SO THAT i can personalise my account.

Description Allows a user to update their profile image

Mobile has a small window to drag and place image

Users can increase the size and drag to position.

Minimum size is the width of the circle. They can't drag beyond. Or resize beyond.

Design https://www.figma.com/file/YsucvwEW6lGAOiW9jUp7Cyiw/7.-Settings?node-id=229%3A4111

Copy https://www.notion.so/opencrvs/10-Profile-image-ed5faaf30d6944f88a2fde29f80fa73b

Acceptance criteria GIVEN I am on the settings page WHEN I click on the profile image THEN show the file browser with file types restricted to jpg or png.

GIVEN I have chosen an image, if the file size is less than 5MB THEN show the modal to crop and resize the image

Clicking Change image should re-open the file browser

The crop and resize feature can be built using a React OpenSource library if you wish, however it should be a recent and well supported library with high number of contributors and preferably TypeScript - but we can discuss. The below user experience is preferred but not necessarily essential.

The crop and resize feature can be built entirely in client > components, not packages > components

Dragging

GIVEN my image has been uploaded WHEN I drag on the image THEN move the image in the desired location

GIVEN I am dragging an image WHEN i drag the image to the edge of the circle THEN stop the image from being dragged any further

Resizing

GIVEN I am sliding the resize bar WHEN I am incresing/decreasing the size of my image THEN increase and decrease the size of the image

GIVEN I am sliding the resize bar WHEN I am decreasing the size to the width of the circle THEN stop the image from being decreased any further

Set profile image

GIVEN I have positioned my image WHEN I click change THEN close the modal and set their profile image

When the user clicks "Apply", show the loading animation

If the user has no internet connection, the Apply button must be disabled.

Default avatar already exists, but if the user has internet connectivity, then replace the default with an avatar using user initials from UI Avatars API

Zangetsu101 commented 2 years ago

@jpye-finch Any suggestions on where to put the error messages?

jpye-finch commented 2 years ago

@Zangetsu101 errors such as failed to upload?

Zangetsu101 commented 2 years ago

@jpye-finch image type not supported or image size exceeded.

SyedaAfrida commented 2 years ago

bug:

  1. Default avatar do not appear immediately when there is no internet connection. It appears after clicking any tab offline bug

  2. Zoomed image is uploaded and do not have option to decease size of what is uploaded 4

  3. Showing apply button and not disabled for invalid image. Should be saved button (disabled) 3

  4. Profile icon is updated after refresh in settings page 5

  5. Sometimes default avatar shows for some users in team tab even when there is internet connection bug2

  6. "Profile image successfully updated" toast keeps on appearing in Settings page. This bug is only found in farajaland-staging . This is not occuring in farajaland-qa 1

Concern: there is no option to delete an image

Zangetsu101 commented 2 years ago

@SyedaAfrida

  1. This is actually the expected behavior as the ui-avatar was already loaded when the user was online. So if the user goes offline afterwards it will still be there.
  2. This is kinda limited by the library we are using so if we want to change this I guess we will need a separate improvement ticket for that.
  3. I had actually missed that one. Fixed in #2748.
  4. Nice find! I was also able to make some improvements when fixing this. Similarly fixed in #2748.
  5. I think this is related to internet connectivity as the default avatar is a fallback for the ui-avatar(as in the avatar with the user's initials)
  6. I wasn't able to reproduce this.
azaworld commented 2 years ago

https://user-images.githubusercontent.com/70468099/171614192-8dcd88be-e3ca-4b10-afa7-bf6382f18883.mp4

azaworld commented 2 years ago

https://user-images.githubusercontent.com/70468099/171614242-9244aa50-7f86-4b73-95d7-a6b81e93dbf9.mp4

this is tested. waiting for review though it's passed. @anny320

anny320 commented 2 years ago

completed