From 008248ee0faee8f3dc61721157139ab7b7f92d84 Mon Sep 17 00:00:00 2001
From: Andrew Crescencio <68707868+AndrewCrescencio@users.noreply.github.com>
Date: Wed, 27 Nov 2024 06:09:33 -0300
Subject: [PATCH] fix(ui): Profile avatar image motion setting #3044 (#3066)

Co-authored-by: null <null>
---
 components/account/AccountAvatar.vue | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/components/account/AccountAvatar.vue b/components/account/AccountAvatar.vue
index c7f52056..ac9ffbcb 100644
--- a/components/account/AccountAvatar.vue
+++ b/components/account/AccountAvatar.vue
@@ -1,13 +1,18 @@
 <script setup lang="ts">
 import type { mastodon } from 'masto'
 
-defineProps<{
+const { account, square } = defineProps<{
   account: mastodon.v1.Account
   square?: boolean
 }>()
 
 const loaded = ref(false)
 const error = ref(false)
+
+const preferredMotion = usePreferredReducedMotion()
+const accountAvatarSrc = computed(() => {
+  return preferredMotion.value === 'reduce' ? account.avatarStatic : account.avatar
+})
 </script>
 
 <template>
@@ -16,7 +21,7 @@ const error = ref(false)
     width="400"
     height="400"
     select-none
-    :src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
+    :src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : accountAvatarSrc"
     :alt="$t('account.avatar_description', [account.username])"
     loading="lazy"
     class="account-avatar"