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

[WV-312] replace placeholder avatar with candidate initials [TEAM REVIEW] #3992

Conversation

StevenSmith-code
Copy link
Contributor

@StevenSmith-code StevenSmith-code commented Aug 19, 2024

Summary

This PR introduces a feature that generates avatars for supporters based on their names when no profile image is available. The avatars display the initials of the supporter’s name and use a color derived from the name to ensure visual distinction.

Description

  • Implemented a speakerDisplayNameToInitials function that generates initials and background colors for avatars based on the supporter_name.
  • Updated the CommentWrapper component to use the speakerDisplayNameToInitials function when no profile image is available.
  • Refactored the code to ensure proper handling of single-word and multi-word supporter names.
  • Added utility functions speakerDisplayNameToAvatarColor and speakerDisplayNameToInitials to centralize the avatar creation logic.

Testing Instructions

  1. Run the application and navigate to the campaign page with supporters.
  2. Verify that supporters without profile images have avatars with initials and unique background colors.
  3. Test with both single-word and multi-word supporter names to ensure initials are correctly generated.

Screenshots / GIFs

image

@DaleMcGrew
Copy link
Member

Great work @StevenSmith-code! 👍

@DaleMcGrew DaleMcGrew merged commit 9b2e2cf into wevote:develop Aug 21, 2024
4 checks passed
@StevenSmith-code StevenSmith-code deleted the WV-312-replace-placeholder-avatar-with-candidate-initials branch August 22, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants