Skip to content

Commit

Permalink
Change muted text to icon
Browse files Browse the repository at this point in the history
  • Loading branch information
nikk15 committed Jul 4, 2023
1 parent 9b2c6f5 commit aec0dc8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
11 changes: 11 additions & 0 deletions src/react-components/icons/UserSoundOff.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/react-components/icons/UserSoundOn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 20 additions & 6 deletions src/react-components/room/PeopleSidebar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import PropTypes from "prop-types";
import { ToolTip } from "@mozilla/lilypad-ui";
import styles from "./PeopleSidebar.scss";
import { Sidebar } from "../sidebar/Sidebar";
import { CloseButton } from "../input/CloseButton";
Expand All @@ -13,10 +14,17 @@ import { ReactComponent as VolumeOffIcon } from "../icons/VolumeOff.svg";
import { ReactComponent as VolumeHighIcon } from "../icons/VolumeHigh.svg";
import { ReactComponent as VolumeMutedIcon } from "../icons/VolumeMuted.svg";
import { ReactComponent as HandRaisedIcon } from "../icons/HandRaised.svg";
import { ReactComponent as UserSoundOnIcon } from "../icons/UserSoundOn.svg";
import { ReactComponent as UserSoundOffIcon } from "../icons/UserSoundOff.svg";
import { List, ButtonListItem } from "../layout/List";
import { FormattedMessage, useIntl } from "react-intl";
import { FormattedMessage, defineMessage, useIntl } from "react-intl";
import { PermissionNotification } from "./PermissionNotifications";

const toolTipDescription = defineMessage({
id: "people-sidebar.muted-tooltip",
defaultMessage: "User is {mutedState}"
});

function getDeviceLabel(ctx, intl) {
if (ctx) {
if (ctx.hmd) {
Expand Down Expand Up @@ -112,6 +120,10 @@ export function PeopleSidebar({
me && filteredPeople.unshift(me);
const store = window.APP.store;

function getToolTipDescription(isMuted) {
return intl.formatMessage(toolTipDescription, { mutedState: isMuted ? "muted" : "not muted" });
}

return (
<Sidebar
title={
Expand Down Expand Up @@ -148,6 +160,13 @@ export function PeopleSidebar({
{person.hand_raised && <HandRaisedIcon />}
{<DeviceIcon title={getDeviceLabel(person.context, intl)} />}
{!person.context.discord && VoiceIcon && <VoiceIcon title={getVoiceLabel(person.micPresence, intl)} />}
<ToolTip description={getToolTipDescription(store._preferences?.avatarVoiceLevels?.[person.id]?.muted)}>
{store._preferences?.avatarVoiceLevels?.[person.id]?.muted ? (
<UserSoundOffIcon />
) : (
<UserSoundOnIcon />
)}
</ToolTip>
<p>{getPersonName(person, intl)}</p>
{person.roles.owner && (
<StarIcon
Expand All @@ -157,11 +176,6 @@ export function PeopleSidebar({
height={12}
/>
)}
{store._preferences?.avatarVoiceLevels?.[person.id]?.muted && (
<span className={styles.isMuted}>
{intl.formatMessage({ id: "people-sidebar.muted-label", defaultMessage: "muted" })}
</span>
)}
<p className={styles.presence}>{getPresenceMessage(person.presence, intl)}</p>
</ButtonListItem>
);
Expand Down
5 changes: 0 additions & 5 deletions src/react-components/room/PeopleSidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@
flex: 1;
justify-content: flex-end;
}

:local(.isMuted) {
font-style: italic;
color: theme.$color-semantic-warning;
}

0 comments on commit aec0dc8

Please sign in to comment.