diff --git a/app/views/answerbox/_comments.html.haml b/app/views/answerbox/_comments.html.haml
index 62a1035c..a03e4e10 100644
--- a/app/views/answerbox/_comments.html.haml
+++ b/app/views/answerbox/_comments.html.haml
@@ -8,7 +8,7 @@
.d-flex
.flex-shrink-0
%a{ href: user_path(comment.user) }
- %img.comment__user-avatar.avatar-sm{ src: comment.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: comment.user, size: "sm", classes: ["comment__user-avatar"])
.flex-grow-1
%h6.comment__user
= user_screen_name comment.user
diff --git a/app/views/answerbox/_header.html.haml b/app/views/answerbox/_header.html.haml
index 30dd9738..37f5b406 100644
--- a/app/views/answerbox/_header.html.haml
+++ b/app/views/answerbox/_header.html.haml
@@ -3,7 +3,7 @@
- unless a.question.author_is_anonymous
.flex-shrink-0
%a{ href: user_path(a.question.user) }
- %img.answerbox__question-user-avatar.avatar-md{ src: a.question.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: a.question.user, size: "md", classes: ["answerbox__question-user-avatar"])
.flex-grow-1
%h6.text-muted.answerbox__question-user
- if a.question.author_is_anonymous
diff --git a/app/views/answerbox/_smiles.html.haml b/app/views/answerbox/_smiles.html.haml
index 518c72ee..89e90539 100644
--- a/app/views/answerbox/_smiles.html.haml
+++ b/app/views/answerbox/_smiles.html.haml
@@ -9,4 +9,4 @@
%a{ href: user_path(smile.user),
title: user_screen_name(smile.user, url: false),
data: { bs_toggle: :tooltip, bs_placement: :top, smile_id: smile.id } }
- %img.avatar-xs{ src: smile.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: smile.user, size: "xs")
diff --git a/app/views/application/_answerbox.html.haml b/app/views/application/_answerbox.html.haml
index 4524f405..47010105 100644
--- a/app/views/application/_answerbox.html.haml
+++ b/app/views/application/_answerbox.html.haml
@@ -14,7 +14,7 @@
.d-flex
.flex-shrink-0
%a{ href: user_path(a.user) }
- %img.answerbox__answer-user-avatar.avatar-sm{ src: a.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: a.user, size: "sm", classes: ["answerbox__answer-user-avatar"])
.flex-grow-1
%h6.answerbox__answer-user
= raw t(".answered", hide: hidespan(t(".hide"), "d-none d-sm-inline"), user: user_screen_name(a.user))
diff --git a/app/views/discover/_userbox.html.haml b/app/views/discover/_userbox.html.haml
index 8c322b50..165ccc51 100644
--- a/app/views/discover/_userbox.html.haml
+++ b/app/views/discover/_userbox.html.haml
@@ -3,7 +3,7 @@
.d-flex
.flex-shrink-0
%a{ href: user_path(u) }
- %img.avatar-md.me-2{ src: u.profile_picture.url(:medium) }
+ = render AvatarComponent.new(user: u, size: "md", classes: ["me-2"])
.flex-grow-1
%h6.answerbox__question-user
- if u.profile.display_name.blank?
diff --git a/app/views/inbox/_entry.html.haml b/app/views/inbox/_entry.html.haml
index 1d37c711..873d3795 100644
--- a/app/views/inbox/_entry.html.haml
+++ b/app/views/inbox/_entry.html.haml
@@ -4,7 +4,7 @@
- unless i.question.author_is_anonymous
.flex-shrink-0
%a.pull-left{ href: user_path(i.question.user) }
- %img.answerbox__question-user-avatar.avatar-md{ src: i.question.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: i.question.user, size: "md", classes: ["answerbox__question-user-avatar"])
.flex-grow-1
%h6.text-muted.answerbox__question-user
- if i.question.author_is_anonymous
diff --git a/app/views/moderation/_moderationbox.html.haml b/app/views/moderation/_moderationbox.html.haml
index 721177af..ef0c16fb 100644
--- a/app/views/moderation/_moderationbox.html.haml
+++ b/app/views/moderation/_moderationbox.html.haml
@@ -1,6 +1,6 @@
.card.moderationbox{ data: { id: report.id } }
.card-header
- %img.avatar-sm{ src: report.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: report.user, size: "sm")
= t(".reported_html",
user: user_screen_name(report.user),
content: report.type.sub("Reports::", ""),
diff --git a/app/views/moderation/inbox/_header.html.haml b/app/views/moderation/inbox/_header.html.haml
index eae01b4b..cd57e8d8 100644
--- a/app/views/moderation/inbox/_header.html.haml
+++ b/app/views/moderation/inbox/_header.html.haml
@@ -4,6 +4,6 @@
.d-flex
.flex-shrink-0
%a{ href: user_path(user) }
- %img.answerbox__question-user-avatar.avatar-md{ src: user.profile_picture.url(:medium) }
+ = render AvatarComponent.new(user:, size: "md", classes: ["answerbox__question-user-avatar"])
.flex-grow-1
= t(".title_html", screen_name: user.screen_name, user_id: user.id)
diff --git a/app/views/navigation/_desktop.html.haml b/app/views/navigation/_desktop.html.haml
index fc0cce38..267c59ff 100644
--- a/app/views/navigation/_desktop.html.haml
+++ b/app/views/navigation/_desktop.html.haml
@@ -34,7 +34,7 @@
%i.fa.fa-pencil-square-o
%li.nav-item.dropdown.profile--image-dropdown
%a.nav-link.dropdown-toggle.p-sm-0{ href: "#", data: { bs_toggle: :dropdown } }
- %img.avatar-md.d-none.d-sm-inline{ src: current_user.profile_picture.url(:small) }
+ = render AvatarComponent.new(user: current_user, size: "md", classes: ["d-none", "d-sm-inline"])
%span.d-inline.d-sm-none
= current_user.screen_name
%b.caret
diff --git a/app/views/navigation/_mobile.html.haml b/app/views/navigation/_mobile.html.haml
index 2b68f081..010d592c 100644
--- a/app/views/navigation/_mobile.html.haml
+++ b/app/views/navigation/_mobile.html.haml
@@ -12,5 +12,5 @@
badge: notification_count, badge_color: "primary", badge_attr: { id: "notification-mobile-count" }, icon_only: true
%li.nav-item.profile--image-dropdown
%a.nav-link{ href: '#', data: { bs_toggle: 'dropdown', bs_target: '#rs-mobile-nav-profile' }, aria: { controls: 'rs-mobile-nav-profile', expanded: 'false' } }
- %img.avatar-md.d-inline{ src: current_user.profile_picture.url(:small) }
+ = render AvatarComponent.new(user: current_user, size: "md", classes: ["d-inline"])
= render 'navigation/dropdown/profile', size: "mobile"
diff --git a/app/views/notifications/type/_answer.html.haml b/app/views/notifications/type/_answer.html.haml
index 890fb394..a85836eb 100644
--- a/app/views/notifications/type/_answer.html.haml
+++ b/app/views/notifications/type/_answer.html.haml
@@ -3,7 +3,7 @@
%i.fa.fa-2x.fa-fw.fa-exclamation
.flex-grow-1
.notification__heading
- %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: notification.target.user, size: "xs")
= t(".heading_html",
user: user_screen_name(notification.target.user),
question: link_to(t(".link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.id), target: "_top"),
diff --git a/app/views/notifications/type/_comment.html.haml b/app/views/notifications/type/_comment.html.haml
index 56c3797c..a3371df1 100644
--- a/app/views/notifications/type/_comment.html.haml
+++ b/app/views/notifications/type/_comment.html.haml
@@ -3,7 +3,7 @@
%i.fa.fa-2x.fa-fw.fa-comments
.flex-grow-1
.notification__heading
- %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: notification.target.user, size: "xs")
- if notification.target.answer.user == current_user
= t(".heading_html",
user: user_screen_name(notification.target.user),
diff --git a/app/views/notifications/type/_follow.html.haml b/app/views/notifications/type/_follow.html.haml
index 0994b6de..d142943f 100644
--- a/app/views/notifications/type/_follow.html.haml
+++ b/app/views/notifications/type/_follow.html.haml
@@ -1,6 +1,6 @@
.d-flex.notification
.flex-shrink-0.notification__icon
- %img.avatar-sm{ src: notification.target.source.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: notification.target.source, size: "sm")
.flex-grow-1
%h6.notification__user
= user_screen_name notification.target.source
diff --git a/app/views/notifications/type/_reaction.html.haml b/app/views/notifications/type/_reaction.html.haml
index ae9259c1..0f0e68f8 100644
--- a/app/views/notifications/type/_reaction.html.haml
+++ b/app/views/notifications/type/_reaction.html.haml
@@ -3,7 +3,7 @@
%i.fa.fa-2x.fa-fw.fa-smile-o
.flex-grow-1
.notification__heading
- %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: notification.target.user, size: "xs")
- if notification.target.parent_type == "Answer"
= t(".heading_html",
user: user_screen_name(notification.target.user),
diff --git a/app/views/question/_question.html.haml b/app/views/question/_question.html.haml
index 1128bb5f..c25594f0 100644
--- a/app/views/question/_question.html.haml
+++ b/app/views/question/_question.html.haml
@@ -5,7 +5,7 @@
- unless question.author_is_anonymous
.flex-shrink-0
%a{ href: unless hidden then user_path(question.user) end }
- %img.answerbox__question-user-avatar.avatar-md{ src: question.user.profile_picture.url(:small) }
+ = render AvatarComponent.new(user: question.user, size: "md", classes: ["answerbox__question-user-avatar"])
.flex-grow-1
%h6.text-muted.answerbox__question-user
- identifier = question.author_is_anonymous ? question.author_identifier : nil
diff --git a/app/views/settings/blocks/index.html.haml b/app/views/settings/blocks/index.html.haml
index 51e18a11..e11aa255 100644
--- a/app/views/settings/blocks/index.html.haml
+++ b/app/views/settings/blocks/index.html.haml
@@ -6,7 +6,7 @@
- @blocks.each do |block|
%li.list-group-item
.d-flex
- %img.avatar-md.d-none.d-sm-inline.me-2{ src: block.target.profile_picture.url(:small) }
+ = render AvatarComponent.new(user: block.target, size: "md", classes: ["d-none", "d-sm-inline", "me-2"])
%div
%p.mb-0= user_screen_name(block.target)
%p.text-muted.mb-0= t(".blocked", time: time_ago_in_words(block.created_at))
diff --git a/app/views/settings/mutes/_user.html.haml b/app/views/settings/mutes/_user.html.haml
index e669270a..a2324bcc 100644
--- a/app/views/settings/mutes/_user.html.haml
+++ b/app/views/settings/mutes/_user.html.haml
@@ -1,5 +1,5 @@
.d-flex.mb-2
- %img.avatar-md.me-2{ src: user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user:, size: "md", classes: ["me-2"])
%p.align-self-center.m-0= user_screen_name(user, context_user: current_user)
.ms-auto.d-inline-flex
%button.btn.btn-default.align-self-center{ data: { action: :unmute, target: user.screen_name } }
diff --git a/app/views/settings/profile/edit.html.haml b/app/views/settings/profile/edit.html.haml
index 32721590..d2311e51 100644
--- a/app/views/settings/profile/edit.html.haml
+++ b/app/views/settings/profile/edit.html.haml
@@ -5,7 +5,7 @@
%div{ data: { controller: "cropper", cropper_aspect_ratio_value: "1" } }
.d-flex
.flex-shrink-0
- %img.avatar-lg.me-3{ src: current_user.profile_picture.url(:medium) }
+ = render AvatarComponent.new(user: current_user, size: "lg", classes: ["me-3"])
.flex-grow-1
= f.file_field :profile_picture, accept: APP_CONFIG[:accepted_image_formats].join(","), data: { cropper_target: "input", action: "cropper#change" }
diff --git a/app/views/shared/_question.html.haml b/app/views/shared/_question.html.haml
index e1a4df80..6ebd7d93 100644
--- a/app/views/shared/_question.html.haml
+++ b/app/views/shared/_question.html.haml
@@ -5,7 +5,7 @@
- if type == "discover"
.flex-shrink-0
%a{ href: user_screen_name(q.user, link_only: true) }
- %img.avatar-md.me-2{ src: q.user&.profile_picture&.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: q.user, size: "md", classes: ["me-2"])
.flex-grow-1
%h6.text-muted.answerbox__question-user
- if type.nil? && q.direct
diff --git a/app/views/tabs/_feed.html.haml b/app/views/tabs/_feed.html.haml
index 778c1cea..fc92d7a0 100644
--- a/app/views/tabs/_feed.html.haml
+++ b/app/views/tabs/_feed.html.haml
@@ -18,7 +18,7 @@
%p.px-4.pb-2
- list.members.each do |member|
%a{ href: user_path(member.user), title: member.user.screen_name, data: { bs_toggle: :tooltip, bs_placement: :top } }
- %img.avatar-xs{ src: member.user.profile_picture.url(:small), loading: :lazy }
+ = render AvatarComponent.new(user: member.user, size: "xs")
- if !list && lists.empty?
.p-3= t(".lists.notice_html")
- lists.each do |list|