Skip to content

Commit

Permalink
feat: add profile image to comment header
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavkeblysh committed Nov 25, 2023
1 parent 5f8374b commit fc330a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const CommentHeader = ({
const colorClass = AvatarOutlineAndLabelColors[comment.authorLabel];
const hasAnyAlert = useAlertBannerVisible(comment);

const profileImage = comment.users && Object.values(comment.users)[0].profile.image;

return (
<div className={classNames('d-flex flex-row justify-content-between', {
'mt-2': hasAnyAlert,
Expand All @@ -25,6 +27,7 @@ const CommentHeader = ({
<Avatar
className={`border-0 ml-0.5 mr-2.5 ${colorClass ? `outline-${colorClass}` : 'outline-anonymous'}`}
alt={comment.author}
src={profileImage.hasImage ? profileImage.imageUrlSmall : undefined}
style={{
width: '32px',
height: '32px',
Expand Down
2 changes: 1 addition & 1 deletion src/discussions/posts/post/PostHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const PostAvatar = ({
return spacing;
}, [post.type]);

const profileImage = Object.values(post.users)[0].profile.image;
const profileImage = post.users && Object.values(post.users)[0].profile.image;

return (
<div className={avatarSpacing}>
Expand Down

0 comments on commit fc330a8

Please sign in to comment.