fix: tooltip on presence (#30474)

This commit is contained in:
Florian Duros
2025-08-04 13:54:38 +00:00
committed by GitHub
parent 475504d33b
commit 814f4a85df
2 changed files with 7 additions and 10 deletions
@@ -55,17 +55,10 @@ export function RoomAvatarView({ room }: RoomAvatarViewProps): JSX.Element {
); );
} }
type PresenceDecorationProps = {
/**
* The presence of the user in the DM room.
*/
presence: NonNullable<Presence>;
};
/** /**
* Component to display the presence of a user in a DM room. * Get the decoration for the avatar based on the presence.
*/ */
function PresenceDecoration({ presence }: PresenceDecorationProps): JSX.Element { function getPresenceDecoration(presence: Presence): JSX.Element {
switch (presence) { switch (presence) {
case Presence.Online: case Presence.Online:
return ( return (
@@ -142,7 +135,7 @@ function getAvatarDecoration(decoration: AvatarBadgeDecoration, presence: Presen
/> />
); );
} else if (decoration === AvatarBadgeDecoration.Presence) { } else if (decoration === AvatarBadgeDecoration.Presence) {
return <PresenceDecoration presence={presence!} />; return getPresenceDecoration(presence!);
} }
} }
@@ -179,6 +179,7 @@ exports[`<RoomAvatarView /> should render the AWAY presence 1`] = `
</span> </span>
<svg <svg
aria-label="Away" aria-label="Away"
aria-labelledby="«r14»"
class="mx_RoomAvatarView_PresenceDecoration" class="mx_RoomAvatarView_PresenceDecoration"
color="var(--cpd-color-icon-quaternary)" color="var(--cpd-color-icon-quaternary)"
fill="currentColor" fill="currentColor"
@@ -234,6 +235,7 @@ exports[`<RoomAvatarView /> should render the BUSY presence 1`] = `
</span> </span>
<svg <svg
aria-label="Busy" aria-label="Busy"
aria-labelledby="«ru»"
class="mx_RoomAvatarView_PresenceDecoration" class="mx_RoomAvatarView_PresenceDecoration"
color="var(--cpd-color-icon-tertiary)" color="var(--cpd-color-icon-tertiary)"
fill="currentColor" fill="currentColor"
@@ -291,6 +293,7 @@ exports[`<RoomAvatarView /> should render the OFFLINE presence 1`] = `
</span> </span>
<svg <svg
aria-label="Offline" aria-label="Offline"
aria-labelledby="«ro»"
class="mx_RoomAvatarView_PresenceDecoration" class="mx_RoomAvatarView_PresenceDecoration"
color="var(--cpd-color-icon-tertiary)" color="var(--cpd-color-icon-tertiary)"
fill="currentColor" fill="currentColor"
@@ -348,6 +351,7 @@ exports[`<RoomAvatarView /> should render the ONLINE presence 1`] = `
</span> </span>
<svg <svg
aria-label="Online" aria-label="Online"
aria-labelledby="«ri»"
class="mx_RoomAvatarView_PresenceDecoration" class="mx_RoomAvatarView_PresenceDecoration"
color="var(--cpd-color-icon-accent-primary)" color="var(--cpd-color-icon-accent-primary)"
fill="currentColor" fill="currentColor"