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

Storage of Avatar Images internally (as opposed to asking for URL) #3299

Closed
3 tasks
dmtrjsg opened this issue Jun 27, 2022 · 15 comments
Closed
3 tasks

Storage of Avatar Images internally (as opposed to asking for URL) #3299

dmtrjsg opened this issue Jun 27, 2022 · 15 comments
Assignees
Labels
carthage Carthagne Network enhancement New feature or request feedback-follow-up qa-task

Comments

@dmtrjsg
Copy link
Contributor

dmtrjsg commented Jun 27, 2022

Context

Ensure less friction and better experience for all users, since avatar image via URL come with many problems. Atlas team is building a simple back end service

And corresponding adjustments to the onboarding flow

Scope

  • Update the membership creation and editing flows in favour of uploaded avatars
  • Update the modal to Edit Membership
  • Existing file uploader

Info

┆Issue is synchronized with this Asana task by Unito

@dmtrjsg dmtrjsg added the mainnet Mainnet scope label Jun 27, 2022
@dmtrjsg dmtrjsg added post-mainnet enhancement New feature or request mainnet Mainnet scope and removed mainnet Mainnet scope labels Jul 5, 2022
@dmtrjsg dmtrjsg changed the title Local Storage of Avatar Images Storage of Avatar Images internally (as opposed to URL) Jul 29, 2022
@dmtrjsg dmtrjsg changed the title Storage of Avatar Images internally (as opposed to URL) Storage of Avatar Images internally (as opposed to asking for URL) Jul 29, 2022
@toiletgranny
Copy link

toiletgranny commented Aug 18, 2022

Alright, @dmtrjsg, designs for both the Create and Edit Membership dialogs can be found here: https://www.figma.com/file/GlgN8uBRtvtMJtiOsdtDF7/Pioneer-Design?node-id=10799%3A567889

Notes:

  1. Naturally, I started off trying to re-use existing patterns and components in Pioneer, but the only component for uploading files that I have found ("Dropzone") felt excessive when put in the context of (a) uploading a single image file to be used as an avatar, and (b) inside of a dialog and not a full-page experience.
  2. Because of the above, instead of using a "Dropzone" component, I went for a classic HTML file input type (styled). Hopefully, this won't take too much time to implement. Let me know if there's another component you feel we should try using here.
  3. To an engineer implementing this: make sure not to miss the error & loading states designs.

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Aug 18, 2022

@toiletgranny Agreed!

I guess preview is also not needed here, I bet you thought about it already.. Perhaps its safe to remove the drop zone variant by this time as Choose file is perfect :)

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Aug 19, 2022

@toiletgranny can we pls add small preview in a circle pls for the avatar

@dmtrjsg dmtrjsg assigned toiletgranny and unassigned WRadoslaw Aug 19, 2022
@toiletgranny
Copy link

toiletgranny commented Aug 19, 2022

@dmtrjsg If we can spend a bit more time on this, then sure! I updated the designs, and here they are — https://www.figma.com/file/GlgN8uBRtvtMJtiOsdtDF7/Pioneer-Design?node-id=10804%3A577502

@toiletgranny toiletgranny assigned dmtrjsg and unassigned toiletgranny Aug 19, 2022
@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Aug 19, 2022

@kdembler is the backend built already? Is there a place where we could use it for our mirroring feature dev?

@dmtrjsg dmtrjsg assigned WRadoslaw and unassigned dmtrjsg Aug 19, 2022
@kdembler
Copy link
Collaborator

Yep, yep, there is an instance at https://atlas-services.joystream.org/avatars

To upload you run a POST:

  const formData = new FormData()
  formData.append('file', croppedBlob, `upload.${croppedBlob.type === 'image/webp' ? 'webp' : 'jpg'}`)
  const response = await axios.post<{ fileName: string }>(AVATAR_SERVICE_URL, formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })

As a response, you get back an object with single field called fileName that will give you the name of the uploaded file and then you can just request it with https://atlas-services.joystream.org/avatars/fileName

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Aug 30, 2022

@WRadoslaw fyi:

Discussed the implication on the design of the Externally managed Pioneer which is unlikely to point to Atlas for Avatar Storage.

As a fallback scenario when the Backend URL is undefined for this module, the modal will still have Avatar URL variation.

@ivanturlakov
Copy link

ivanturlakov commented Sep 29, 2022

Tested on https://dao-git-carthage-joystream.vercel.app/
wss://3.92.226.32.nip.io/ws-rpc

@dmtrjsg Using different env parameters I was able to see only a fallback scenario

2022-09-29.12.46.28.mov

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Oct 3, 2022

@ivanturlakov sorry to hear that, pls try to test on this instance: https://pioneer-2.vercel.app/

@ivanturlakov
Copy link

@dmtrjsg same results on https://pioneer-2.vercel.app/

@dmtrjsg dmtrjsg added skip-asana-sync Blocks synching via Unito <-> Asana integration carthage Carthagne Network and removed mainnet Mainnet scope post-mainnet labels Oct 5, 2022
@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Oct 11, 2022

Will need to sync up with @thesan to advise, thanks for trying will come back to you asap!

@dmtrjsg dmtrjsg added feedback-follow-up and removed skip-asana-sync Blocks synching via Unito <-> Asana integration labels Oct 11, 2022
@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Oct 12, 2022

@ivanturlakov pls test this on Cartahge env, and we will update the config for env to include the avatar service now.

the env will be 44.201.112.198.nip.io

Will be ready in an hour

@ivanturlakov
Copy link

Tested on https://dao-git-carthage-joystream.vercel.app/
wss://44.201.112.198.nip.io/ws-rpc

✅ Creating via faucet
✅ Add Membership/New Member
✅ Edit Membership

Снимок экрана 2022-10-12 в 12 41 57

Снимок экрана 2022-10-12 в 12 42 27

Снимок экрана 2022-10-12 в 12 45 52

If file size > 1M

Снимок экрана 2022-10-12 в 13 09 54

img path: https://atlas-services.joystream.org/avatars/b3ebb15e-4366-4a13-86c6-a9b376e7eb22.jpeg

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Oct 12, 2022

@WRadoslaw what's the max size we allow? We need to add to the validation error.
Max file size allowed is X mb.

@dmtrjsg
Copy link
Contributor Author

dmtrjsg commented Oct 13, 2022

Supreseded by

So good to be released as is for the time being

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
carthage Carthagne Network enhancement New feature or request feedback-follow-up qa-task
Projects
None yet
Development

No branches or pull requests

6 participants