fix: tooltip on presence (#30474)
This commit is contained in:
@@ -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) {
|
||||
case Presence.Online:
|
||||
return (
|
||||
@@ -142,7 +135,7 @@ function getAvatarDecoration(decoration: AvatarBadgeDecoration, presence: Presen
|
||||
/>
|
||||
);
|
||||
} 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>
|
||||
<svg
|
||||
aria-label="Away"
|
||||
aria-labelledby="«r14»"
|
||||
class="mx_RoomAvatarView_PresenceDecoration"
|
||||
color="var(--cpd-color-icon-quaternary)"
|
||||
fill="currentColor"
|
||||
@@ -234,6 +235,7 @@ exports[`<RoomAvatarView /> should render the BUSY presence 1`] = `
|
||||
</span>
|
||||
<svg
|
||||
aria-label="Busy"
|
||||
aria-labelledby="«ru»"
|
||||
class="mx_RoomAvatarView_PresenceDecoration"
|
||||
color="var(--cpd-color-icon-tertiary)"
|
||||
fill="currentColor"
|
||||
@@ -291,6 +293,7 @@ exports[`<RoomAvatarView /> should render the OFFLINE presence 1`] = `
|
||||
</span>
|
||||
<svg
|
||||
aria-label="Offline"
|
||||
aria-labelledby="«ro»"
|
||||
class="mx_RoomAvatarView_PresenceDecoration"
|
||||
color="var(--cpd-color-icon-tertiary)"
|
||||
fill="currentColor"
|
||||
@@ -348,6 +351,7 @@ exports[`<RoomAvatarView /> should render the ONLINE presence 1`] = `
|
||||
</span>
|
||||
<svg
|
||||
aria-label="Online"
|
||||
aria-labelledby="«ri»"
|
||||
class="mx_RoomAvatarView_PresenceDecoration"
|
||||
color="var(--cpd-color-icon-accent-primary)"
|
||||
fill="currentColor"
|
||||
|
||||
Reference in New Issue
Block a user