Enable @typescript-eslint/explicit-function-return-type
in /src (#9788)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier * Enable `@typescript-eslint/explicit-function-return-type` in /src * Fix types * tsc strict fixes * Delint * Fix test * Fix bad merge
This commit is contained in:
parent
7a36ba0fde
commit
030b7e90bf
683 changed files with 3459 additions and 3013 deletions
|
@ -52,7 +52,11 @@ interface IProps {
|
|||
onFinished(added?: boolean): void;
|
||||
}
|
||||
|
||||
export const Entry = ({ room, checked, onChange }) => {
|
||||
export const Entry: React.FC<{
|
||||
room: Room;
|
||||
checked: boolean;
|
||||
onChange(value: boolean): void;
|
||||
}> = ({ room, checked, onChange }) => {
|
||||
return (
|
||||
<label className="mx_AddExistingToSpace_entry">
|
||||
{room?.isSpaceRoom() ? (
|
||||
|
@ -62,7 +66,7 @@ export const Entry = ({ room, checked, onChange }) => {
|
|||
)}
|
||||
<span className="mx_AddExistingToSpace_entry_name">{room.name}</span>
|
||||
<StyledCheckbox
|
||||
onChange={onChange ? (e) => onChange(e.target.checked) : null}
|
||||
onChange={onChange ? (e) => onChange(e.currentTarget.checked) : null}
|
||||
checked={checked}
|
||||
disabled={!onChange}
|
||||
/>
|
||||
|
@ -183,7 +187,7 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
|||
);
|
||||
}, [visibleRooms, space, lcQuery, existingRoomsSet, existingSubspacesSet]);
|
||||
|
||||
const addRooms = async () => {
|
||||
const addRooms = async (): Promise<void> => {
|
||||
setError(null);
|
||||
setProgress(0);
|
||||
|
||||
|
@ -192,10 +196,11 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
|||
for (const room of selectedToAdd) {
|
||||
const via = calculateRoomVia(room);
|
||||
try {
|
||||
await SpaceStore.instance.addRoomToSpace(space, room.roomId, via).catch(async (e) => {
|
||||
await SpaceStore.instance.addRoomToSpace(space, room.roomId, via).catch(async (e): Promise<void> => {
|
||||
if (e.errcode === "M_LIMIT_EXCEEDED") {
|
||||
await sleep(e.data.retry_after_ms);
|
||||
return SpaceStore.instance.addRoomToSpace(space, room.roomId, via); // retry
|
||||
await SpaceStore.instance.addRoomToSpace(space, room.roomId, via); // retry
|
||||
return;
|
||||
}
|
||||
|
||||
throw e;
|
||||
|
@ -291,7 +296,7 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
|||
noResults = false;
|
||||
}
|
||||
|
||||
const onScroll = () => {
|
||||
const onScroll = (): void => {
|
||||
const body = scrollRef.current?.containerRef.current;
|
||||
setScrollState({
|
||||
scrollTop: body.scrollTop,
|
||||
|
@ -299,7 +304,7 @@ export const AddExistingToSpace: React.FC<IAddExistingToSpaceProps> = ({
|
|||
});
|
||||
};
|
||||
|
||||
const wrappedRef = (body: HTMLDivElement) => {
|
||||
const wrappedRef = (body: HTMLDivElement): void => {
|
||||
setScrollState({
|
||||
scrollTop: body.scrollTop,
|
||||
height: body.clientHeight,
|
||||
|
@ -382,7 +387,7 @@ interface ISubspaceSelectorProps {
|
|||
onChange(space: Room): void;
|
||||
}
|
||||
|
||||
export const SubspaceSelector = ({ title, space, value, onChange }: ISubspaceSelectorProps) => {
|
||||
export const SubspaceSelector: React.FC<ISubspaceSelectorProps> = ({ title, space, value, onChange }) => {
|
||||
const options = useMemo(() => {
|
||||
return [
|
||||
space,
|
||||
|
|
|
@ -45,8 +45,8 @@ export const AnalyticsLearnMoreDialog: React.FC<IProps> = ({
|
|||
cancelButton,
|
||||
hasCancel,
|
||||
}) => {
|
||||
const onPrimaryButtonClick = () => onFinished && onFinished(ButtonClicked.Primary);
|
||||
const onCancelButtonClick = () => onFinished && onFinished(ButtonClicked.Cancel);
|
||||
const onPrimaryButtonClick = (): void => onFinished?.(ButtonClicked.Primary);
|
||||
const onCancelButtonClick = (): void => onFinished?.(ButtonClicked.Cancel);
|
||||
const privacyPolicyLink = privacyPolicyUrl ? (
|
||||
<span>
|
||||
{_t(
|
||||
|
|
|
@ -48,7 +48,7 @@ export default class AskInviteAnywayDialog extends React.Component<IProps> {
|
|||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const errorList = this.props.unknownProfileUsers.map((address) => (
|
||||
<li key={address.userId}>
|
||||
{address.userId}: {address.errorText}
|
||||
|
|
|
@ -79,7 +79,7 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
|
|||
});
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
this.unmounted = true;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
|
|||
this.setState({ downloadProgress });
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let error = null;
|
||||
if (this.state.err) {
|
||||
error = <div className="error">{this.state.err}</div>;
|
||||
|
|
|
@ -79,7 +79,7 @@ const BulkRedactDialog: React.FC<IBulkRedactDialogProps> = (props) => {
|
|||
const count = eventsToRedact.length;
|
||||
const user = member.name;
|
||||
|
||||
const redact = async () => {
|
||||
const redact = async (): Promise<void> => {
|
||||
logger.info(`Started redacting recent ${count} messages for ${member.userId} in ${room.roomId}`);
|
||||
dis.dispatch({
|
||||
action: Action.BulkRedactStart,
|
||||
|
@ -90,7 +90,7 @@ const BulkRedactDialog: React.FC<IBulkRedactDialogProps> = (props) => {
|
|||
// so first yield to allow to rerender after closing the dialog.
|
||||
await Promise.resolve();
|
||||
await Promise.all(
|
||||
eventsToRedact.reverse().map(async (event) => {
|
||||
eventsToRedact.reverse().map(async (event): Promise<void> => {
|
||||
try {
|
||||
await cli.redactEvent(room.roomId, event.getId());
|
||||
} catch (err) {
|
||||
|
|
|
@ -54,7 +54,7 @@ export default class ChangelogDialog extends React.Component<IProps> {
|
|||
}
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
const version = this.props.newVersion.split("-");
|
||||
const version2 = this.props.version.split("-");
|
||||
if (version == null || version2 == null) return;
|
||||
|
@ -76,7 +76,7 @@ export default class ChangelogDialog extends React.Component<IProps> {
|
|||
);
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const logs = REPOS.map((repo) => {
|
||||
let content;
|
||||
if (this.state[repo] == null) {
|
||||
|
|
|
@ -72,7 +72,7 @@ export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IPro
|
|||
}
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
if (this.state.isRedacting) {
|
||||
if (this.state.redactionErrorCode) {
|
||||
const code = this.state.redactionErrorCode;
|
||||
|
|
|
@ -33,7 +33,7 @@ interface IProps {
|
|||
* A dialog for confirming a redaction.
|
||||
*/
|
||||
export default class ConfirmRedactDialog extends React.Component<IProps> {
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<TextInputDialog
|
||||
onFinished={this.props.onFinished}
|
||||
|
@ -56,7 +56,7 @@ export function createRedactEventDialog({
|
|||
}: {
|
||||
mxEvent: MatrixEvent;
|
||||
onCloseDialog?: () => void;
|
||||
}) {
|
||||
}): void {
|
||||
const eventId = mxEvent.getId();
|
||||
|
||||
if (!eventId) throw new Error("cannot redact event without ID");
|
||||
|
@ -64,11 +64,10 @@ export function createRedactEventDialog({
|
|||
const roomId = mxEvent.getRoomId();
|
||||
|
||||
if (!roomId) throw new Error(`cannot redact event ${mxEvent.getId()} without room ID`);
|
||||
|
||||
Modal.createDialog(
|
||||
ConfirmRedactDialog,
|
||||
{
|
||||
onFinished: async (proceed: boolean, reason?: string) => {
|
||||
onFinished: async (proceed: boolean, reason?: string): Promise<void> => {
|
||||
if (!proceed) return;
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
|
|
|
@ -77,13 +77,13 @@ export default class ConfirmUserActionDialog extends React.Component<IProps, ISt
|
|||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private onReasonChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onReasonChange = (ev: ChangeEvent<HTMLInputElement>): void => {
|
||||
this.setState({
|
||||
reason: ev.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const confirmButtonClass = this.props.danger ? "danger" : "";
|
||||
|
||||
let reasonBox;
|
||||
|
|
|
@ -33,7 +33,7 @@ export default class ConfirmWipeDeviceDialog extends React.Component<IProps> {
|
|||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_ConfirmWipeDeviceDialog"
|
||||
|
|
|
@ -21,7 +21,7 @@ import { RoomType } from "matrix-js-sdk/src/@types/event";
|
|||
import { JoinRule, Preset, Visibility } from "matrix-js-sdk/src/@types/partials";
|
||||
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import withValidation, { IFieldState } from "../elements/Validation";
|
||||
import withValidation, { IFieldState, IValidationResult } from "../elements/Validation";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import { IOpts } from "../../../createRoom";
|
||||
|
@ -92,7 +92,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
.then((isForced) => this.setState({ canChangeEncryption: !isForced }));
|
||||
}
|
||||
|
||||
private roomCreateOptions() {
|
||||
private roomCreateOptions(): IOpts {
|
||||
const opts: IOpts = {};
|
||||
const createOpts: IOpts["createOpts"] = (opts.createOpts = {});
|
||||
opts.roomType = this.props.type;
|
||||
|
@ -124,12 +124,12 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
return opts;
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
// move focus to first field when showing dialog
|
||||
this.nameField.current.focus();
|
||||
}
|
||||
|
||||
private onKeyDown = (event: KeyboardEvent) => {
|
||||
private onKeyDown = (event: KeyboardEvent): void => {
|
||||
const action = getKeyBindingsManager().getAccessibilityAction(event);
|
||||
switch (action) {
|
||||
case KeyBindingAction.Enter:
|
||||
|
@ -140,7 +140,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
}
|
||||
};
|
||||
|
||||
private onOk = async () => {
|
||||
private onOk = async (): Promise<void> => {
|
||||
const activeElement = document.activeElement as HTMLElement;
|
||||
if (activeElement) {
|
||||
activeElement.blur();
|
||||
|
@ -168,39 +168,39 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
}
|
||||
};
|
||||
|
||||
private onCancel = () => {
|
||||
private onCancel = (): void => {
|
||||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private onNameChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onNameChange = (ev: ChangeEvent<HTMLInputElement>): void => {
|
||||
this.setState({ name: ev.target.value });
|
||||
};
|
||||
|
||||
private onTopicChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onTopicChange = (ev: ChangeEvent<HTMLInputElement>): void => {
|
||||
this.setState({ topic: ev.target.value });
|
||||
};
|
||||
|
||||
private onJoinRuleChange = (joinRule: JoinRule) => {
|
||||
private onJoinRuleChange = (joinRule: JoinRule): void => {
|
||||
this.setState({ joinRule });
|
||||
};
|
||||
|
||||
private onEncryptedChange = (isEncrypted: boolean) => {
|
||||
private onEncryptedChange = (isEncrypted: boolean): void => {
|
||||
this.setState({ isEncrypted });
|
||||
};
|
||||
|
||||
private onAliasChange = (alias: string) => {
|
||||
private onAliasChange = (alias: string): void => {
|
||||
this.setState({ alias });
|
||||
};
|
||||
|
||||
private onDetailsToggled = (ev: SyntheticEvent<HTMLDetailsElement>) => {
|
||||
private onDetailsToggled = (ev: SyntheticEvent<HTMLDetailsElement>): void => {
|
||||
this.setState({ detailsOpen: (ev.target as HTMLDetailsElement).open });
|
||||
};
|
||||
|
||||
private onNoFederateChange = (noFederate: boolean) => {
|
||||
private onNoFederateChange = (noFederate: boolean): void => {
|
||||
this.setState({ noFederate });
|
||||
};
|
||||
|
||||
private onNameValidate = async (fieldState: IFieldState) => {
|
||||
private onNameValidate = async (fieldState: IFieldState): Promise<IValidationResult> => {
|
||||
const result = await CreateRoomDialog.validateRoomName(fieldState);
|
||||
this.setState({ nameIsValid: result.valid });
|
||||
return result;
|
||||
|
@ -216,7 +216,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
|
|||
],
|
||||
});
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const isVideoRoom = this.props.type === RoomType.ElementVideo;
|
||||
|
||||
let aliasField: JSX.Element;
|
||||
|
|
|
@ -54,7 +54,7 @@ const CreateSubspaceDialog: React.FC<IProps> = ({ space, onAddExistingSpaceClick
|
|||
}
|
||||
const [joinRule, setJoinRule] = useState<JoinRule>(defaultJoinRule);
|
||||
|
||||
const onCreateSubspaceClick = async (e) => {
|
||||
const onCreateSubspaceClick = async (e): Promise<void> => {
|
||||
e.preventDefault();
|
||||
if (busy) return;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ interface IProps extends IDialogProps {}
|
|||
const CryptoStoreTooNewDialog: React.FC<IProps> = (props: IProps) => {
|
||||
const brand = SdkConfig.get().brand;
|
||||
|
||||
const _onLogoutClicked = () => {
|
||||
const _onLogoutClicked = (): void => {
|
||||
Modal.createDialog(QuestionDialog, {
|
||||
title: _t("Sign out"),
|
||||
description: _t(
|
||||
|
|
|
@ -172,7 +172,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
|||
});
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let error = null;
|
||||
if (this.state.errStr) {
|
||||
error = <div className="error">{this.state.errStr}</div>;
|
||||
|
|
|
@ -81,7 +81,7 @@ const DevtoolsDialog: React.FC<IProps> = ({ roomId, onFinished }) => {
|
|||
const Tool = tool[1];
|
||||
body = <Tool onBack={onBack} setTool={(label, tool) => setTool([label, tool])} />;
|
||||
} else {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
onFinished(false);
|
||||
};
|
||||
body = (
|
||||
|
@ -90,7 +90,7 @@ const DevtoolsDialog: React.FC<IProps> = ({ roomId, onFinished }) => {
|
|||
<div key={category}>
|
||||
<h3>{_t(categoryLabels[category])}</h3>
|
||||
{tools.map(([label, tool]) => {
|
||||
const onClick = () => {
|
||||
const onClick = (): void => {
|
||||
setTool([label, tool]);
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -35,7 +35,7 @@ interface IProps extends IDialogProps {
|
|||
}
|
||||
|
||||
export default class EndPollDialog extends React.Component<IProps> {
|
||||
private onFinished = (endPoll: boolean) => {
|
||||
private onFinished = (endPoll: boolean): void => {
|
||||
const topAnswer = findTopAnswer(this.props.event, this.props.matrixClient, this.props.getRelationsForEvent);
|
||||
|
||||
const message =
|
||||
|
@ -59,7 +59,7 @@ export default class EndPollDialog extends React.Component<IProps> {
|
|||
this.props.onFinished(endPoll);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<QuestionDialog
|
||||
title={_t("End Poll")}
|
||||
|
|
|
@ -51,11 +51,11 @@ export default class ErrorDialog extends React.Component<IProps, IState> {
|
|||
button: null,
|
||||
};
|
||||
|
||||
private onClick = () => {
|
||||
private onClick = (): void => {
|
||||
this.props.onFinished(true);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_ErrorDialog"
|
||||
|
|
|
@ -103,13 +103,13 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
|||
const [displayCancel, setCancelWarning] = useState(false);
|
||||
const [exportCancelled, setExportCancelled] = useState(false);
|
||||
const [exportSuccessful, setExportSuccessful] = useState(false);
|
||||
const [exporter, setExporter] = useStateCallback<Exporter>(null, async (exporter: Exporter) => {
|
||||
const [exporter, setExporter] = useStateCallback<Exporter>(null, async (exporter: Exporter): Promise<void> => {
|
||||
await exporter?.export().then(() => {
|
||||
if (!exportCancelled) setExportSuccessful(true);
|
||||
});
|
||||
});
|
||||
|
||||
const startExport = async () => {
|
||||
const startExport = async (): Promise<void> => {
|
||||
const exportOptions = {
|
||||
numberOfMessages,
|
||||
attachmentsIncluded: includeAttachments,
|
||||
|
@ -131,7 +131,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const onExportClick = async () => {
|
||||
const onExportClick = async (): Promise<void> => {
|
||||
const isValidSize =
|
||||
!setSizeLimit ||
|
||||
(await sizeLimitRef.current.validate({
|
||||
|
@ -225,12 +225,12 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
|||
return result;
|
||||
};
|
||||
|
||||
const onCancel = async () => {
|
||||
const onCancel = async (): Promise<void> => {
|
||||
if (isExporting) setCancelWarning(true);
|
||||
else onFinished(false);
|
||||
};
|
||||
|
||||
const confirmCancel = async () => {
|
||||
const confirmCancel = async (): Promise<void> => {
|
||||
await exporter?.cancelExport();
|
||||
setExportCancelled(true);
|
||||
setExporting(false);
|
||||
|
|
|
@ -82,7 +82,7 @@ enum SendState {
|
|||
const Entry: React.FC<IEntryProps> = ({ room, type, content, matrixClient: cli, onFinished }) => {
|
||||
const [sendState, setSendState] = useState<SendState>(SendState.CanSend);
|
||||
|
||||
const jumpToRoom = (ev: ButtonEvent) => {
|
||||
const jumpToRoom = (ev: ButtonEvent): void => {
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
|
@ -91,7 +91,7 @@ const Entry: React.FC<IEntryProps> = ({ room, type, content, matrixClient: cli,
|
|||
});
|
||||
onFinished(true);
|
||||
};
|
||||
const send = async () => {
|
||||
const send = async (): Promise<void> => {
|
||||
setSendState(SendState.Sending);
|
||||
try {
|
||||
await cli.sendEvent(room.roomId, type, content);
|
||||
|
@ -243,7 +243,7 @@ const ForwardDialog: React.FC<IProps> = ({ matrixClient: cli, event, permalinkCr
|
|||
}
|
||||
|
||||
const [truncateAt, setTruncateAt] = useState(20);
|
||||
function overflowTile(overflowCount, totalCount) {
|
||||
function overflowTile(overflowCount, totalCount): JSX.Element {
|
||||
const text = _t("and %(count)s others...", { count: overflowCount });
|
||||
return (
|
||||
<EntityTile
|
||||
|
|
|
@ -44,7 +44,7 @@ const GenericFeatureFeedbackDialog: React.FC<IProps> = ({
|
|||
const [comment, setComment] = useState("");
|
||||
const [canContact, setCanContact] = useState(false);
|
||||
|
||||
const sendFeedback = async (ok: boolean) => {
|
||||
const sendFeedback = async (ok: boolean): Promise<void> => {
|
||||
if (!ok) return onFinished(false);
|
||||
|
||||
submitFeedback(SdkConfig.get().bug_report_endpoint_url, rageshakeLabel, comment, canContact, rageshakeData);
|
||||
|
|
|
@ -54,7 +54,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
this.config = SdkConfig.getObject("host_signup");
|
||||
}
|
||||
|
||||
private messageHandler = async (message: IPostmessage) => {
|
||||
private messageHandler = async (message: IPostmessage): Promise<void> => {
|
||||
if (!this.config.get("url").startsWith(message.origin)) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
}
|
||||
};
|
||||
|
||||
private maximizeDialog = () => {
|
||||
private maximizeDialog = (): void => {
|
||||
this.setState({
|
||||
minimized: false,
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
});
|
||||
};
|
||||
|
||||
private minimizeDialog = () => {
|
||||
private minimizeDialog = (): void => {
|
||||
this.setState({
|
||||
minimized: true,
|
||||
});
|
||||
|
@ -102,13 +102,13 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
});
|
||||
};
|
||||
|
||||
private closeDialog = async () => {
|
||||
private closeDialog = async (): Promise<void> => {
|
||||
window.removeEventListener("message", this.messageHandler);
|
||||
// Finally clear the flag in
|
||||
return HostSignupStore.instance.setHostSignupActive(false);
|
||||
};
|
||||
|
||||
private onCloseClick = async () => {
|
||||
private onCloseClick = async (): Promise<void> => {
|
||||
if (this.state.completed) {
|
||||
// We're done, close
|
||||
return this.closeDialog();
|
||||
|
@ -128,11 +128,11 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
}
|
||||
};
|
||||
|
||||
private sendMessage = (message: IPostmessageResponseData) => {
|
||||
private sendMessage = (message: IPostmessageResponseData): void => {
|
||||
this.iframeRef.current.contentWindow.postMessage(message, this.config.get("url"));
|
||||
};
|
||||
|
||||
private async sendAccountDetails() {
|
||||
private async sendAccountDetails(): Promise<void> {
|
||||
const openIdToken = await MatrixClientPeg.get().getOpenIdToken();
|
||||
if (!openIdToken || !openIdToken.access_token) {
|
||||
logger.warn("Failed to connect to homeserver for OpenID token.");
|
||||
|
@ -155,14 +155,14 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
});
|
||||
}
|
||||
|
||||
private onAccountDetailsDialogFinished = async (result) => {
|
||||
private onAccountDetailsDialogFinished = async (result): Promise<void> => {
|
||||
if (result) {
|
||||
return this.sendAccountDetails();
|
||||
}
|
||||
return this.closeDialog();
|
||||
};
|
||||
|
||||
private onAccountDetailsRequest = () => {
|
||||
private onAccountDetailsRequest = (): void => {
|
||||
const cookiePolicyUrl = this.config.get("cookie_policy_url");
|
||||
const privacyPolicyUrl = this.config.get("privacy_policy_url");
|
||||
const tosUrl = this.config.get("terms_of_service_url");
|
||||
|
@ -211,14 +211,14 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
});
|
||||
};
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
window.addEventListener("message", this.messageHandler);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
if (HostSignupStore.instance.isHostSignupActive) {
|
||||
// Run the close dialog actions if we're still active, otherwise good to go
|
||||
return this.closeDialog();
|
||||
this.closeDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,11 @@ export default class InfoDialog extends React.Component<IProps> {
|
|||
hasCloseButton: false,
|
||||
};
|
||||
|
||||
private onFinished = () => {
|
||||
private onFinished = (): void => {
|
||||
this.props.onFinished();
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_InfoDialog"
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { createRef } from "react";
|
||||
import React, { createRef, ReactNode } from "react";
|
||||
import classNames from "classnames";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
|
@ -77,10 +77,10 @@ import dis from "../../../dispatcher/dispatcher";
|
|||
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
interface IRecentUser {
|
||||
interface Result {
|
||||
userId: string;
|
||||
user: RoomMember;
|
||||
lastActive: number;
|
||||
user: RoomMember | DirectoryMember | ThreepidMember;
|
||||
lastActive?: number;
|
||||
}
|
||||
|
||||
const INITIAL_ROOMS_SHOWN = 3; // Number of rooms to show at first
|
||||
|
@ -92,7 +92,7 @@ enum TabId {
|
|||
}
|
||||
|
||||
class DMUserTile extends React.PureComponent<IDMUserTileProps> {
|
||||
private onRemove = (e) => {
|
||||
private onRemove = (e): void => {
|
||||
// Stop the browser from highlighting text
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -100,7 +100,7 @@ class DMUserTile extends React.PureComponent<IDMUserTileProps> {
|
|||
this.props.onRemove(this.props.member);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const avatarSize = 20;
|
||||
const avatar = <SearchResultAvatar user={this.props.member} size={avatarSize} />;
|
||||
|
||||
|
@ -139,7 +139,7 @@ interface IDMRoomTileProps {
|
|||
}
|
||||
|
||||
class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
|
||||
private onClick = (e) => {
|
||||
private onClick = (e): void => {
|
||||
// Stop the browser from highlighting text
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -147,7 +147,7 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
|
|||
this.props.onToggle(this.props.member);
|
||||
};
|
||||
|
||||
private highlightName(str: string) {
|
||||
private highlightName(str: string): ReactNode {
|
||||
if (!this.props.highlightWord) return str;
|
||||
|
||||
// We convert things to lowercase for index searching, but pull substrings from
|
||||
|
@ -156,10 +156,10 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
|
|||
const lowerStr = str.toLowerCase();
|
||||
const filterStr = this.props.highlightWord.toLowerCase();
|
||||
|
||||
const result = [];
|
||||
const result: JSX.Element[] = [];
|
||||
|
||||
let i = 0;
|
||||
let ii;
|
||||
let ii: number;
|
||||
while ((ii = lowerStr.indexOf(filterStr, i)) >= 0) {
|
||||
// Push any text we missed (first bit/middle of text)
|
||||
if (ii > i) {
|
||||
|
@ -187,7 +187,7 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
|
|||
return result;
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let timestamp = null;
|
||||
if (this.props.lastActiveTs) {
|
||||
const humanTs = humanizeTime(this.props.lastActiveTs);
|
||||
|
@ -283,12 +283,12 @@ type Props = InviteDMProps | InviteRoomProps | InviteCallProps;
|
|||
interface IInviteDialogState {
|
||||
targets: Member[]; // array of Member objects (see interface above)
|
||||
filterText: string;
|
||||
recents: { user: Member; userId: string }[];
|
||||
recents: Result[];
|
||||
numRecentsShown: number;
|
||||
suggestions: { user: Member; userId: string }[];
|
||||
suggestions: Result[];
|
||||
numSuggestionsShown: number;
|
||||
serverResultsMixin: { user: Member; userId: string }[];
|
||||
threepidResultsMixin: { user: Member; userId: string }[];
|
||||
serverResultsMixin: Result[];
|
||||
threepidResultsMixin: Result[];
|
||||
canUseIdentityServer: boolean;
|
||||
tryingIdentityServer: boolean;
|
||||
consultFirst: boolean;
|
||||
|
@ -351,21 +351,21 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
};
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
if (this.props.initialText) {
|
||||
this.updateSuggestions(this.props.initialText);
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
this.unmounted = true;
|
||||
}
|
||||
|
||||
private onConsultFirstChange = (ev) => {
|
||||
private onConsultFirstChange = (ev): void => {
|
||||
this.setState({ consultFirst: ev.target.checked });
|
||||
};
|
||||
|
||||
public static buildRecents(excludedTargetIds: Set<string>): IRecentUser[] {
|
||||
public static buildRecents(excludedTargetIds: Set<string>): Result[] {
|
||||
const rooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals(); // map of userId => js-sdk Room
|
||||
|
||||
// Also pull in all the rooms tagged as DefaultTagID.DM so we don't miss anything. Sometimes the
|
||||
|
@ -464,7 +464,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
return newTargets;
|
||||
}
|
||||
|
||||
private startDm = async () => {
|
||||
private startDm = async (): Promise<void> => {
|
||||
try {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const targets = this.convertFilter();
|
||||
|
@ -479,7 +479,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private inviteUsers = async () => {
|
||||
private inviteUsers = async (): Promise<void> => {
|
||||
if (this.props.kind !== KIND_INVITE) return;
|
||||
this.setState({ busy: true });
|
||||
this.convertFilter();
|
||||
|
@ -514,7 +514,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private transferCall = async () => {
|
||||
private transferCall = async (): Promise<void> => {
|
||||
if (this.props.kind !== KIND_CALL_TRANSFER) return;
|
||||
if (this.state.currentTabId == TabId.UserDirectory) {
|
||||
this.convertFilter();
|
||||
|
@ -538,7 +538,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
this.props.onFinished(true);
|
||||
};
|
||||
|
||||
private onKeyDown = (e) => {
|
||||
private onKeyDown = (e): void => {
|
||||
if (this.state.busy) return;
|
||||
|
||||
let handled = false;
|
||||
|
@ -574,14 +574,14 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private onCancel = () => {
|
||||
private onCancel = (): void => {
|
||||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private updateSuggestions = async (term: string) => {
|
||||
private updateSuggestions = async (term: string): Promise<void> => {
|
||||
MatrixClientPeg.get()
|
||||
.searchUserDirectory({ term })
|
||||
.then(async (r) => {
|
||||
.then(async (r): Promise<void> => {
|
||||
if (term !== this.state.filterText) {
|
||||
// Discard the results - we were probably too slow on the server-side to make
|
||||
// these results useful. This is a race we want to avoid because we could overwrite
|
||||
|
@ -692,7 +692,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private updateFilter = (e) => {
|
||||
private updateFilter = (e): void => {
|
||||
const term = e.target.value;
|
||||
this.setState({ filterText: term });
|
||||
|
||||
|
@ -707,15 +707,15 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}, 150); // 150ms debounce (human reaction time + some)
|
||||
};
|
||||
|
||||
private showMoreRecents = () => {
|
||||
private showMoreRecents = (): void => {
|
||||
this.setState({ numRecentsShown: this.state.numRecentsShown + INCREMENT_ROOMS_SHOWN });
|
||||
};
|
||||
|
||||
private showMoreSuggestions = () => {
|
||||
private showMoreSuggestions = (): void => {
|
||||
this.setState({ numSuggestionsShown: this.state.numSuggestionsShown + INCREMENT_ROOMS_SHOWN });
|
||||
};
|
||||
|
||||
private toggleMember = (member: Member) => {
|
||||
private toggleMember = (member: Member): void => {
|
||||
if (!this.state.busy) {
|
||||
let filterText = this.state.filterText;
|
||||
let targets = this.state.targets.map((t) => t); // cheap clone for mutation
|
||||
|
@ -737,7 +737,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private removeMember = (member: Member) => {
|
||||
private removeMember = (member: Member): void => {
|
||||
const targets = this.state.targets.map((t) => t); // cheap clone for mutation
|
||||
const idx = targets.indexOf(member);
|
||||
if (idx >= 0) {
|
||||
|
@ -750,7 +750,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private onPaste = async (e) => {
|
||||
private onPaste = async (e): Promise<void> => {
|
||||
if (this.state.filterText) {
|
||||
// if the user has already typed something, just let them
|
||||
// paste normally.
|
||||
|
@ -825,7 +825,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
this.setState({ targets: [...this.state.targets, ...toAdd] });
|
||||
};
|
||||
|
||||
private onClickInputArea = (e) => {
|
||||
private onClickInputArea = (e): void => {
|
||||
// Stop the browser from highlighting text
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
@ -835,7 +835,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private onUseDefaultIdentityServerClick = (e) => {
|
||||
private onUseDefaultIdentityServerClick = (e): void => {
|
||||
e.preventDefault();
|
||||
|
||||
// Update the IS in account data. Actually using it may trigger terms.
|
||||
|
@ -844,17 +844,17 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
this.setState({ canUseIdentityServer: true, tryingIdentityServer: false });
|
||||
};
|
||||
|
||||
private onManageSettingsClick = (e) => {
|
||||
private onManageSettingsClick = (e): void => {
|
||||
e.preventDefault();
|
||||
dis.fire(Action.ViewUserSettings);
|
||||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private renderSection(kind: "recents" | "suggestions") {
|
||||
private renderSection(kind: "recents" | "suggestions"): JSX.Element {
|
||||
let sourceMembers = kind === "recents" ? this.state.recents : this.state.suggestions;
|
||||
let showNum = kind === "recents" ? this.state.numRecentsShown : this.state.numSuggestionsShown;
|
||||
const showMoreFn = kind === "recents" ? this.showMoreRecents.bind(this) : this.showMoreSuggestions.bind(this);
|
||||
const lastActive = (m) => (kind === "recents" ? m.lastActive : null);
|
||||
const lastActive = (m: Result): number | null => (kind === "recents" ? m.lastActive : null);
|
||||
let sectionName = kind === "recents" ? _t("Recent Conversations") : _t("Suggestions");
|
||||
|
||||
if (this.props.kind === KIND_INVITE) {
|
||||
|
@ -945,7 +945,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
);
|
||||
}
|
||||
|
||||
private renderEditor() {
|
||||
private renderEditor(): JSX.Element {
|
||||
const hasPlaceholder =
|
||||
this.props.kind == KIND_CALL_TRANSFER &&
|
||||
this.state.targets.length === 0 &&
|
||||
|
@ -976,7 +976,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
);
|
||||
}
|
||||
|
||||
private renderIdentityServerWarning() {
|
||||
private renderIdentityServerWarning(): JSX.Element {
|
||||
if (
|
||||
!this.state.tryingIdentityServer ||
|
||||
this.state.canUseIdentityServer ||
|
||||
|
@ -1030,16 +1030,16 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
}
|
||||
|
||||
private onDialFormSubmit = (ev) => {
|
||||
private onDialFormSubmit = (ev): void => {
|
||||
ev.preventDefault();
|
||||
this.transferCall();
|
||||
};
|
||||
|
||||
private onDialChange = (ev) => {
|
||||
private onDialChange = (ev): void => {
|
||||
this.setState({ dialPadValue: ev.currentTarget.value });
|
||||
};
|
||||
|
||||
private onDigitPress = (digit: string, ev: ButtonEvent) => {
|
||||
private onDigitPress = (digit: string, ev: ButtonEvent): void => {
|
||||
this.setState({ dialPadValue: this.state.dialPadValue + digit });
|
||||
|
||||
// Keep the number field focused so that keyboard entry is still available
|
||||
|
@ -1050,7 +1050,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private onDeletePress = (ev: ButtonEvent) => {
|
||||
private onDeletePress = (ev: ButtonEvent): void => {
|
||||
if (this.state.dialPadValue.length === 0) return;
|
||||
this.setState({ dialPadValue: this.state.dialPadValue.slice(0, -1) });
|
||||
|
||||
|
@ -1062,11 +1062,11 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
};
|
||||
|
||||
private onTabChange = (tabId: TabId) => {
|
||||
private onTabChange = (tabId: TabId): void => {
|
||||
this.setState({ currentTabId: tabId });
|
||||
};
|
||||
|
||||
private async onLinkClick(e) {
|
||||
private async onLinkClick(e): Promise<void> {
|
||||
e.preventDefault();
|
||||
selectText(e.target);
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let spinner = null;
|
||||
if (this.state.busy) {
|
||||
spinner = <Spinner w={20} h={20} />;
|
||||
|
|
|
@ -53,7 +53,7 @@ const KeySignatureUploadFailedDialog: React.FC<IProps> = ({ failures, source, co
|
|||
]);
|
||||
const defaultCause = _t("a key signature");
|
||||
|
||||
const onRetry = useCallback(async () => {
|
||||
const onRetry = useCallback(async (): Promise<void> => {
|
||||
try {
|
||||
setRetrying(true);
|
||||
const cancel = new Promise((resolve, reject) => {
|
||||
|
|
|
@ -63,7 +63,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private async loadBackupStatus() {
|
||||
private async loadBackupStatus(): Promise<void> {
|
||||
try {
|
||||
const backupInfo = await MatrixClientPeg.get().getKeyBackupVersion();
|
||||
this.setState({
|
||||
|
@ -127,7 +127,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
|
|||
this.props.onFinished(true);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
if (this.state.shouldLoadBackupStatus) {
|
||||
const description = (
|
||||
<div>
|
||||
|
|
|
@ -33,7 +33,11 @@ interface IProps extends IDialogProps {
|
|||
selected?: string[];
|
||||
}
|
||||
|
||||
const Entry = ({ room, checked, onChange }) => {
|
||||
const Entry: React.FC<{
|
||||
room: Room;
|
||||
checked: boolean;
|
||||
onChange(value: boolean): void;
|
||||
}> = ({ room, checked, onChange }) => {
|
||||
const localRoom = room instanceof Room;
|
||||
|
||||
let description;
|
||||
|
|
|
@ -76,33 +76,33 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
|||
this.possibleButtons = (this.props.widgetDefinition.buttons || []).map((b) => b.id);
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
const driver = new StopGapWidgetDriver([], this.widget, WidgetKind.Modal, false);
|
||||
const messaging = new ClientWidgetApi(this.widget, this.appFrame.current, driver);
|
||||
this.setState({ messaging });
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
this.state.messaging.off("ready", this.onReady);
|
||||
this.state.messaging.off(`action:${WidgetApiFromWidgetAction.CloseModalWidget}`, this.onWidgetClose);
|
||||
this.state.messaging.stop();
|
||||
}
|
||||
|
||||
private onReady = () => {
|
||||
private onReady = (): void => {
|
||||
this.state.messaging.sendWidgetConfig(this.props.widgetDefinition);
|
||||
};
|
||||
|
||||
private onLoad = () => {
|
||||
private onLoad = (): void => {
|
||||
this.state.messaging.once("ready", this.onReady);
|
||||
this.state.messaging.on(`action:${WidgetApiFromWidgetAction.CloseModalWidget}`, this.onWidgetClose);
|
||||
this.state.messaging.on(`action:${WidgetApiFromWidgetAction.SetModalButtonEnabled}`, this.onButtonEnableToggle);
|
||||
};
|
||||
|
||||
private onWidgetClose = (ev: CustomEvent<IModalWidgetCloseRequest>) => {
|
||||
private onWidgetClose = (ev: CustomEvent<IModalWidgetCloseRequest>): void => {
|
||||
this.props.onFinished(true, ev.detail.data);
|
||||
};
|
||||
|
||||
private onButtonEnableToggle = (ev: CustomEvent<ISetModalButtonEnabledActionRequest>) => {
|
||||
private onButtonEnableToggle = (ev: CustomEvent<ISetModalButtonEnabledActionRequest>): void => {
|
||||
ev.preventDefault();
|
||||
const isClose = ev.detail.data.button === BuiltInModalButtonID.Close;
|
||||
if (isClose || !this.possibleButtons.includes(ev.detail.data.button)) {
|
||||
|
@ -124,7 +124,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
|||
this.state.messaging.transport.reply(ev.detail, {} as IWidgetApiAcknowledgeResponseData);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const templated = this.widget.getCompleteUrl({
|
||||
widgetRoomId: this.props.widgetRoomId,
|
||||
currentUserId: MatrixClientPeg.get().getUserId(),
|
||||
|
@ -167,7 +167,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
|||
break;
|
||||
}
|
||||
|
||||
const onClick = () => {
|
||||
const onClick = (): void => {
|
||||
this.state.messaging.notifyModalWidgetButtonClicked(def.id);
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ export class ModuleUiDialog extends ScrollableBaseModal<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
protected async submit() {
|
||||
protected async submit(): Promise<void> {
|
||||
try {
|
||||
const model = await this.contentRef.current.trySubmit();
|
||||
this.props.onFinished(true, model);
|
||||
|
|
|
@ -32,7 +32,7 @@ const RegistrationEmailPromptDialog: React.FC<IProps> = ({ onFinished }) => {
|
|||
const [email, setEmail] = useState("");
|
||||
const fieldRef = useRef<Field>();
|
||||
|
||||
const onSubmit = async (e) => {
|
||||
const onSubmit = async (e): Promise<void> => {
|
||||
e.preventDefault();
|
||||
if (email) {
|
||||
const valid = await fieldRef.current.validate({});
|
||||
|
|
|
@ -204,7 +204,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
// The user has clicked "submit".
|
||||
private onSubmit = async () => {
|
||||
private onSubmit = async (): Promise<void> => {
|
||||
let reason = this.state.reason || "";
|
||||
reason = reason.trim();
|
||||
if (this.moderation) {
|
||||
|
@ -273,7 +273,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
|
|||
}
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let error = null;
|
||||
if (this.state.err) {
|
||||
error = <div className="error">{this.state.err}</div>;
|
||||
|
|
|
@ -60,13 +60,13 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
this.state = { roomName: "" };
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
this.dispatcherRef = dis.register(this.onAction);
|
||||
MatrixClientPeg.get().on(RoomEvent.Name, this.onRoomName);
|
||||
this.onRoomName();
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
if (this.dispatcherRef) {
|
||||
dis.unregister(this.dispatcherRef);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
return tabs;
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const roomName = this.state.roomName;
|
||||
return (
|
||||
<BaseDialog
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
|
|||
busy: true,
|
||||
};
|
||||
|
||||
public async componentDidMount() {
|
||||
public async componentDidMount(): Promise<void> {
|
||||
const recommended = await this.props.room.getRecommendedVersion();
|
||||
this.targetVersion = recommended.version;
|
||||
this.setState({ busy: false });
|
||||
|
@ -68,7 +68,7 @@ export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
|
|||
});
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let buttons;
|
||||
if (this.state.busy) {
|
||||
buttons = <Spinner />;
|
||||
|
|
|
@ -70,7 +70,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
|
|||
this.setState({ progressText, progress, total });
|
||||
};
|
||||
|
||||
private onContinue = () => {
|
||||
private onContinue = (): void => {
|
||||
const opts = {
|
||||
continue: true,
|
||||
invite: this.isPrivate && this.state.inviteUsersToNewRoom,
|
||||
|
@ -85,22 +85,22 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
|
|||
}
|
||||
};
|
||||
|
||||
private onCancel = () => {
|
||||
private onCancel = (): void => {
|
||||
this.props.onFinished({ continue: false, invite: false });
|
||||
};
|
||||
|
||||
private onInviteUsersToggle = (inviteUsersToNewRoom: boolean) => {
|
||||
private onInviteUsersToggle = (inviteUsersToNewRoom: boolean): void => {
|
||||
this.setState({ inviteUsersToNewRoom });
|
||||
};
|
||||
|
||||
private openBugReportDialog = (e) => {
|
||||
private openBugReportDialog = (e): void => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
Modal.createDialog(BugReportDialog, {});
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const brand = SdkConfig.get().brand;
|
||||
|
||||
let inviteToggle = null;
|
||||
|
|
|
@ -58,11 +58,11 @@ export default abstract class ScrollableBaseModal<
|
|||
}
|
||||
};
|
||||
|
||||
private onCancel = () => {
|
||||
private onCancel = (): void => {
|
||||
this.cancel();
|
||||
};
|
||||
|
||||
private onSubmit = (e: MouseEvent | FormEvent) => {
|
||||
private onSubmit = (e: MouseEvent | FormEvent): void => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (!this.state.canSubmit) return; // pretend the submit button was disabled
|
||||
|
|
|
@ -33,15 +33,15 @@ import { IDialogProps } from "./IDialogProps";
|
|||
interface IProps extends IDialogProps {}
|
||||
|
||||
export default class ServerOfflineDialog extends React.PureComponent<IProps> {
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
EchoStore.instance.on(UPDATE_EVENT, this.onEchosUpdated);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
EchoStore.instance.off(UPDATE_EVENT, this.onEchosUpdated);
|
||||
}
|
||||
|
||||
private onEchosUpdated = () => {
|
||||
private onEchosUpdated = (): void => {
|
||||
this.forceUpdate(); // no state to worry about
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,7 @@ export default class ServerOfflineDialog extends React.PureComponent<IProps> {
|
|||
});
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let timeline = this.renderTimeline().filter((c) => !!c); // remove nulls for next check
|
||||
if (timeline.length === 0) {
|
||||
timeline = [<div key={1}>{_t("You're all caught up.")}</div>];
|
||||
|
|
|
@ -26,7 +26,7 @@ import SdkConfig from "../../../SdkConfig";
|
|||
import Field from "../elements/Field";
|
||||
import StyledRadioButton from "../elements/StyledRadioButton";
|
||||
import TextWithTooltip from "../elements/TextWithTooltip";
|
||||
import withValidation, { IFieldState } from "../elements/Validation";
|
||||
import withValidation, { IFieldState, IValidationResult } from "../elements/Validation";
|
||||
import { ValidatedServerConfig } from "../../../utils/ValidatedServerConfig";
|
||||
|
||||
interface IProps {
|
||||
|
@ -67,15 +67,15 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
};
|
||||
}
|
||||
|
||||
private onDefaultChosen = () => {
|
||||
private onDefaultChosen = (): void => {
|
||||
this.setState({ defaultChosen: true });
|
||||
};
|
||||
|
||||
private onOtherChosen = () => {
|
||||
private onOtherChosen = (): void => {
|
||||
this.setState({ defaultChosen: false });
|
||||
};
|
||||
|
||||
private onHomeserverChange = (ev) => {
|
||||
private onHomeserverChange = (ev): void => {
|
||||
this.setState({ otherHomeserver: ev.target.value });
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
// If for some reason someone enters "matrix.org" for a URL, we could do a lookup to
|
||||
// find their homeserver without demanding they use "https://matrix.org"
|
||||
private validate = withValidation<this, { error?: string }>({
|
||||
deriveData: async ({ value }) => {
|
||||
deriveData: async ({ value }): Promise<{ error?: string }> => {
|
||||
let hsUrl = value.trim(); // trim to account for random whitespace
|
||||
|
||||
// if the URL has no protocol, try validate it as a serverName via well-known
|
||||
|
@ -136,7 +136,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
},
|
||||
{
|
||||
key: "valid",
|
||||
test: async function ({ value }, { error }) {
|
||||
test: async function ({ value }, { error }): Promise<boolean> {
|
||||
if (!value) return true;
|
||||
return !error;
|
||||
},
|
||||
|
@ -147,9 +147,9 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
],
|
||||
});
|
||||
|
||||
private onHomeserverValidate = (fieldState: IFieldState) => this.validate(fieldState);
|
||||
private onHomeserverValidate = (fieldState: IFieldState): Promise<IValidationResult> => this.validate(fieldState);
|
||||
|
||||
private onSubmit = async (ev) => {
|
||||
private onSubmit = async (ev): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
|
||||
const valid = await this.fieldRef.current.validate({ allowEmpty: false });
|
||||
|
@ -163,7 +163,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
|
|||
this.props.onFinished(this.state.defaultChosen ? this.defaultServer : this.validatedConf);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let text;
|
||||
if (this.defaultServer.hsName === "matrix.org") {
|
||||
text = _t("Matrix.org is the biggest public homeserver in the world, so it's a good place for many.");
|
||||
|
|
|
@ -22,7 +22,7 @@ import DialogButtons from "../elements/DialogButtons";
|
|||
import { IDialogProps } from "./IDialogProps";
|
||||
|
||||
export default class SeshatResetDialog extends React.PureComponent<IDialogProps> {
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
hasCancel={true}
|
||||
|
|
|
@ -91,18 +91,18 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
public static onLinkClick(e) {
|
||||
public static onLinkClick(e): void {
|
||||
e.preventDefault();
|
||||
selectText(e.target);
|
||||
}
|
||||
|
||||
private onLinkSpecificEventCheckboxClick = () => {
|
||||
private onLinkSpecificEventCheckboxClick = (): void => {
|
||||
this.setState({
|
||||
linkSpecificEvent: !this.state.linkSpecificEvent,
|
||||
});
|
||||
};
|
||||
|
||||
private getUrl() {
|
||||
private getUrl(): string {
|
||||
let matrixToUrl;
|
||||
|
||||
if (this.props.target instanceof Room) {
|
||||
|
@ -124,7 +124,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
|
|||
return matrixToUrl;
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let title;
|
||||
let checkbox;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ interface IProps extends IDialogProps {
|
|||
initialTabId?: SpacePreferenceTab;
|
||||
}
|
||||
|
||||
const SpacePreferencesAppearanceTab = ({ space }: Pick<IProps, "space">) => {
|
||||
const SpacePreferencesAppearanceTab: React.FC<Pick<IProps, "space">> = ({ space }) => {
|
||||
const showPeople = useSettingValue("Spaces.showPeopleInSpace", space.roomId);
|
||||
|
||||
return (
|
||||
|
|
|
@ -33,7 +33,7 @@ class TermsCheckbox extends React.PureComponent<ITermsCheckboxProps> {
|
|||
this.props.onChange(this.props.url, ev.currentTarget.checked);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return <input type="checkbox" onChange={this.onChange} checked={this.props.checked} />;
|
||||
}
|
||||
}
|
||||
|
@ -119,13 +119,13 @@ export default class TermsDialog extends React.PureComponent<ITermsDialogProps,
|
|||
}
|
||||
}
|
||||
|
||||
private onTermsCheckboxChange = (url: string, checked: boolean) => {
|
||||
private onTermsCheckboxChange = (url: string, checked: boolean): void => {
|
||||
this.setState({
|
||||
agreedUrls: Object.assign({}, this.state.agreedUrls, { [url]: checked }),
|
||||
});
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const rows = [];
|
||||
for (const policiesAndService of this.props.policiesAndServicePairs) {
|
||||
const parsedBaseUrl = url.parse(policiesAndService.service.baseUrl);
|
||||
|
|
|
@ -49,23 +49,23 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
|
|||
this.objectUrl = URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
if (this.objectUrl) URL.revokeObjectURL(this.objectUrl);
|
||||
}
|
||||
|
||||
private onCancelClick = () => {
|
||||
private onCancelClick = (): void => {
|
||||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private onUploadClick = () => {
|
||||
private onUploadClick = (): void => {
|
||||
this.props.onFinished(true);
|
||||
};
|
||||
|
||||
private onUploadAllClick = () => {
|
||||
private onUploadAllClick = (): void => {
|
||||
this.props.onFinished(true, true);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let title: string;
|
||||
if (this.props.totalFiles > 1 && this.props.currentIndex !== undefined) {
|
||||
title = _t("Upload files (%(current)s of %(total)s)", {
|
||||
|
|
|
@ -80,7 +80,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
|
|||
this.setState({ newSessionManagerEnabled: newValue });
|
||||
};
|
||||
|
||||
private getTabs() {
|
||||
private getTabs(): Tab[] {
|
||||
const tabs: Tab[] = [];
|
||||
|
||||
tabs.push(
|
||||
|
@ -210,7 +210,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
|
|||
return tabs;
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_UserSettingsDialog"
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class VerificationRequestDialog extends React.Component<IProps, I
|
|||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const request = this.state.verificationRequest;
|
||||
const otherUserId = request && request.otherUserId;
|
||||
const member = this.props.member || (otherUserId && MatrixClientPeg.get().getUser(otherUserId));
|
||||
|
|
|
@ -61,17 +61,17 @@ export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<
|
|||
};
|
||||
}
|
||||
|
||||
private onToggle = (capability: Capability) => {
|
||||
private onToggle = (capability: Capability): void => {
|
||||
const newStates = objectShallowClone(this.state.booleanStates);
|
||||
newStates[capability] = !newStates[capability];
|
||||
this.setState({ booleanStates: newStates });
|
||||
};
|
||||
|
||||
private onRememberSelectionChange = (newVal: boolean) => {
|
||||
private onRememberSelectionChange = (newVal: boolean): void => {
|
||||
this.setState({ rememberSelection: newVal });
|
||||
};
|
||||
|
||||
private onSubmit = async (ev) => {
|
||||
private onSubmit = async (ev): Promise<void> => {
|
||||
this.closeAndTryRemember(
|
||||
Object.entries(this.state.booleanStates)
|
||||
.filter(([_, isSelected]) => isSelected)
|
||||
|
@ -79,15 +79,15 @@ export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<
|
|||
);
|
||||
};
|
||||
|
||||
private onReject = async (ev) => {
|
||||
private onReject = async (ev): Promise<void> => {
|
||||
this.closeAndTryRemember([]); // nothing was approved
|
||||
};
|
||||
|
||||
private closeAndTryRemember(approved: Capability[]) {
|
||||
private closeAndTryRemember(approved: Capability[]): void {
|
||||
this.props.onFinished({ approved, remember: this.state.rememberSelection });
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
// We specifically order the timeline capabilities down to the bottom. The capability text
|
||||
// generation cares strongly about this.
|
||||
const orderedCapabilities = Object.entries(this.state.booleanStates).sort(([capA], [capB]) => {
|
||||
|
|
|
@ -23,27 +23,27 @@ import { EventEditor, EventViewer, eventTypeField, IEditorProps, stringify } fro
|
|||
import FilteredList from "./FilteredList";
|
||||
import { _t } from "../../../../languageHandler";
|
||||
|
||||
export const AccountDataEventEditor = ({ mxEvent, onBack }: IEditorProps) => {
|
||||
export const AccountDataEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
const fields = useMemo(() => [eventTypeField(mxEvent?.getType())], [mxEvent]);
|
||||
|
||||
const onSend = ([eventType]: string[], content?: IContent) => {
|
||||
return cli.setAccountData(eventType, content);
|
||||
const onSend = async ([eventType]: string[], content?: IContent): Promise<void> => {
|
||||
await cli.setAccountData(eventType, content);
|
||||
};
|
||||
|
||||
const defaultContent = mxEvent ? stringify(mxEvent.getContent()) : undefined;
|
||||
return <EventEditor fieldDefs={fields} defaultContent={defaultContent} onSend={onSend} onBack={onBack} />;
|
||||
};
|
||||
|
||||
export const RoomAccountDataEventEditor = ({ mxEvent, onBack }: IEditorProps) => {
|
||||
export const RoomAccountDataEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
const fields = useMemo(() => [eventTypeField(mxEvent?.getType())], [mxEvent]);
|
||||
|
||||
const onSend = ([eventType]: string[], content?: IContent) => {
|
||||
return cli.setRoomAccountData(context.room.roomId, eventType, content);
|
||||
const onSend = async ([eventType]: string[], content?: IContent): Promise<void> => {
|
||||
await cli.setRoomAccountData(context.room.roomId, eventType, content);
|
||||
};
|
||||
|
||||
const defaultContent = mxEvent ? stringify(mxEvent.getContent()) : undefined;
|
||||
|
@ -56,18 +56,18 @@ interface IProps extends IDevtoolsProps {
|
|||
actionLabel: string;
|
||||
}
|
||||
|
||||
const BaseAccountDataExplorer = ({ events, Editor, actionLabel, onBack, setTool }: IProps) => {
|
||||
const BaseAccountDataExplorer: React.FC<IProps> = ({ events, Editor, actionLabel, onBack, setTool }) => {
|
||||
const [query, setQuery] = useState("");
|
||||
const [event, setEvent] = useState<MatrixEvent>(null);
|
||||
|
||||
if (event) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setEvent(null);
|
||||
};
|
||||
return <EventViewer mxEvent={event} onBack={onBack} Editor={Editor} />;
|
||||
}
|
||||
|
||||
const onAction = async () => {
|
||||
const onAction = async (): Promise<void> => {
|
||||
setTool(actionLabel, Editor);
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ const BaseAccountDataExplorer = ({ events, Editor, actionLabel, onBack, setTool
|
|||
<BaseTool onBack={onBack} actionLabel={actionLabel} onAction={onAction}>
|
||||
<FilteredList query={query} onChange={setQuery}>
|
||||
{Object.entries(events).map(([eventType, ev]) => {
|
||||
const onClick = () => {
|
||||
const onClick = (): void => {
|
||||
setEvent(ev);
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ const BaseAccountDataExplorer = ({ events, Editor, actionLabel, onBack, setTool
|
|||
);
|
||||
};
|
||||
|
||||
export const AccountDataExplorer = ({ onBack, setTool }: IDevtoolsProps) => {
|
||||
export const AccountDataExplorer: React.FC<IDevtoolsProps> = ({ onBack, setTool }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
return (
|
||||
|
@ -104,7 +104,7 @@ export const AccountDataExplorer = ({ onBack, setTool }: IDevtoolsProps) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const RoomAccountDataExplorer = ({ onBack, setTool }: IDevtoolsProps) => {
|
||||
export const RoomAccountDataExplorer: React.FC<IDevtoolsProps> = ({ onBack, setTool }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
|
||||
return (
|
||||
|
|
|
@ -39,7 +39,7 @@ interface IProps extends IMinProps {
|
|||
const BaseTool: React.FC<XOR<IMinProps, IProps>> = ({ className, actionLabel, onBack, onAction, children }) => {
|
||||
const [message, setMessage] = useState<string>(null);
|
||||
|
||||
const onBackClick = () => {
|
||||
const onBackClick = (): void => {
|
||||
if (message) {
|
||||
setMessage(null);
|
||||
} else {
|
||||
|
@ -51,7 +51,7 @@ const BaseTool: React.FC<XOR<IMinProps, IProps>> = ({ className, actionLabel, on
|
|||
if (message) {
|
||||
children = message;
|
||||
} else if (onAction) {
|
||||
const onActionClick = () => {
|
||||
const onActionClick = (): void => {
|
||||
onAction().then((msg) => {
|
||||
if (typeof msg === "string") {
|
||||
setMessage(msg);
|
||||
|
|
|
@ -72,7 +72,7 @@ const validateEventContent = withValidation<any, Error | undefined>({
|
|||
],
|
||||
});
|
||||
|
||||
export const EventEditor = ({ fieldDefs, defaultContent = "{\n\n}", onSend, onBack }: IEventEditorProps) => {
|
||||
export const EventEditor: React.FC<IEventEditorProps> = ({ fieldDefs, defaultContent = "{\n\n}", onSend, onBack }) => {
|
||||
const [fieldData, setFieldData] = useState<string[]>(fieldDefs.map((def) => def.default ?? ""));
|
||||
const [content, setContent] = useState<string>(defaultContent);
|
||||
const contentField = useRef<Field>();
|
||||
|
@ -96,7 +96,7 @@ export const EventEditor = ({ fieldDefs, defaultContent = "{\n\n}", onSend, onBa
|
|||
/>
|
||||
));
|
||||
|
||||
const onAction = async () => {
|
||||
const onAction = async (): Promise<string> => {
|
||||
const valid = await contentField.current.validate({});
|
||||
|
||||
if (!valid) {
|
||||
|
@ -143,17 +143,17 @@ interface IViewerProps extends Required<IEditorProps> {
|
|||
Editor: React.FC<Required<IEditorProps>>;
|
||||
}
|
||||
|
||||
export const EventViewer = ({ mxEvent, onBack, Editor }: IViewerProps) => {
|
||||
export const EventViewer: React.FC<IViewerProps> = ({ mxEvent, onBack, Editor }) => {
|
||||
const [editing, setEditing] = useState(false);
|
||||
|
||||
if (editing) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setEditing(false);
|
||||
};
|
||||
return <Editor mxEvent={mxEvent} onBack={onBack} />;
|
||||
}
|
||||
|
||||
const onAction = async () => {
|
||||
const onAction = async (): Promise<void> => {
|
||||
setEditing(true);
|
||||
};
|
||||
|
||||
|
@ -171,13 +171,13 @@ const getBaseEventId = (baseEvent: MatrixEvent): string => {
|
|||
return mxEvent.getWireContent()["m.relates_to"]?.event_id ?? baseEvent.getId();
|
||||
};
|
||||
|
||||
export const TimelineEventEditor = ({ mxEvent, onBack }: IEditorProps) => {
|
||||
export const TimelineEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
const fields = useMemo(() => [eventTypeField(mxEvent?.getType())], [mxEvent]);
|
||||
|
||||
const onSend = ([eventType]: string[], content?: IContent) => {
|
||||
const onSend = ([eventType]: string[], content?: IContent): Promise<unknown> => {
|
||||
return cli.sendEvent(context.room.roomId, eventType, content);
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ interface IProps {
|
|||
onChange(value: string): void;
|
||||
}
|
||||
|
||||
const FilteredList = ({ children, query, onChange }: IProps) => {
|
||||
const FilteredList: React.FC<IProps> = ({ children, query, onChange }) => {
|
||||
const [truncateAt, setTruncateAt] = useState<number>(INITIAL_LOAD_TILES);
|
||||
const [filteredChildren, setFilteredChildren] = useState<React.ReactElement[]>(children);
|
||||
|
||||
|
@ -51,8 +51,8 @@ const FilteredList = ({ children, query, onChange }: IProps) => {
|
|||
return filteredChildren.length;
|
||||
};
|
||||
|
||||
const createOverflowElement = (overflowCount: number, totalCount: number) => {
|
||||
const showMore = () => {
|
||||
const createOverflowElement = (overflowCount: number, totalCount: number): JSX.Element => {
|
||||
const showMore = (): void => {
|
||||
setTruncateAt((num) => num + LOAD_TILES_STEP_SIZE);
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import MatrixClientContext from "../../../../contexts/MatrixClientContext";
|
|||
import { EventEditor, EventViewer, eventTypeField, stateKeyField, IEditorProps, stringify } from "./Event";
|
||||
import FilteredList from "./FilteredList";
|
||||
|
||||
export const StateEventEditor = ({ mxEvent, onBack }: IEditorProps) => {
|
||||
export const StateEventEditor: React.FC<IEditorProps> = ({ mxEvent, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const cli = useContext(MatrixClientContext);
|
||||
|
||||
|
@ -33,8 +33,8 @@ export const StateEventEditor = ({ mxEvent, onBack }: IEditorProps) => {
|
|||
[mxEvent],
|
||||
);
|
||||
|
||||
const onSend = ([eventType, stateKey]: string[], content?: IContent) => {
|
||||
return cli.sendStateEvent(context.room.roomId, eventType, content, stateKey);
|
||||
const onSend = async ([eventType, stateKey]: string[], content?: IContent): Promise<void> => {
|
||||
await cli.sendStateEvent(context.room.roomId, eventType, content, stateKey);
|
||||
};
|
||||
|
||||
const defaultContent = mxEvent ? stringify(mxEvent.getContent()) : undefined;
|
||||
|
@ -46,7 +46,7 @@ interface StateEventButtonProps {
|
|||
onClick(): void;
|
||||
}
|
||||
|
||||
const StateEventButton = ({ label, onClick }: StateEventButtonProps) => {
|
||||
const StateEventButton: React.FC<StateEventButtonProps> = ({ label, onClick }) => {
|
||||
const trimmed = label.trim();
|
||||
|
||||
return (
|
||||
|
@ -66,7 +66,7 @@ interface IEventTypeProps extends Pick<IDevtoolsProps, "onBack"> {
|
|||
eventType: string;
|
||||
}
|
||||
|
||||
const RoomStateExplorerEventType = ({ eventType, onBack }: IEventTypeProps) => {
|
||||
const RoomStateExplorerEventType: React.FC<IEventTypeProps> = ({ eventType, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const [query, setQuery] = useState("");
|
||||
const [event, setEvent] = useState<MatrixEvent | null>(null);
|
||||
|
@ -82,7 +82,7 @@ const RoomStateExplorerEventType = ({ eventType, onBack }: IEventTypeProps) => {
|
|||
}, [events]);
|
||||
|
||||
if (event) {
|
||||
const _onBack = () => {
|
||||
const _onBack = (): void => {
|
||||
if (events?.size === 1 && events.has("")) {
|
||||
onBack();
|
||||
} else {
|
||||
|
@ -103,7 +103,7 @@ const RoomStateExplorerEventType = ({ eventType, onBack }: IEventTypeProps) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const RoomStateExplorer = ({ onBack, setTool }: IDevtoolsProps) => {
|
||||
export const RoomStateExplorer: React.FC<IDevtoolsProps> = ({ onBack, setTool }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const [query, setQuery] = useState("");
|
||||
const [eventType, setEventType] = useState<string | null>(null);
|
||||
|
@ -111,13 +111,13 @@ export const RoomStateExplorer = ({ onBack, setTool }: IDevtoolsProps) => {
|
|||
const events = context.room.currentState.events;
|
||||
|
||||
if (eventType !== null) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setEventType(null);
|
||||
};
|
||||
return <RoomStateExplorerEventType eventType={eventType} onBack={onBack} />;
|
||||
}
|
||||
|
||||
const onAction = async () => {
|
||||
const onAction = async (): Promise<void> => {
|
||||
setTool(_t("Send custom state event"), StateEventEditor);
|
||||
};
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ interface IServerWellKnown {
|
|||
};
|
||||
}
|
||||
|
||||
const ServerInfo = ({ onBack }: IDevtoolsProps) => {
|
||||
const ServerInfo: React.FC<IDevtoolsProps> = ({ onBack }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const capabilities = useAsyncMemo(() => cli.getCapabilities(true).catch(() => FAILED_TO_LOAD), [cli]);
|
||||
const clientVersions = useAsyncMemo(() => cli.getVersions().catch(() => FAILED_TO_LOAD), [cli]);
|
||||
const serverVersions = useAsyncMemo<IServerWellKnown | symbol>(async () => {
|
||||
const serverVersions = useAsyncMemo(async (): Promise<IServerWellKnown | symbol> => {
|
||||
let baseUrl = cli.getHomeserverUrl();
|
||||
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,7 @@ import { EventType } from "matrix-js-sdk/src/@types/event";
|
|||
import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool";
|
||||
import { _t } from "../../../../languageHandler";
|
||||
|
||||
const ServersInRoom = ({ onBack }: IDevtoolsProps) => {
|
||||
const ServersInRoom: React.FC<IDevtoolsProps> = ({ onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
|
||||
const servers = useMemo<Record<string, number>>(() => {
|
||||
|
|
|
@ -26,28 +26,28 @@ import { SettingLevel } from "../../../../settings/SettingLevel";
|
|||
import { SETTINGS } from "../../../../settings/Settings";
|
||||
import Field from "../../elements/Field";
|
||||
|
||||
const SettingExplorer = ({ onBack }: IDevtoolsProps) => {
|
||||
const SettingExplorer: React.FC<IDevtoolsProps> = ({ onBack }) => {
|
||||
const [setting, setSetting] = useState<string>(null);
|
||||
const [editing, setEditing] = useState(false);
|
||||
|
||||
if (setting && editing) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setEditing(false);
|
||||
};
|
||||
return <EditSetting setting={setting} onBack={onBack} />;
|
||||
} else if (setting) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setSetting(null);
|
||||
};
|
||||
const onEdit = async () => {
|
||||
const onEdit = async (): Promise<void> => {
|
||||
setEditing(true);
|
||||
};
|
||||
return <ViewSetting setting={setting} onBack={onBack} onEdit={onEdit} />;
|
||||
} else {
|
||||
const onView = (setting: string) => {
|
||||
const onView = (setting: string): void => {
|
||||
setSetting(setting);
|
||||
};
|
||||
const onEdit = (setting: string) => {
|
||||
const onEdit = (setting: string): void => {
|
||||
setSetting(setting);
|
||||
setEditing(true);
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ interface ICanEditLevelFieldProps {
|
|||
roomId?: string;
|
||||
}
|
||||
|
||||
const CanEditLevelField = ({ setting, roomId, level }: ICanEditLevelFieldProps) => {
|
||||
const CanEditLevelField: React.FC<ICanEditLevelFieldProps> = ({ setting, roomId, level }) => {
|
||||
const canEdit = SettingsStore.canSetValue(setting, roomId, level);
|
||||
const className = canEdit ? "mx_DevTools_SettingsExplorer_mutable" : "mx_DevTools_SettingsExplorer_immutable";
|
||||
return (
|
||||
|
@ -92,14 +92,14 @@ interface IEditSettingProps extends Pick<IDevtoolsProps, "onBack"> {
|
|||
setting: string;
|
||||
}
|
||||
|
||||
const EditSetting = ({ setting, onBack }: IEditSettingProps) => {
|
||||
const EditSetting: React.FC<IEditSettingProps> = ({ setting, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const [explicitValue, setExplicitValue] = useState(renderExplicitSettingValues(setting, null));
|
||||
const [explicitRoomValue, setExplicitRoomValue] = useState(
|
||||
renderExplicitSettingValues(setting, context.room.roomId),
|
||||
);
|
||||
|
||||
const onSave = async () => {
|
||||
const onSave = async (): Promise<string> => {
|
||||
try {
|
||||
const parsedExplicit = JSON.parse(explicitValue);
|
||||
const parsedExplicitRoom = JSON.parse(explicitRoomValue);
|
||||
|
@ -203,7 +203,7 @@ interface IViewSettingProps extends Pick<IDevtoolsProps, "onBack"> {
|
|||
onEdit(): Promise<void>;
|
||||
}
|
||||
|
||||
const ViewSetting = ({ setting, onEdit, onBack }: IViewSettingProps) => {
|
||||
const ViewSetting: React.FC<IViewSettingProps> = ({ setting, onEdit, onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
|
||||
return (
|
||||
|
@ -261,7 +261,7 @@ interface ISettingsListProps extends Pick<IDevtoolsProps, "onBack"> {
|
|||
onEdit(setting: string): void;
|
||||
}
|
||||
|
||||
const SettingsList = ({ onBack, onView, onEdit }: ISettingsListProps) => {
|
||||
const SettingsList: React.FC<ISettingsListProps> = ({ onBack, onView, onEdit }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ import { CryptoEvent } from "matrix-js-sdk/src/crypto";
|
|||
import { useTypedEventEmitter, useTypedEventEmitterState } from "../../../../hooks/useEventEmitter";
|
||||
import { _t, _td } from "../../../../languageHandler";
|
||||
import MatrixClientContext from "../../../../contexts/MatrixClientContext";
|
||||
import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool";
|
||||
import BaseTool, { DevtoolsContext } from "./BaseTool";
|
||||
import { Tool } from "../DevtoolsDialog";
|
||||
|
||||
const PHASE_MAP: Record<Phase, string> = {
|
||||
[Phase.Unsent]: _td("Unsent"),
|
||||
|
@ -80,7 +81,7 @@ const VerificationRequestExplorer: React.FC<{
|
|||
);
|
||||
};
|
||||
|
||||
const VerificationExplorer = ({ onBack }: IDevtoolsProps) => {
|
||||
const VerificationExplorer: Tool = ({ onBack }) => {
|
||||
const cli = useContext(MatrixClientContext);
|
||||
const context = useContext(DevtoolsContext);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import { UPDATE_EVENT } from "../../../../stores/AsyncStore";
|
|||
import FilteredList from "./FilteredList";
|
||||
import { StateEventEditor } from "./RoomState";
|
||||
|
||||
const WidgetExplorer = ({ onBack }: IDevtoolsProps) => {
|
||||
const WidgetExplorer: React.FC<IDevtoolsProps> = ({ onBack }) => {
|
||||
const context = useContext(DevtoolsContext);
|
||||
const [query, setQuery] = useState("");
|
||||
const [widget, setWidget] = useState<IApp>(null);
|
||||
|
@ -35,7 +35,7 @@ const WidgetExplorer = ({ onBack }: IDevtoolsProps) => {
|
|||
});
|
||||
|
||||
if (widget && widgets.includes(widget)) {
|
||||
const onBack = () => {
|
||||
const onBack = (): void => {
|
||||
setWidget(null);
|
||||
};
|
||||
|
||||
|
|
|
@ -77,24 +77,24 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
};
|
||||
}
|
||||
|
||||
private onCancel = () => {
|
||||
private onCancel = (): void => {
|
||||
if (this.state.resetting) {
|
||||
this.setState({ resetting: false });
|
||||
}
|
||||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
private onUseRecoveryKeyClick = () => {
|
||||
private onUseRecoveryKeyClick = (): void => {
|
||||
this.setState({
|
||||
forceRecoveryKey: true,
|
||||
});
|
||||
};
|
||||
|
||||
private validateRecoveryKeyOnChange = debounce(async () => {
|
||||
private validateRecoveryKeyOnChange = debounce(async (): Promise<void> => {
|
||||
await this.validateRecoveryKey();
|
||||
}, VALIDATION_THROTTLE_MS);
|
||||
|
||||
private async validateRecoveryKey() {
|
||||
private async validateRecoveryKey(): Promise<void> {
|
||||
if (this.state.recoveryKey === "") {
|
||||
this.setState({
|
||||
recoveryKeyValid: null,
|
||||
|
@ -119,7 +119,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
}
|
||||
}
|
||||
|
||||
private onRecoveryKeyChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onRecoveryKeyChange = (ev: ChangeEvent<HTMLInputElement>): void => {
|
||||
this.setState({
|
||||
recoveryKey: ev.target.value,
|
||||
recoveryKeyFileError: null,
|
||||
|
@ -136,7 +136,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
this.validateRecoveryKeyOnChange();
|
||||
};
|
||||
|
||||
private onRecoveryKeyFileChange = async (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onRecoveryKeyFileChange = async (ev: ChangeEvent<HTMLInputElement>): Promise<void> => {
|
||||
if (ev.target.files.length === 0) return;
|
||||
|
||||
const f = ev.target.files[0];
|
||||
|
@ -169,11 +169,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
}
|
||||
};
|
||||
|
||||
private onRecoveryKeyFileUploadClick = () => {
|
||||
private onRecoveryKeyFileUploadClick = (): void => {
|
||||
this.fileUpload.current.click();
|
||||
};
|
||||
|
||||
private onPassPhraseNext = async (ev: FormEvent<HTMLFormElement> | React.MouseEvent) => {
|
||||
private onPassPhraseNext = async (ev: FormEvent<HTMLFormElement> | React.MouseEvent): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
|
||||
if (this.state.passPhrase.length <= 0) return;
|
||||
|
@ -188,7 +188,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
}
|
||||
};
|
||||
|
||||
private onRecoveryKeyNext = async (ev: FormEvent<HTMLFormElement> | React.MouseEvent) => {
|
||||
private onRecoveryKeyNext = async (ev: FormEvent<HTMLFormElement> | React.MouseEvent): Promise<void> => {
|
||||
ev.preventDefault();
|
||||
|
||||
if (!this.state.recoveryKeyValid) return;
|
||||
|
@ -203,19 +203,19 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
}
|
||||
};
|
||||
|
||||
private onPassPhraseChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||
private onPassPhraseChange = (ev: ChangeEvent<HTMLInputElement>): void => {
|
||||
this.setState({
|
||||
passPhrase: ev.target.value,
|
||||
keyMatches: null,
|
||||
});
|
||||
};
|
||||
|
||||
private onResetAllClick = (ev: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
private onResetAllClick = (ev: React.MouseEvent<HTMLAnchorElement>): void => {
|
||||
ev.preventDefault();
|
||||
this.setState({ resetting: true });
|
||||
};
|
||||
|
||||
private onConfirmResetAllClick = async () => {
|
||||
private onConfirmResetAllClick = async (): Promise<void> => {
|
||||
// Hide ourselves so the user can interact with the reset dialogs.
|
||||
// We don't conclude the promise chain (onFinished) yet to avoid confusing
|
||||
// any upstream code flows.
|
||||
|
@ -226,11 +226,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
|
||||
try {
|
||||
// Force reset secret storage (which resets the key backup)
|
||||
await accessSecretStorage(async () => {
|
||||
await accessSecretStorage(async (): Promise<void> => {
|
||||
// Now reset cross-signing so everything Just Works™ again.
|
||||
const cli = MatrixClientPeg.get();
|
||||
await cli.bootstrapCrossSigning({
|
||||
authUploadDeviceSigningKeys: async (makeRequest) => {
|
||||
authUploadDeviceSigningKeys: async (makeRequest): Promise<void> => {
|
||||
const { finished } = Modal.createDialog(InteractiveAuthDialog, {
|
||||
title: _t("Setting up keys"),
|
||||
matrixClient: cli,
|
||||
|
@ -268,7 +268,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
|
|||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
const hasPassphrase =
|
||||
this.props.keyInfo &&
|
||||
this.props.keyInfo.passphrase &&
|
||||
|
|
|
@ -33,7 +33,7 @@ export default class ConfirmDestroyCrossSigningDialog extends React.Component<IP
|
|||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_ConfirmDestroyCrossSigningDialog"
|
||||
|
|
|
@ -167,7 +167,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
|
|||
this.props.onFinished(false);
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
let content;
|
||||
if (this.state.error) {
|
||||
content = (
|
||||
|
|
|
@ -125,7 +125,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent<IProps,
|
|||
|
||||
private onResetRecoveryClick = (): void => {
|
||||
this.props.onFinished(false);
|
||||
accessSecretStorage(async () => {}, /* forceReset = */ true);
|
||||
accessSecretStorage(async (): Promise<void> => {}, /* forceReset = */ true);
|
||||
};
|
||||
|
||||
private onRecoveryKeyChange = (e): void => {
|
||||
|
@ -227,7 +227,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent<IProps,
|
|||
});
|
||||
try {
|
||||
// `accessSecretStorage` may prompt for storage access as needed.
|
||||
await accessSecretStorage(async () => {
|
||||
await accessSecretStorage(async (): Promise<void> => {
|
||||
await MatrixClientPeg.get().restoreKeyBackupWithSecretStorage(
|
||||
this.state.backupInfo,
|
||||
undefined,
|
||||
|
|
|
@ -22,7 +22,7 @@ import { _t } from "../../../../languageHandler";
|
|||
import { SetupEncryptionStore, Phase } from "../../../../stores/SetupEncryptionStore";
|
||||
import { IDialogProps } from "../IDialogProps";
|
||||
|
||||
function iconFromPhase(phase: Phase) {
|
||||
function iconFromPhase(phase: Phase): string {
|
||||
if (phase === Phase.Done) {
|
||||
return require("../../../../../res/img/e2e/verified-deprecated.svg").default;
|
||||
} else {
|
||||
|
@ -45,11 +45,11 @@ export default class SetupEncryptionDialog extends React.Component<IProps, IStat
|
|||
this.state = { icon: iconFromPhase(this.store.phase) };
|
||||
}
|
||||
|
||||
public componentDidMount() {
|
||||
public componentDidMount(): void {
|
||||
this.store.on("update", this.onStoreUpdate);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
public componentWillUnmount(): void {
|
||||
this.store.removeListener("update", this.onStoreUpdate);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ export default class SetupEncryptionDialog extends React.Component<IProps, IStat
|
|||
this.setState({ icon: iconFromPhase(this.store.phase) });
|
||||
};
|
||||
|
||||
public render() {
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<BaseDialog
|
||||
headerImage={this.state.icon}
|
||||
|
|
|
@ -32,7 +32,7 @@ interface Props {
|
|||
room: Room;
|
||||
}
|
||||
|
||||
export function RoomResultContextMenus({ room }: Props) {
|
||||
export function RoomResultContextMenus({ room }: Props): JSX.Element {
|
||||
const [notificationState] = useNotificationState(room);
|
||||
|
||||
const [generalMenuPosition, setGeneralMenuPosition] = useState<DOMRect | null>(null);
|
||||
|
|
|
@ -252,7 +252,7 @@ const findVisibleRooms = (cli: MatrixClient): Room[] => {
|
|||
});
|
||||
};
|
||||
|
||||
const findVisibleRoomMembers = (cli: MatrixClient, filterDMs = true) => {
|
||||
const findVisibleRoomMembers = (cli: MatrixClient, filterDMs = true): RoomMember[] => {
|
||||
return Object.values(
|
||||
findVisibleRooms(cli)
|
||||
.filter((room) => !filterDMs || !DMRoomMap.shared().getUserIdForRoomId(room.roomId))
|
||||
|
@ -489,7 +489,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
room: { roomId: string; roomAlias?: string; autoJoin?: boolean; shouldPeek?: boolean },
|
||||
persist = false,
|
||||
viaKeyboard = false,
|
||||
) => {
|
||||
): void => {
|
||||
if (persist) {
|
||||
const recents = new Set(SettingsStore.getValue("SpotlightSearch.recentSearches", null).reverse());
|
||||
// remove & add the room to put it at the end
|
||||
|
@ -620,7 +620,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
const showViewButton =
|
||||
clientRoom?.getMyMembership() === "join" || result.publicRoom.world_readable || cli.isGuest();
|
||||
|
||||
const listener = (ev) => {
|
||||
const listener = (ev): void => {
|
||||
const { publicRoom } = result;
|
||||
viewRoom(
|
||||
{
|
||||
|
@ -1060,7 +1060,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
);
|
||||
}
|
||||
|
||||
const onDialogKeyDown = (ev: KeyboardEvent) => {
|
||||
const onDialogKeyDown = (ev: KeyboardEvent): void => {
|
||||
const navigationAction = getKeyBindingsManager().getNavigationAction(ev);
|
||||
switch (navigationAction) {
|
||||
case KeyBindingAction.FilterRooms:
|
||||
|
@ -1131,7 +1131,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
|||
}
|
||||
};
|
||||
|
||||
const onKeyDown = (ev: KeyboardEvent) => {
|
||||
const onKeyDown = (ev: KeyboardEvent): void => {
|
||||
const action = getKeyBindingsManager().getAccessibilityAction(ev);
|
||||
|
||||
switch (action) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue