Add new default placeholder avatars

This commit is contained in:
Jesse Wierzbinski 2024-04-07 17:55:12 -10:00
parent 6917def011
commit e4f82e2fa9
No known key found for this signature in database
3 changed files with 12 additions and 2 deletions

View file

@ -34,7 +34,11 @@ export type UserWithRelations = Prisma.UserGetPayload<typeof userRelations2>;
* @returns The raw URL for the user's avatar
*/
export const getAvatarUrl = (user: User, config: Config) => {
if (!user.avatar) return config.defaults.avatar;
if (!user.avatar)
return (
config.defaults.avatar ||
`https://api.dicebear.com/8.x/${config.defaults.placeholder_style}/svg?seed=${user.username}`
);
return getUrl(user.avatar, config);
};