Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/components/views/avatars/RoomAvatarView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -142,7 +135,7 @@ function getAvatarDecoration(decoration: AvatarBadgeDecoration, presence: Presen
/>
);
} else if (decoration === AvatarBadgeDecoration.Presence) {
return <PresenceDecoration presence={presence!} />;
return getPresenceDecoration(presence!);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Loading