Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -88,7 +88,8 @@ export const showToast = (): void => {
|
|||
// them to opt in again.
|
||||
props = {
|
||||
description: _t(
|
||||
"You previously consented to share anonymous usage data with us. We're updating how that works."),
|
||||
"You previously consented to share anonymous usage data with us. We're updating how that works.",
|
||||
),
|
||||
acceptLabel: _t("That's fine"),
|
||||
onAccept,
|
||||
rejectLabel: _t("Learn more"),
|
||||
|
@ -98,18 +99,24 @@ export const showToast = (): void => {
|
|||
// The user had no analytics setting previously set, so we just need to prompt to opt-in, rather than
|
||||
// explaining any change.
|
||||
const learnMoreLink = (sub: string) => (
|
||||
<AccessibleButton kind="link_inline" onClick={onLearnMoreNoOptIn}>{ sub }</AccessibleButton>
|
||||
<AccessibleButton kind="link_inline" onClick={onLearnMoreNoOptIn}>
|
||||
{sub}
|
||||
</AccessibleButton>
|
||||
);
|
||||
props = {
|
||||
description: _t(
|
||||
"Share anonymous data to help us identify issues. Nothing personal. No third parties. " +
|
||||
"<LearnMoreLink>Learn More</LearnMoreLink>", {}, { "LearnMoreLink": learnMoreLink }),
|
||||
"<LearnMoreLink>Learn More</LearnMoreLink>",
|
||||
{},
|
||||
{ LearnMoreLink: learnMoreLink },
|
||||
),
|
||||
acceptLabel: _t("Yes"),
|
||||
onAccept,
|
||||
rejectLabel: _t("No"),
|
||||
onReject,
|
||||
};
|
||||
} else { // false
|
||||
} else {
|
||||
// false
|
||||
// The user previously opted out of analytics, don't ask again
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { _t } from '../languageHandler';
|
||||
import { _t } from "../languageHandler";
|
||||
import dis from "../dispatcher/dispatcher";
|
||||
import DeviceListener from '../DeviceListener';
|
||||
import DeviceListener from "../DeviceListener";
|
||||
import GenericToast from "../components/views/toasts/GenericToast";
|
||||
import ToastStore from "../stores/ToastStore";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
import { snoozeBulkUnverifiedDeviceReminder } from '../utils/device/snoozeBulkUnverifiedDeviceReminder';
|
||||
import { snoozeBulkUnverifiedDeviceReminder } from "../utils/device/snoozeBulkUnverifiedDeviceReminder";
|
||||
|
||||
const TOAST_KEY = "reviewsessions";
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
|
||||
import { _t } from '../languageHandler';
|
||||
import RoomAvatar from '../components/views/avatars/RoomAvatar';
|
||||
import { _t } from "../languageHandler";
|
||||
import RoomAvatar from "../components/views/avatars/RoomAvatar";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
|
||||
|
@ -47,15 +47,17 @@ interface JoinCallButtonWithCallProps {
|
|||
function JoinCallButtonWithCall({ onClick, call }: JoinCallButtonWithCallProps) {
|
||||
const disabledTooltip = useJoinCallButtonDisabledTooltip(call);
|
||||
|
||||
return <AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_joinButton"
|
||||
onClick={onClick}
|
||||
disabled={disabledTooltip !== null}
|
||||
tooltip={disabledTooltip}
|
||||
kind="primary"
|
||||
>
|
||||
{ _t("Join") }
|
||||
</AccessibleTooltipButton>;
|
||||
return (
|
||||
<AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_joinButton"
|
||||
onClick={onClick}
|
||||
disabled={disabledTooltip !== null}
|
||||
tooltip={disabledTooltip}
|
||||
kind="primary"
|
||||
>
|
||||
{_t("Join")}
|
||||
</AccessibleTooltipButton>
|
||||
);
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
@ -71,9 +73,15 @@ export function IncomingCallToast({ callEvent }: Props) {
|
|||
ToastStore.sharedInstance().dismissToast(getIncomingCallToastKey(callEvent.getStateKey()!));
|
||||
}, [callEvent]);
|
||||
|
||||
const latestEvent = useRoomState(room, useCallback((state) => {
|
||||
return state.getStateEvents(callEvent.getType(), callEvent.getStateKey()!);
|
||||
}, [callEvent]));
|
||||
const latestEvent = useRoomState(
|
||||
room,
|
||||
useCallback(
|
||||
(state) => {
|
||||
return state.getStateEvents(callEvent.getType(), callEvent.getStateKey()!);
|
||||
},
|
||||
[callEvent],
|
||||
),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if ("m.terminated" in latestEvent.getContent()) {
|
||||
|
@ -81,73 +89,77 @@ export function IncomingCallToast({ callEvent }: Props) {
|
|||
}
|
||||
}, [latestEvent, dismissToast]);
|
||||
|
||||
useDispatcher(defaultDispatcher, useCallback((payload: ActionPayload) => {
|
||||
if (
|
||||
payload.action === Action.ViewRoom
|
||||
&& payload.room_id === roomId
|
||||
&& payload.view_call
|
||||
) {
|
||||
dismissToast();
|
||||
}
|
||||
}, [roomId, dismissToast]));
|
||||
|
||||
const onJoinClick = useCallback((e: ButtonEvent): void => {
|
||||
e.stopPropagation();
|
||||
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
view_call: true,
|
||||
metricsTrigger: undefined,
|
||||
});
|
||||
dismissToast();
|
||||
}, [room, dismissToast]);
|
||||
|
||||
const onCloseClick = useCallback((e: ButtonEvent): void => {
|
||||
e.stopPropagation();
|
||||
|
||||
dismissToast();
|
||||
}, [dismissToast]);
|
||||
|
||||
return <React.Fragment>
|
||||
<RoomAvatar
|
||||
room={room ?? undefined}
|
||||
height={24}
|
||||
width={24}
|
||||
/>
|
||||
<div className="mx_IncomingCallToast_content">
|
||||
<div className="mx_IncomingCallToast_info">
|
||||
<span className="mx_IncomingCallToast_room">
|
||||
{ room ? room.name : _t("Unknown room") }
|
||||
</span>
|
||||
<div className="mx_IncomingCallToast_message">
|
||||
{ _t("Video call started") }
|
||||
</div>
|
||||
{ call
|
||||
? <LiveContentSummaryWithCall call={call} />
|
||||
: <LiveContentSummary
|
||||
type={LiveContentType.Video}
|
||||
text={_t("Video")}
|
||||
active={false}
|
||||
participantCount={0}
|
||||
/>
|
||||
useDispatcher(
|
||||
defaultDispatcher,
|
||||
useCallback(
|
||||
(payload: ActionPayload) => {
|
||||
if (payload.action === Action.ViewRoom && payload.room_id === roomId && payload.view_call) {
|
||||
dismissToast();
|
||||
}
|
||||
},
|
||||
[roomId, dismissToast],
|
||||
),
|
||||
);
|
||||
|
||||
const onJoinClick = useCallback(
|
||||
(e: ButtonEvent): void => {
|
||||
e.stopPropagation();
|
||||
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
view_call: true,
|
||||
metricsTrigger: undefined,
|
||||
});
|
||||
dismissToast();
|
||||
},
|
||||
[room, dismissToast],
|
||||
);
|
||||
|
||||
const onCloseClick = useCallback(
|
||||
(e: ButtonEvent): void => {
|
||||
e.stopPropagation();
|
||||
|
||||
dismissToast();
|
||||
},
|
||||
[dismissToast],
|
||||
);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<RoomAvatar room={room ?? undefined} height={24} width={24} />
|
||||
<div className="mx_IncomingCallToast_content">
|
||||
<div className="mx_IncomingCallToast_info">
|
||||
<span className="mx_IncomingCallToast_room">{room ? room.name : _t("Unknown room")}</span>
|
||||
<div className="mx_IncomingCallToast_message">{_t("Video call started")}</div>
|
||||
{call ? (
|
||||
<LiveContentSummaryWithCall call={call} />
|
||||
) : (
|
||||
<LiveContentSummary
|
||||
type={LiveContentType.Video}
|
||||
text={_t("Video")}
|
||||
active={false}
|
||||
participantCount={0}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{call ? (
|
||||
<JoinCallButtonWithCall onClick={onJoinClick} call={call} />
|
||||
) : (
|
||||
<AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_joinButton"
|
||||
onClick={onJoinClick}
|
||||
kind="primary"
|
||||
>
|
||||
{_t("Join")}
|
||||
</AccessibleTooltipButton>
|
||||
)}
|
||||
</div>
|
||||
{ call
|
||||
? <JoinCallButtonWithCall onClick={onJoinClick} call={call} />
|
||||
: <AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_joinButton"
|
||||
onClick={onJoinClick}
|
||||
kind="primary"
|
||||
>
|
||||
{ _t("Join") }
|
||||
</AccessibleTooltipButton>
|
||||
}
|
||||
</div>
|
||||
<AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_closeButton"
|
||||
onClick={onCloseClick}
|
||||
title={_t("Close")}
|
||||
/>
|
||||
</React.Fragment>;
|
||||
<AccessibleTooltipButton
|
||||
className="mx_IncomingCallToast_closeButton"
|
||||
onClick={onCloseClick}
|
||||
title={_t("Close")}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,16 +17,16 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { CallType, MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
|
||||
import classNames from 'classnames';
|
||||
import React from "react";
|
||||
import { CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
|
||||
import classNames from "classnames";
|
||||
|
||||
import LegacyCallHandler, { LegacyCallHandlerEvent } from '../LegacyCallHandler';
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import { _t } from '../languageHandler';
|
||||
import RoomAvatar from '../components/views/avatars/RoomAvatar';
|
||||
import AccessibleTooltipButton from '../components/views/elements/AccessibleTooltipButton';
|
||||
import AccessibleButton from '../components/views/elements/AccessibleButton';
|
||||
import LegacyCallHandler, { LegacyCallHandlerEvent } from "../LegacyCallHandler";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import { _t } from "../languageHandler";
|
||||
import RoomAvatar from "../components/views/avatars/RoomAvatar";
|
||||
import AccessibleTooltipButton from "../components/views/elements/AccessibleTooltipButton";
|
||||
import AccessibleButton from "../components/views/elements/AccessibleButton";
|
||||
|
||||
export const getIncomingLegacyCallToastKey = (callId: string) => `call_${callId}`;
|
||||
|
||||
|
@ -49,13 +49,15 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
|
|||
|
||||
public componentDidMount = (): void => {
|
||||
LegacyCallHandler.instance.addListener(
|
||||
LegacyCallHandlerEvent.SilencedCallsChanged, this.onSilencedCallsChanged,
|
||||
LegacyCallHandlerEvent.SilencedCallsChanged,
|
||||
this.onSilencedCallsChanged,
|
||||
);
|
||||
};
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
LegacyCallHandler.instance.removeListener(
|
||||
LegacyCallHandlerEvent.SilencedCallsChanged, this.onSilencedCallsChanged,
|
||||
LegacyCallHandlerEvent.SilencedCallsChanged,
|
||||
this.onSilencedCallsChanged,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -68,7 +70,7 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
|
|||
LegacyCallHandler.instance.answerCall(LegacyCallHandler.instance.roomIdForCall(this.props.call));
|
||||
};
|
||||
|
||||
private onRejectClick= (e: React.MouseEvent): void => {
|
||||
private onRejectClick = (e: React.MouseEvent): void => {
|
||||
e.stopPropagation();
|
||||
LegacyCallHandler.instance.hangupOrReject(LegacyCallHandler.instance.roomIdForCall(this.props.call), true);
|
||||
};
|
||||
|
@ -76,9 +78,9 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
|
|||
private onSilenceClick = (e: React.MouseEvent): void => {
|
||||
e.stopPropagation();
|
||||
const callId = this.props.call.callId;
|
||||
this.state.silenced ?
|
||||
LegacyCallHandler.instance.unSilenceCall(callId) :
|
||||
LegacyCallHandler.instance.silenceCall(callId);
|
||||
this.state.silenced
|
||||
? LegacyCallHandler.instance.unSilenceCall(callId)
|
||||
: LegacyCallHandler.instance.silenceCall(callId);
|
||||
};
|
||||
|
||||
public render() {
|
||||
|
@ -93,51 +95,47 @@ export default class IncomingLegacyCallToast extends React.Component<IProps, ISt
|
|||
}
|
||||
|
||||
const contentClass = classNames("mx_IncomingLegacyCallToast_content", {
|
||||
"mx_IncomingLegacyCallToast_content_voice": isVoice,
|
||||
"mx_IncomingLegacyCallToast_content_video": !isVoice,
|
||||
mx_IncomingLegacyCallToast_content_voice: isVoice,
|
||||
mx_IncomingLegacyCallToast_content_video: !isVoice,
|
||||
});
|
||||
const silenceClass = classNames("mx_IncomingLegacyCallToast_iconButton", {
|
||||
"mx_IncomingLegacyCallToast_unSilence": this.state.silenced,
|
||||
"mx_IncomingLegacyCallToast_silence": !this.state.silenced,
|
||||
mx_IncomingLegacyCallToast_unSilence: this.state.silenced,
|
||||
mx_IncomingLegacyCallToast_silence: !this.state.silenced,
|
||||
});
|
||||
|
||||
return <React.Fragment>
|
||||
<RoomAvatar
|
||||
room={room ?? undefined}
|
||||
height={32}
|
||||
width={32}
|
||||
/>
|
||||
<div className={contentClass}>
|
||||
<span className="mx_LegacyCallEvent_caller">
|
||||
{ room ? room.name : _t("Unknown caller") }
|
||||
</span>
|
||||
<div className="mx_LegacyCallEvent_type">
|
||||
<div className="mx_LegacyCallEvent_type_icon" />
|
||||
{ isVoice ? _t("Voice call") : _t("Video call") }
|
||||
return (
|
||||
<React.Fragment>
|
||||
<RoomAvatar room={room ?? undefined} height={32} width={32} />
|
||||
<div className={contentClass}>
|
||||
<span className="mx_LegacyCallEvent_caller">{room ? room.name : _t("Unknown caller")}</span>
|
||||
<div className="mx_LegacyCallEvent_type">
|
||||
<div className="mx_LegacyCallEvent_type_icon" />
|
||||
{isVoice ? _t("Voice call") : _t("Video call")}
|
||||
</div>
|
||||
<div className="mx_IncomingLegacyCallToast_buttons">
|
||||
<AccessibleButton
|
||||
className="mx_IncomingLegacyCallToast_button mx_IncomingLegacyCallToast_button_decline"
|
||||
onClick={this.onRejectClick}
|
||||
kind="danger"
|
||||
>
|
||||
<span> {_t("Decline")} </span>
|
||||
</AccessibleButton>
|
||||
<AccessibleButton
|
||||
className="mx_IncomingLegacyCallToast_button mx_IncomingLegacyCallToast_button_accept"
|
||||
onClick={this.onAnswerClick}
|
||||
kind="primary"
|
||||
>
|
||||
<span> {_t("Accept")} </span>
|
||||
</AccessibleButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mx_IncomingLegacyCallToast_buttons">
|
||||
<AccessibleButton
|
||||
className="mx_IncomingLegacyCallToast_button mx_IncomingLegacyCallToast_button_decline"
|
||||
onClick={this.onRejectClick}
|
||||
kind="danger"
|
||||
>
|
||||
<span> { _t("Decline") } </span>
|
||||
</AccessibleButton>
|
||||
<AccessibleButton
|
||||
className="mx_IncomingLegacyCallToast_button mx_IncomingLegacyCallToast_button_accept"
|
||||
onClick={this.onAnswerClick}
|
||||
kind="primary"
|
||||
>
|
||||
<span> { _t("Accept") } </span>
|
||||
</AccessibleButton>
|
||||
</div>
|
||||
</div>
|
||||
<AccessibleTooltipButton
|
||||
className={silenceClass}
|
||||
disabled={callForcedSilent}
|
||||
onClick={this.onSilenceClick}
|
||||
title={silenceButtonTooltip}
|
||||
/>
|
||||
</React.Fragment>;
|
||||
<AccessibleTooltipButton
|
||||
className={silenceClass}
|
||||
disabled={callForcedSilent}
|
||||
onClick={this.onSilenceClick}
|
||||
title={silenceButtonTooltip}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ export const showToast = () => {
|
|||
props: {
|
||||
description: _t(
|
||||
"%(brand)s is experimental on a mobile web browser. " +
|
||||
"For a better experience and the latest features, use our free native app.", { brand },
|
||||
"For a better experience and the latest features, use our free native app.",
|
||||
{ brand },
|
||||
),
|
||||
acceptLabel: _t("Use app"),
|
||||
onAccept,
|
||||
|
|
|
@ -25,19 +25,23 @@ const TOAST_KEY = "serverlimit";
|
|||
|
||||
export const showToast = (limitType: string, onHideToast: () => void, adminContact?: string, syncError?: boolean) => {
|
||||
const errorText = messageForResourceLimitError(limitType, adminContact, {
|
||||
'monthly_active_user': _td("Your homeserver has exceeded its user limit."),
|
||||
'hs_blocked': _td("This homeserver has been blocked by its administrator."),
|
||||
'': _td("Your homeserver has exceeded one of its resource limits."),
|
||||
"monthly_active_user": _td("Your homeserver has exceeded its user limit."),
|
||||
"hs_blocked": _td("This homeserver has been blocked by its administrator."),
|
||||
"": _td("Your homeserver has exceeded one of its resource limits."),
|
||||
});
|
||||
const contactText = messageForResourceLimitError(limitType, adminContact, {
|
||||
'': _td("Contact your <a>server admin</a>."),
|
||||
"": _td("Contact your <a>server admin</a>."),
|
||||
});
|
||||
|
||||
ToastStore.sharedInstance().addOrReplaceToast({
|
||||
key: TOAST_KEY,
|
||||
title: _t("Warning"),
|
||||
props: {
|
||||
description: <React.Fragment>{ errorText } { contactText }</React.Fragment>,
|
||||
description: (
|
||||
<React.Fragment>
|
||||
{errorText} {contactText}
|
||||
</React.Fragment>
|
||||
),
|
||||
acceptLabel: _t("Ok"),
|
||||
onAccept: () => {
|
||||
hideToast();
|
||||
|
|
|
@ -85,11 +85,14 @@ export const showToast = (kind: Kind) => {
|
|||
|
||||
const onAccept = async () => {
|
||||
if (kind === Kind.VERIFY_THIS_SESSION) {
|
||||
Modal.createDialog(SetupEncryptionDialog,
|
||||
{}, null, /* priority = */ false, /* static = */ true);
|
||||
Modal.createDialog(SetupEncryptionDialog, {}, null, /* priority = */ false, /* static = */ true);
|
||||
} else {
|
||||
const modal = Modal.createDialog(
|
||||
Spinner, null, "mx_Dialog_spinner", /* priority */ false, /* static */ true,
|
||||
Spinner,
|
||||
null,
|
||||
"mx_Dialog_spinner",
|
||||
/* priority */ false,
|
||||
/* static */ true,
|
||||
);
|
||||
try {
|
||||
await accessSecretStorage();
|
||||
|
|
|
@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { _t } from '../languageHandler';
|
||||
import { _t } from "../languageHandler";
|
||||
import dis from "../dispatcher/dispatcher";
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import DeviceListener from '../DeviceListener';
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import DeviceListener from "../DeviceListener";
|
||||
import ToastStore from "../stores/ToastStore";
|
||||
import GenericToast from "../components/views/toasts/GenericToast";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
|
|
|
@ -32,8 +32,8 @@ const TOAST_KEY = "update";
|
|||
* dialog ([element-version]-react-[react-sdk-version]-js-[js-sdk-version])
|
||||
*/
|
||||
function checkVersion(ver) {
|
||||
const parts = ver.split('-');
|
||||
return parts.length === 5 && parts[1] === 'react' && parts[3] === 'js';
|
||||
const parts = ver.split("-");
|
||||
return parts.length === 5 && parts[1] === "react" && parts[3] === "js";
|
||||
}
|
||||
|
||||
function installUpdate() {
|
||||
|
@ -51,7 +51,7 @@ export const showToast = (version: string, newVersion: string, releaseNotes?: st
|
|||
onAccept = () => {
|
||||
Modal.createDialog(QuestionDialog, {
|
||||
title: _t("What's New"),
|
||||
description: <pre>{ releaseNotes }</pre>,
|
||||
description: <pre>{releaseNotes}</pre>,
|
||||
button: _t("Update"),
|
||||
onFinished: (update) => {
|
||||
if (update && PlatformPeg.get()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue