add user avatar content descriptions in shared components

This commit is contained in:
davotoula
2026-03-02 16:56:28 +00:00
parent 937f30b48d
commit daebea262a
3 changed files with 12 additions and 1 deletions
@@ -50,4 +50,7 @@
<string name="screen_messages_description">Your encrypted direct messages will appear here.</string> <string name="screen_messages_description">Your encrypted direct messages will appear here.</string>
<string name="screen_notifications_title">Notifications</string> <string name="screen_notifications_title">Notifications</string>
<string name="screen_notifications_description">Mentions, replies, and reactions will appear here.</string> <string name="screen_notifications_description">Mentions, replies, and reactions will appear here.</string>
<!-- Accessibility -->
<string name="accessibility_user_avatar">User avatar</string>
</resources> </resources>
@@ -35,9 +35,12 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.User
import com.vitorpamplona.amethyst.commons.resources.Res
import com.vitorpamplona.amethyst.commons.resources.accessibility_user_avatar
import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar
import com.vitorpamplona.amethyst.commons.ui.theme.ChatSize34dp import com.vitorpamplona.amethyst.commons.ui.theme.ChatSize34dp
import com.vitorpamplona.amethyst.commons.ui.theme.ChatStdPadding import com.vitorpamplona.amethyst.commons.ui.theme.ChatStdPadding
import org.jetbrains.compose.resources.stringResource
/** /**
* Shared chatroom header for a single-user conversation. * Shared chatroom header for a single-user conversation.
@@ -67,6 +70,7 @@ fun ChatroomHeader(
userHex = user.pubkeyHex, userHex = user.pubkeyHex,
pictureUrl = user.profilePicture(), pictureUrl = user.profilePicture(),
size = ChatSize34dp, size = ChatSize34dp,
contentDescription = stringResource(Res.string.accessibility_user_avatar),
) )
Column(modifier = Modifier.padding(start = 10.dp)) { Column(modifier = Modifier.padding(start = 10.dp)) {
@@ -114,6 +118,7 @@ fun GroupChatroomHeader(
userHex = firstUser.pubkeyHex, userHex = firstUser.pubkeyHex,
pictureUrl = firstUser.profilePicture(), pictureUrl = firstUser.profilePicture(),
size = ChatSize34dp, size = ChatSize34dp,
contentDescription = stringResource(Res.string.accessibility_user_avatar),
) )
} }
@@ -39,6 +39,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.User
import com.vitorpamplona.amethyst.commons.resources.Res
import com.vitorpamplona.amethyst.commons.resources.accessibility_user_avatar
import org.jetbrains.compose.resources.stringResource
/** /**
* A card displaying user search result with avatar, name, and nip05/pubkey. * A card displaying user search result with avatar, name, and nip05/pubkey.
@@ -69,7 +72,7 @@ fun UserSearchCard(
userHex = user.pubkeyHex, userHex = user.pubkeyHex,
pictureUrl = user.profilePicture(), pictureUrl = user.profilePicture(),
size = 40.dp, size = 40.dp,
contentDescription = "Profile picture", contentDescription = stringResource(Res.string.accessibility_user_avatar),
) )
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {