Skip to content

Commit

Permalink
Fix: Fallback to username in ContributorAvatar component (#510)
Browse files Browse the repository at this point in the history
* Fix: Fallback to username in ContributorAvatar component

* removed fall back to anonymous

* removed the comment line

* ran make check and make test to imporve quality

---------

Co-authored-by: Arkadii Yakovets <[email protected]>
  • Loading branch information
satwiksps and arkid15r authored Jan 16, 2025
1 parent 87aedd2 commit 188841f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/components/ContributorAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import { topContributorsType } from 'types/contributor'
import { tooltipStyle } from 'utils/constants'

const ContributorAvatar = ({ contributor }: { contributor: topContributorsType }) => {
const displayName = contributor.name || contributor.login

return (
<a
data-tooltip-id={`avatar-tooltip-${contributor.login}`}
data-tooltip-content={`${contributor.contributions_count} contributions by ${contributor.name}`}
data-tooltip-content={`${contributor.contributions_count} contributions by ${displayName}`}
href={`/community/users/${contributor.login}`}
target="_blank"
>
<img
className="h-[30px] w-[30px] rounded-full grayscale hover:grayscale-0"
src={contributor.avatar_url}
alt={`${displayName}'s avatar`}
/>
<Tooltip id={`avatar-tooltip-${contributor.login}`} style={tooltipStyle} />
</a>
Expand Down

0 comments on commit 188841f

Please sign in to comment.