Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 26a74a1

Browse files
Add Element Call room settings (#9347)
Co-authored-by: Robin <robin@robin.town>
1 parent 4ff9681 commit 26a74a1

File tree

21 files changed

+539
-67
lines changed

21 files changed

+539
-67
lines changed

res/css/views/dialogs/_RoomSettingsDialog.pcss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ limitations under the License.
2121
mask-image: url('$(res)/img/element-icons/settings.svg');
2222
}
2323

24+
.mx_RoomSettingsDialog_voiceIcon::before {
25+
mask-image: url('$(res)/img/element-icons/call/voice-call.svg');
26+
}
27+
2428
.mx_RoomSettingsDialog_securityIcon::before {
2529
mask-image: url('$(res)/img/element-icons/security.svg');
2630
}

src/IConfigOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export interface IConfigOptions {
119119
element_call: {
120120
url: string;
121121
use_exclusively: boolean;
122+
brand: string;
122123
};
123124

124125
logout_redirect_url?: string;

src/SdkConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const DEFAULTS: IConfigOptions = {
3333
element_call: {
3434
url: "https://call.element.io",
3535
use_exclusively: false,
36+
brand: "Element Call",
3637
},
3738

3839
// @ts-ignore - we deliberately use the camelCase version here so we trigger

src/components/views/dialogs/RoomSettingsDialog.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ import SettingsStore from "../../../settings/SettingsStore";
3232
import { UIFeature } from "../../../settings/UIFeature";
3333
import BaseDialog from "./BaseDialog";
3434
import { Action } from '../../../dispatcher/actions';
35+
import { VoipRoomSettingsTab } from "../settings/tabs/room/VoipRoomSettingsTab";
3536

3637
export const ROOM_GENERAL_TAB = "ROOM_GENERAL_TAB";
38+
export const ROOM_VOIP_TAB = "ROOM_VOIP_TAB";
3739
export const ROOM_SECURITY_TAB = "ROOM_SECURITY_TAB";
3840
export const ROOM_ROLES_TAB = "ROOM_ROLES_TAB";
3941
export const ROOM_NOTIFICATIONS_TAB = "ROOM_NOTIFICATIONS_TAB";
@@ -96,6 +98,14 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
9698
<GeneralRoomSettingsTab roomId={this.props.roomId} />,
9799
"RoomSettingsGeneral",
98100
));
101+
if (SettingsStore.getValue("feature_group_calls")) {
102+
tabs.push(new Tab(
103+
ROOM_VOIP_TAB,
104+
_td("Voice & Video"),
105+
"mx_RoomSettingsDialog_voiceIcon",
106+
<VoipRoomSettingsTab roomId={this.props.roomId} />,
107+
));
108+
}
99109
tabs.push(new Tab(
100110
ROOM_SECURITY_TAB,
101111
_td("Security & Privacy"),

src/components/views/elements/AccessibleTooltipButton.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import AccessibleButton from "./AccessibleButton";
2121
import Tooltip, { Alignment } from './Tooltip';
2222

2323
interface IProps extends React.ComponentProps<typeof AccessibleButton> {
24-
title: string;
24+
title?: string;
2525
tooltip?: React.ReactNode;
2626
label?: string;
2727
tooltipClassName?: string;
@@ -78,19 +78,19 @@ export default class AccessibleTooltipButton extends React.PureComponent<IProps,
7878
const { title, tooltip, children, tooltipClassName, forceHide, alignment, onHideTooltip,
7979
...props } = this.props;
8080

81-
const tip = this.state.hover && <Tooltip
81+
const tip = this.state.hover && (title || tooltip) && <Tooltip
8282
tooltipClassName={tooltipClassName}
8383
label={tooltip || title}
8484
alignment={alignment}
8585
/>;
8686
return (
8787
<AccessibleButton
8888
{...props}
89-
onMouseOver={this.showTooltip}
90-
onMouseLeave={this.hideTooltip}
91-
onFocus={this.onFocus}
92-
onBlur={this.hideTooltip}
93-
aria-label={title}
89+
onMouseOver={this.showTooltip || props.onMouseOver}
90+
onMouseLeave={this.hideTooltip || props.onMouseLeave}
91+
onFocus={this.onFocus || props.onFocus}
92+
onBlur={this.hideTooltip || props.onBlur}
93+
aria-label={title || props["aria-label"]}
9494
>
9595
{ children }
9696
{ this.props.label }

src/components/views/elements/LabelledToggleSwitch.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ interface IProps {
2727
label: string;
2828
// The translated caption for the switch
2929
caption?: string;
30+
// Tooltip to display
31+
tooltip?: string;
3032
// Whether or not to disable the toggle switch
3133
disabled?: boolean;
3234
// True to put the toggle in front of the label
@@ -53,7 +55,8 @@ export default class LabelledToggleSwitch extends React.PureComponent<IProps> {
5355
checked={this.props.value}
5456
disabled={this.props.disabled}
5557
onChange={this.props.onChange}
56-
aria-label={this.props.label}
58+
title={this.props.label}
59+
tooltip={this.props.tooltip}
5760
/>;
5861

5962
if (this.props.toggleInFront) {
@@ -66,7 +69,7 @@ export default class LabelledToggleSwitch extends React.PureComponent<IProps> {
6669
"mx_SettingsFlag_toggleInFront": this.props.toggleInFront,
6770
});
6871
return (
69-
<div className={classes}>
72+
<div data-testid={this.props["data-testid"]} className={classes}>
7073
{ firstPart }
7174
{ secondPart }
7275
</div>

src/components/views/elements/SettingsFlag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default class SettingsFlag extends React.Component<IProps, IState> {
114114
checked={this.state.value}
115115
onChange={this.onChange}
116116
disabled={this.props.disabled || !canChange}
117-
aria-label={label}
117+
title={label}
118118
/>
119119
</div>
120120
);

src/components/views/elements/ToggleSwitch.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,27 @@ limitations under the License.
1818
import React from "react";
1919
import classNames from "classnames";
2020

21-
import AccessibleButton from "./AccessibleButton";
21+
import AccessibleTooltipButton from "./AccessibleTooltipButton";
2222

2323
interface IProps {
2424
// Whether or not this toggle is in the 'on' position.
2525
checked: boolean;
2626

27+
// Title to use
28+
title?: string;
29+
2730
// Whether or not the user can interact with the switch
2831
disabled?: boolean;
2932

33+
// Tooltip to show
34+
tooltip?: string;
35+
3036
// Called when the checked state changes. First argument will be the new state.
3137
onChange(checked: boolean): void;
3238
}
3339

3440
// Controlled Toggle Switch element, written with Accessibility in mind
35-
export default ({ checked, disabled = false, onChange, ...props }: IProps) => {
41+
export default ({ checked, disabled = false, title, tooltip, onChange, ...props }: IProps) => {
3642
const _onClick = () => {
3743
if (disabled) return;
3844
onChange(!checked);
@@ -45,14 +51,16 @@ export default ({ checked, disabled = false, onChange, ...props }: IProps) => {
4551
});
4652

4753
return (
48-
<AccessibleButton {...props}
54+
<AccessibleTooltipButton {...props}
4955
className={classes}
5056
onClick={_onClick}
5157
role="switch"
5258
aria-checked={checked}
5359
aria-disabled={disabled}
60+
title={title}
61+
tooltip={tooltip}
5462
>
5563
<div className="mx_ToggleSwitch_ball" />
56-
</AccessibleButton>
64+
</AccessibleTooltipButton>
5765
);
5866
};

src/components/views/rooms/RoomHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
195195
let menu: JSX.Element | null = null;
196196
if (menuOpen) {
197197
const buttonRect = buttonRef.current!.getBoundingClientRect();
198+
const brand = SdkConfig.get("element_call").brand;
198199
menu = <IconizedContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
199200
<IconizedContextMenuOptionList>
200201
<IconizedContextMenuOption label={_t("Video call (Jitsi)")} onClick={onJitsiClick} />
201-
<IconizedContextMenuOption label={_t("Video call (Element Call)")} onClick={onElementClick} />
202+
<IconizedContextMenuOption label={_t("Video call (%(brand)s)", { brand })} onClick={onElementClick} />
202203
</IconizedContextMenuOptionList>
203204
</IconizedContextMenu>;
204205
}

src/components/views/settings/devices/DeviceDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const DeviceDetails: React.FC<Props> = ({
153153
checked={isPushNotificationsEnabled(pusher, localNotificationSettings)}
154154
disabled={isCheckboxDisabled(pusher, localNotificationSettings)}
155155
onChange={checked => setPushNotifications?.(device.device_id, checked)}
156-
aria-label={_t("Toggle push notifications on this session.")}
156+
title={_t("Toggle push notifications on this session.")}
157157
data-testid='device-detail-push-notification-checkbox'
158158
/>
159159
<p className='mx_DeviceDetails_sectionHeading'>

0 commit comments

Comments
 (0)