Fix avatar icon

This commit is contained in:
MartinBraquet
2025-10-09 18:37:11 +02:00
parent 3585b12dfd
commit 394102bb93
2 changed files with 3 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import { Row } from './layout/row'
import clsx from 'clsx'
export const MultipleOrSingleAvatars = (props: {
avatars: Array<{ avatarUrl: string; id: string }>
avatars: Array<{ avatarUrl: string; id: string; name: string }>
onClick?: () => void
size: AvatarSizeType
// TODO: standardize these numbers so they are calculated from the size
@@ -17,7 +17,7 @@ export const MultipleOrSingleAvatars = (props: {
if (avatars.length === 0) return null
if (avatars.length === 1) {
return <Avatar size={size} avatarUrl={avatars[0].avatarUrl} />
return <Avatar size={size} avatarUrl={avatars[0].avatarUrl} username={avatars[0].name} />
}
const totalAvatars = avatars.length

View File

@@ -43,14 +43,11 @@ export const Avatar = memo(
Router.push(`/${username}`)
}
}
const fallbackInitial = (username || 'U')[0]; // first character, not encoded string
const url: string = avatarUrl && avatarUrl.length > 0
? avatarUrl
: `https://ui-avatars.com/api/?name=${encodeURIComponent(fallbackInitial)}`;
// console.debug(url)
console.log(username, fallbackInitial, url)
// there can be no avatar URL or username in the feed, we show a "submit comment"
// item with a fake grey user circle guy even if you aren't signed in