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

fix: fallback for missing avatar images #9603

Merged
merged 1 commit into from Apr 5, 2024
Merged

fix: fallback for missing avatar images #9603

merged 1 commit into from Apr 5, 2024

Conversation

mattkrick
Copy link
Member

Description

touches on #9555, but doesn't fix it properly.
this adds a fallback image in case their profile pic fails to load, but it only does this on the Avatar component (think user dash). there may be other places that their avatar fails to load!

not eager to dump 1300 images into our github repo, but not sure what the better alternative is...

Signed-off-by: Matt Krick <matt.krick@gmail.com>
@github-actions github-actions bot added the size/s label Apr 5, 2024
@mattkrick mattkrick merged commit 1a7e298 into master Apr 5, 2024
6 checks passed
@mattkrick mattkrick deleted the fix/avatars branch April 5, 2024 02:10
@dbumblis-parabol
Copy link
Contributor

@mattkrick What if we just used a single default image?

@mattkrick
Copy link
Member Author

that's an option! it just sucks when you're in a meeting & you see a sea of the same avatar so you don't know who is who.
i grabbed the avatars from S3 & the folder comes to 640KB, so i wouldn't feel horrible about including it in the bundle.

@Mohd-Muneeb
Copy link
Contributor

An approach would be to make images with random patterns like GitHub does on the fly, and use it with the user's session. It'll eliminate the drawbacks of single default imaging while being much more user friendly. If you would like me to work on it I can help make an endpoint and raise a PR!

@mattkrick
Copy link
Member Author

@Mohd-Muneeb an identicon would be a great idea! Do you have a favorite package? I saw https://www.dicebear.com/styles/initials/ could replicate something very similar to what we have today & it looks like we could even pick a few colors from our palette to set the background. If you'd like to open a PR I'd love to review it!

I imagine the flow would be something like:

  • while bootstrapping a new user, grab the name or email address to use as a seed & generate a png
  • upload the png to the CDN using the FileStoreManager
  • get the return value as a URL & pass that in for the avatar value when creating the User object

@Mohd-Muneeb
Copy link
Contributor

Mohd-Muneeb commented Apr 10, 2024

@mattkrick Yep, dicebear sounds like a really good idea.

Also, maybe instead of storing them in a CDN, we can probably generate the avatar real time. What I mean to say is, since an email always gives the same image, we can show a identicon generated on client side. This will reduced the cost of a CDN and I don't think it will cause a huge performance reduction on the client side.

Please tag me once if you are cool with the idea. I would also like you to look at this Repoistory's README, it solves the problem and I prefer this over dicebear personally, this will eliminate the need for the CDN. Here is an example codepen implementation of the library link, let me know if you are interested and I'll make a custom component and send in a PR!

@mattkrick
Copy link
Member Author

If we only used it on the client that could work. Unfortunately we serve that avatar URL everywhere, including emails, which requires URLs that point to raster images or we risk emails getting truncated and avatars not showing up. A CDN only costs about $0.02/GB, so cost isn't a factor.

@Mohd-Muneeb
Copy link
Contributor

Cool, I'll try to send a PR with the plan. You can expect it by Sunday! Do let me know if you have any update, and if I have any questions regarding the project setup, please help me with it. :D

@mattkrick
Copy link
Member Author

awesome! looking forward to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants