diff --git a/package.json b/package.json index 35cc299b..ab3f835d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impro", - "version": "0.6.30", + "version": "0.6.31", "type": "module", "scripts": { "start": "rm -rf build && NODE_ENV=development eleventy --serve", diff --git a/src/img/labeler-avatar-fallback.svg b/src/img/labeler-avatar-fallback.svg new file mode 100644 index 00000000..00ff1b6f --- /dev/null +++ b/src/img/labeler-avatar-fallback.svg @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/src/js/templates/avatar.template.js b/src/js/templates/avatar.template.js index e889aac2..3b3bbc1e 100644 --- a/src/js/templates/avatar.template.js +++ b/src/js/templates/avatar.template.js @@ -20,6 +20,16 @@ function avatarWrapperTemplate({ author, clickAction, children }) { } } +function getAvatarUrl(author, isLabeler) { + if (author.avatar) { + return avatarThumbnailUrl(author.avatar); + } else if (isLabeler) { + return "/img/labeler-avatar-fallback.svg"; + } else { + return "/img/avatar-fallback.svg"; + } +} + export function avatarTemplate({ author, clickAction = "link", @@ -27,9 +37,7 @@ export function avatarTemplate({ // lazyLoad = true, }) { const isLabeler = isLabelerProfile(author); - const avatarUrl = author.avatar - ? avatarThumbnailUrl(author.avatar) - : "/img/avatar-fallback.svg"; + const avatarUrl = getAvatarUrl(author, isLabeler); return html`