Enable @typescript-eslint/explicit-member-accessibility on /src (#9785)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier
This commit is contained in:
Michael Telatynski 2022-12-16 12:29:59 +00:00 committed by GitHub
parent 51554399fb
commit f1e8e7f140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
396 changed files with 1110 additions and 1098 deletions

View file

@ -42,7 +42,7 @@ export default abstract class AudioPlayerBase<T extends IProps = IProps> extends
protected seekRef: RefObject<SeekBar> = createRef();
protected playPauseRef: RefObject<PlayPauseButton> = createRef();
constructor(props: T) {
public constructor(props: T) {
super(props);
// Playback instances can be reused in the composer

View file

@ -39,14 +39,14 @@ export default class LiveRecordingClock extends React.PureComponent<IProps, ISta
() => requestAnimationFrame(() => this.scheduledUpdate.trigger()),
);
constructor(props) {
public constructor(props) {
super(props);
this.state = {
seconds: 0,
};
}
componentDidMount() {
public componentDidMount() {
this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => {
this.seconds = update.timeSeconds;
this.scheduledUpdate.mark();

View file

@ -44,14 +44,14 @@ export default class LiveRecordingWaveform extends React.PureComponent<IProps, I
() => requestAnimationFrame(() => this.scheduledUpdate.trigger()),
);
constructor(props) {
public constructor(props) {
super(props);
this.state = {
waveform: arraySeed(0, RECORDING_PLAYBACK_SAMPLES),
};
}
componentDidMount() {
public componentDidMount() {
this.props.recorder.liveData.onUpdate((update: IRecordingUpdate) => {
// The incoming data is between zero and one, so we don't need to clamp/rescale it.
this.waveform = arrayFastResample(Array.from(update.waveform), RECORDING_PLAYBACK_SAMPLES);

View file

@ -56,7 +56,7 @@ export default class SeekBar extends React.PureComponent<IProps, IState> {
disabled: false,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -34,14 +34,14 @@ interface ICaptchaFormState {
* A pure UI component which displays a captcha form.
*/
export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICaptchaFormState> {
static defaultProps = {
public static defaultProps = {
onCaptchaResponse: () => {},
};
private captchaWidgetId?: string;
private recaptchaContainer = createRef<HTMLDivElement>();
constructor(props: ICaptchaFormProps) {
public constructor(props: ICaptchaFormProps) {
super(props);
this.state = {
@ -49,7 +49,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
};
}
componentDidMount() {
public componentDidMount() {
// Just putting a script tag into the returned jsx doesn't work, annoyingly,
// so we do this instead.
if (this.isRecaptchaReady()) {
@ -69,7 +69,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
componentWillUnmount() {
public componentWillUnmount() {
this.resetRecaptcha();
}
@ -122,7 +122,7 @@ export default class CaptchaForm extends React.Component<ICaptchaFormProps, ICap
}
}
render() {
public render() {
let error = null;
if (this.state.errorText) {
error = <div className="error">{this.state.errorText}</div>;

View file

@ -53,7 +53,7 @@ interface IState {
}
export default class CountryDropdown extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let defaultCountry: PhoneNumberCountryDefinition = COUNTRIES[0];

View file

@ -39,7 +39,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class EmailField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Email"),
labelRequired: _td("Enter email address"),
labelInvalid: _td("Doesn't look like a valid email address"),
@ -60,7 +60,7 @@ class EmailField extends PureComponent<IProps> {
],
});
onValidate = async (fieldState: IFieldState) => {
public onValidate = async (fieldState: IFieldState) => {
let validate = this.validate;
if (this.props.validationRules) {
validate = this.props.validationRules;
@ -74,7 +74,7 @@ class EmailField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -98,9 +98,9 @@ interface IPasswordAuthEntryState {
}
export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswordAuthEntryState> {
static LOGIN_TYPE = AuthType.Password;
public static LOGIN_TYPE = AuthType.Password;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -108,7 +108,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -136,7 +136,7 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
});
};
render() {
public render() {
const passwordBoxClass = classNames({
error: this.props.errorText,
});
@ -194,9 +194,9 @@ interface IRecaptchaAuthEntryProps extends IAuthEntryProps {
/* eslint-enable camelcase */
export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps> {
static LOGIN_TYPE = AuthType.Recaptcha;
public static LOGIN_TYPE = AuthType.Recaptcha;
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -207,7 +207,7 @@ export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps
});
};
render() {
public render() {
if (this.props.busy) {
return <Spinner />;
}
@ -262,9 +262,9 @@ interface ITermsAuthEntryState {
}
export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITermsAuthEntryState> {
static LOGIN_TYPE = AuthType.Terms;
public static LOGIN_TYPE = AuthType.Terms;
constructor(props) {
public constructor(props) {
super(props);
// example stageParams:
@ -320,7 +320,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
@ -349,7 +349,7 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
}
};
render() {
public render() {
if (this.props.busy) {
return <Spinner />;
}
@ -423,9 +423,9 @@ export class EmailIdentityAuthEntry extends React.Component<
IEmailIdentityAuthEntryProps,
IEmailIdentityAuthEntryState
> {
static LOGIN_TYPE = AuthType.Email;
public static LOGIN_TYPE = AuthType.Email;
constructor(props: IEmailIdentityAuthEntryProps) {
public constructor(props: IEmailIdentityAuthEntryProps) {
super(props);
this.state = {
@ -434,11 +434,11 @@ export class EmailIdentityAuthEntry extends React.Component<
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
render() {
public render() {
let errorSection;
// ignore the error when errcode is M_UNAUTHORIZED as we expect that error until the link is clicked.
if (this.props.errorText && this.props.errorCode !== "M_UNAUTHORIZED") {
@ -549,13 +549,13 @@ interface IMsisdnAuthEntryState {
}
export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsisdnAuthEntryState> {
static LOGIN_TYPE = AuthType.Msisdn;
public static LOGIN_TYPE = AuthType.Msisdn;
private submitUrl: string;
private sid: string;
private msisdn: string;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -565,7 +565,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
this.setState({ requestingToken: true });
@ -646,7 +646,7 @@ export class MsisdnAuthEntry extends React.Component<IMsisdnAuthEntryProps, IMsi
}
};
render() {
public render() {
if (this.state.requestingToken) {
return <Spinner />;
} else {
@ -704,16 +704,16 @@ interface ISSOAuthEntryState {
}
export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEntryState> {
static LOGIN_TYPE = AuthType.Sso;
static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable;
public static LOGIN_TYPE = AuthType.Sso;
public static UNSTABLE_LOGIN_TYPE = AuthType.SsoUnstable;
static PHASE_PREAUTH = 1; // button to start SSO
static PHASE_POSTAUTH = 2; // button to confirm SSO completed
public static PHASE_PREAUTH = 1; // button to start SSO
public static PHASE_POSTAUTH = 2; // button to confirm SSO completed
private ssoUrl: string;
private popupWindow: Window;
constructor(props) {
public constructor(props) {
super(props);
// We actually send the user through fallback auth so we don't have to
@ -729,11 +729,11 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
};
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(SSOAuthEntry.PHASE_PREAUTH);
}
componentWillUnmount() {
public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) {
this.popupWindow.close();
@ -770,7 +770,7 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
this.props.submitAuthDict({});
};
render() {
public render() {
let continueButton = null;
const cancelButton = (
<AccessibleButton
@ -825,7 +825,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
private popupWindow: Window;
private fallbackButton = createRef<HTMLButtonElement>();
constructor(props) {
public constructor(props) {
super(props);
// we have to make the user click a button, as browsers will block
@ -834,11 +834,11 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
window.addEventListener("message", this.onReceiveMessage);
}
componentDidMount() {
public componentDidMount() {
this.props.onPhaseChange(DEFAULT_PHASE);
}
componentWillUnmount() {
public componentWillUnmount() {
window.removeEventListener("message", this.onReceiveMessage);
if (this.popupWindow) {
this.popupWindow.close();
@ -865,7 +865,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
}
};
render() {
public render() {
let errorSection;
if (this.props.errorText) {
errorSection = (

View file

@ -35,7 +35,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class PassphraseConfirmField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Confirm password"),
labelRequired: _td("Confirm password"),
labelInvalid: _td("Passwords don't match"),
@ -65,7 +65,7 @@ class PassphraseConfirmField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -41,7 +41,7 @@ interface IProps extends Omit<IInputProps, "onValidate"> {
}
class PassphraseField extends PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
label: _td("Password"),
labelEnterPassword: _td("Enter password"),
labelStrongPassword: _td("Nice, strong password!"),
@ -94,7 +94,7 @@ class PassphraseField extends PureComponent<IProps> {
],
});
onValidate = async (fieldState: IFieldState) => {
public onValidate = async (fieldState: IFieldState) => {
const result = await this.validate(fieldState);
if (this.props.onValidate) {
this.props.onValidate(result);
@ -102,7 +102,7 @@ class PassphraseField extends PureComponent<IProps> {
return result;
};
render() {
public render() {
return (
<Field
id={this.props.id}

View file

@ -66,7 +66,7 @@ enum LoginField {
* The email/username/phone fields are fully-controlled, the password field is not.
*/
export default class PasswordLogin extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onUsernameChanged: function () {},
onUsernameBlur: function () {},
onPhoneCountryChanged: function () {},
@ -75,7 +75,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
disableSubmit: false,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// Field error codes by field ID
@ -363,7 +363,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
}
}
render() {
public render() {
let forgotPasswordJsx;
if (this.props.onForgotPasswordClick) {

View file

@ -95,12 +95,12 @@ interface IState {
* A pure UI component which displays a registration form.
*/
export default class RegistrationForm extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onValidationChange: logger.error,
canSubmit: true,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -468,7 +468,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderPasswordConfirm() {
public renderPasswordConfirm() {
return (
<PassphraseConfirmField
id="mx_RegistrationForm_passwordConfirm"
@ -482,7 +482,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderPhoneNumber() {
public renderPhoneNumber() {
if (!this.showPhoneNumber()) {
return null;
}
@ -508,7 +508,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
renderUsername() {
public renderUsername() {
return (
<Field
id="mx_RegistrationForm_username"
@ -524,7 +524,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
);
}
render() {
public render() {
const registerButton = (
<input className="mx_Login_submit" type="submit" value={_t("Register")} disabled={!this.props.canSubmit} />
);

View file

@ -82,7 +82,7 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
private isUnmounted = false;
private isWatchingTimeline = false;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -54,7 +54,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
oobData: {},
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -34,7 +34,7 @@ interface IState {
export default class DialpadContextMenu extends React.Component<IProps, IState> {
private numberEntryFieldRef: React.RefObject<Field> = createRef();
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -42,7 +42,7 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
};
}
onDigitPress = (digit: string, ev: ButtonEvent) => {
public onDigitPress = (digit: string, ev: ButtonEvent) => {
this.props.call.sendDtmfDigit(digit);
this.setState({ value: this.state.value + digit });
@ -54,22 +54,22 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
}
};
onCancelClick = () => {
public onCancelClick = () => {
this.props.onFinished();
};
onKeyDown = (ev) => {
public onKeyDown = (ev) => {
// Prevent Backspace and Delete keys from functioning in the entry field
if (ev.code === "Backspace" || ev.code === "Delete") {
ev.preventDefault();
}
};
onChange = (ev) => {
public onChange = (ev) => {
this.setState({ value: ev.target.value });
};
render() {
public render() {
return (
<ContextMenu {...this.props}>
<div className="mx_DialPadContextMenuWrapper">

View file

@ -29,7 +29,7 @@ interface IProps {
* menu.
*/
export default class GenericElementContextMenu extends React.Component<IProps> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
}

View file

@ -26,27 +26,27 @@ interface IProps extends IContextMenuProps {
}
export default class LegacyCallContextMenu extends React.Component<IProps> {
constructor(props) {
public constructor(props) {
super(props);
}
onHoldClick = () => {
public onHoldClick = () => {
this.props.call.setRemoteOnHold(true);
this.props.onFinished();
};
onUnholdClick = () => {
public onUnholdClick = () => {
LegacyCallHandler.instance.setActiveCallRoomId(this.props.call.roomId);
this.props.onFinished();
};
onTransferClick = () => {
public onTransferClick = () => {
LegacyCallHandler.instance.showTransferDialog(this.props.call);
this.props.onFinished();
};
render() {
public render() {
const holdUnholdCaption = this.props.call.isRemoteOnHold() ? _t("Resume") : _t("Hold");
const handler = this.props.call.isRemoteOnHold() ? this.onUnholdClick : this.onHoldClick;

View file

@ -135,12 +135,12 @@ interface IState {
}
export default class MessageContextMenu extends React.Component<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
private reactButtonRef = createRef<any>(); // XXX Ref to a functional component
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -88,7 +88,7 @@ export default class BaseDialog extends React.Component<IProps> {
fixedWidth: true,
};
constructor(props) {
public constructor(props) {
super(props);
this.matrixClient = MatrixClientPeg.get();

View file

@ -54,7 +54,7 @@ interface IState {
export default class BugReportDialog extends React.Component<IProps, IState> {
private unmounted: boolean;
constructor(props) {
public constructor(props) {
super(props);
this.state = {
sendLogs: true,

View file

@ -30,7 +30,7 @@ interface IProps {
const REPOS = ["vector-im/element-web", "matrix-org/matrix-react-sdk", "matrix-org/matrix-js-sdk"];
export default class ChangelogDialog extends React.Component<IProps> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {};

View file

@ -45,7 +45,7 @@ interface IState {
* To avoid this, we keep the dialog open as long as /redact is in progress.
*/
export default class ConfirmAndWaitRedactDialog extends React.PureComponent<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
isRedacting: false,

View file

@ -31,7 +31,7 @@ interface IProps {
* A dialog for confirming a redaction.
*/
export default class ConfirmRedactDialog extends React.Component<IProps> {
render() {
public render() {
return (
<TextInputDialog
onFinished={this.props.onFinished}

View file

@ -55,12 +55,12 @@ interface IState {
* Also tweaks the style for 'dangerous' actions (albeit only with colour)
*/
export default class ConfirmUserActionDialog extends React.Component<IProps, IState> {
static defaultProps = {
public static defaultProps = {
danger: false,
askReason: false,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -33,7 +33,7 @@ export default class ConfirmWipeDeviceDialog extends React.Component<IProps> {
this.props.onFinished(false);
};
render() {
public render() {
return (
<BaseDialog
className="mx_ConfirmWipeDeviceDialog"

View file

@ -62,7 +62,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
private nameField = createRef<Field>();
private aliasField = createRef<RoomAliasField>();
constructor(props) {
public constructor(props) {
super(props);
this.supportsRestricted = !!this.props.parentSpace;
@ -124,7 +124,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
return opts;
}
componentDidMount() {
public componentDidMount() {
// move focus to first field when showing dialog
this.nameField.current.focus();
}
@ -216,7 +216,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
],
});
render() {
public render() {
const isVideoRoom = this.props.type === RoomType.ElementVideo;
let aliasField: JSX.Element;

View file

@ -46,7 +46,7 @@ interface IState {
}
export default class DeactivateAccountDialog extends React.Component<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {

View file

@ -59,7 +59,7 @@ export default class EndPollDialog extends React.Component<IProps> {
this.props.onFinished(endPoll);
};
render() {
public render() {
return (
<QuestionDialog
title={_t("End Poll")}

View file

@ -42,7 +42,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
private iframeRef: React.RefObject<HTMLIFrameElement> = React.createRef();
private readonly config: SnakedObject<IConfigOptions["host_signup"]>;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -56,7 +56,7 @@ interface IState {
export default class IncomingSasDialog extends React.Component<IProps, IState> {
private showSasEvent: ISasEvent;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let phase = PHASE_START;

View file

@ -34,7 +34,7 @@ interface IProps extends IDialogProps {
}
export default class InfoDialog extends React.Component<IProps> {
static defaultProps = {
public static defaultProps = {
title: "",
description: "",
hasCloseButton: false,
@ -44,7 +44,7 @@ export default class InfoDialog extends React.Component<IProps> {
this.props.onFinished();
};
render() {
public render() {
return (
<BaseDialog
className="mx_InfoDialog"

View file

@ -83,7 +83,7 @@ interface IState {
}
export default class InteractiveAuthDialog extends React.Component<InteractiveAuthDialogProps, IState> {
constructor(props: InteractiveAuthDialogProps) {
public constructor(props: InteractiveAuthDialogProps) {
super(props);
this.state = {

View file

@ -100,7 +100,7 @@ class DMUserTile extends React.PureComponent<IDMUserTileProps> {
this.props.onRemove(this.props.member);
};
render() {
public render() {
const avatarSize = 20;
const avatar = <SearchResultAvatar user={this.props.member} size={avatarSize} />;
@ -187,7 +187,7 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
return result;
}
render() {
public render() {
let timestamp = null;
if (this.props.lastActiveTs) {
const humanTs = humanizeTime(this.props.lastActiveTs);
@ -301,7 +301,7 @@ interface IInviteDialogState {
}
export default class InviteDialog extends React.PureComponent<Props, IInviteDialogState> {
static defaultProps = {
public static defaultProps = {
kind: KIND_DM,
initialText: "",
};
@ -311,7 +311,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
private numberEntryFieldRef: React.RefObject<Field> = createRef();
private unmounted = false;
constructor(props) {
public constructor(props) {
super(props);
if (props.kind === KIND_INVITE && !props.roomId) {
@ -351,13 +351,13 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
};
}
componentDidMount() {
public componentDidMount() {
if (this.props.initialText) {
this.updateSuggestions(this.props.initialText);
}
}
componentWillUnmount() {
public componentWillUnmount() {
this.unmounted = true;
}
@ -1078,7 +1078,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
}
}
render() {
public render() {
let spinner = null;
if (this.state.busy) {
spinner = <Spinner w={20} h={20} />;

View file

@ -41,11 +41,11 @@ interface IState {
}
export default class LogoutDialog extends React.Component<IProps, IState> {
static defaultProps = {
public static defaultProps = {
onFinished: function () {},
};
constructor(props) {
public constructor(props) {
super(props);
const cli = MatrixClientPeg.get();
@ -127,7 +127,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
this.props.onFinished(true);
};
render() {
public render() {
if (this.state.shouldLoadBackupStatus) {
const description = (
<div>

View file

@ -48,7 +48,7 @@ interface IState {
}
export default class MessageEditHistoryDialog extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
originalEvent: null,

View file

@ -61,11 +61,11 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
private readonly possibleButtons: ModalButtonID[];
private appFrame: React.RefObject<HTMLIFrameElement> = React.createRef();
state: IState = {
public state: IState = {
disabledButtonIds: (this.props.widgetDefinition.buttons || []).filter((b) => b.disabled).map((b) => b.id),
};
constructor(props) {
public constructor(props) {
super(props);
this.widget = new ElementWidget({

View file

@ -96,7 +96,7 @@ export default class ReportEventDialog extends React.Component<IProps, IState> {
// If the room supports moderation, the moderation information.
private moderation?: Moderation;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
let moderatedByRoomId = null;

View file

@ -55,7 +55,7 @@ interface IState {
export default class RoomSettingsDialog extends React.Component<IProps, IState> {
private dispatcherRef: string;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = { roomName: "" };
}
@ -180,7 +180,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
return tabs;
}
render() {
public render() {
const roomName = this.state.roomName;
return (
<BaseDialog

View file

@ -37,11 +37,11 @@ interface IState {
export default class RoomUpgradeDialog extends React.Component<IProps, IState> {
private targetVersion: string;
state = {
public state = {
busy: true,
};
async componentDidMount() {
public async componentDidMount() {
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> {
});
};
render() {
public render() {
let buttons;
if (this.state.busy) {
buttons = <Spinner />;

View file

@ -53,7 +53,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
private readonly isPrivate: boolean;
private readonly currentVersion: string;
constructor(props) {
public constructor(props) {
super(props);
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
@ -100,7 +100,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
Modal.createDialog(BugReportDialog, {});
};
render() {
public render() {
const brand = SdkConfig.get().brand;
let inviteToggle = null;

View file

@ -45,7 +45,7 @@ export default class ServerPickerDialog extends React.PureComponent<IProps, ISta
private readonly fieldRef = createRef<Field>();
private validatedConf: ValidatedServerConfig;
constructor(props) {
public constructor(props) {
super(props);
const config = SdkConfig.get();

View file

@ -22,7 +22,7 @@ import DialogButtons from "../elements/DialogButtons";
import { IDialogProps } from "./IDialogProps";
export default class SeshatResetDialog extends React.PureComponent<IDialogProps> {
render() {
public render() {
return (
<BaseDialog
hasCancel={true}

View file

@ -46,7 +46,7 @@ interface IState {
export default class SetEmailDialog extends React.Component<IProps, IState> {
private addThreepid: AddThreepid;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -75,7 +75,7 @@ interface IState {
}
export default class ShareDialog extends React.PureComponent<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
let permalinkCreator: RoomPermalinkCreator = null;
@ -91,7 +91,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
};
}
static onLinkClick(e) {
public static onLinkClick(e) {
e.preventDefault();
selectText(e.target);
}
@ -124,7 +124,7 @@ export default class ShareDialog extends React.PureComponent<IProps, IState> {
return matrixToUrl;
}
render() {
public render() {
let title;
let checkbox;

View file

@ -33,7 +33,7 @@ class TermsCheckbox extends React.PureComponent<ITermsCheckboxProps> {
this.props.onChange(this.props.url, ev.currentTarget.checked);
};
render() {
public render() {
return <input type="checkbox" onChange={this.onChange} checked={this.props.checked} />;
}
}
@ -63,7 +63,7 @@ interface IState {
}
export default class TermsDialog extends React.PureComponent<ITermsDialogProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// url -> boolean

View file

@ -54,7 +54,7 @@ export default class TextInputDialog extends React.Component<IProps, IState> {
hasCancel: true,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -35,11 +35,11 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
private readonly objectUrl: string;
private readonly mimeType: string;
static defaultProps = {
public static defaultProps = {
totalFiles: 1,
};
constructor(props) {
public constructor(props) {
super(props);
// Create a fresh `Blob` for previewing (even though `File` already is
@ -49,7 +49,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
this.objectUrl = URL.createObjectURL(blob);
}
componentWillUnmount() {
public componentWillUnmount() {
if (this.objectUrl) URL.revokeObjectURL(this.objectUrl);
}
@ -65,7 +65,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
this.props.onFinished(true, true);
};
render() {
public render() {
let title: string;
if (this.props.totalFiles > 1 && this.props.currentIndex !== undefined) {
title = _t("Upload files (%(current)s of %(total)s)", {

View file

@ -50,7 +50,7 @@ interface IState {
export default class UserSettingsDialog extends React.Component<IProps, IState> {
private settingsWatchers: string[] = [];
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -210,7 +210,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
return tabs;
}
render() {
public render() {
return (
<BaseDialog
className="mx_UserSettingsDialog"

View file

@ -35,7 +35,7 @@ interface IState {
}
export default class VerificationRequestDialog extends React.Component<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
verificationRequest: this.props.verificationRequest,
@ -47,7 +47,7 @@ export default class VerificationRequestDialog extends React.Component<IProps, I
}
}
render() {
public render() {
const request = this.state.verificationRequest;
const otherUserId = request && request.otherUserId;
const member = this.props.member || (otherUserId && MatrixClientPeg.get().getUser(otherUserId));

View file

@ -46,7 +46,7 @@ interface IState {
export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<IProps, IState> {
private eventPermissionsMap = new Map<Capability, WidgetEventCapability>();
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
const parsedEvents = WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities);

View file

@ -38,7 +38,7 @@ interface IState {
}
export default class WidgetOpenIDPermissionsDialog extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -62,7 +62,7 @@ interface IState {
export default class AccessSecretStorageDialog extends React.PureComponent<IProps, IState> {
private fileUpload = React.createRef<HTMLInputElement>();
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -268,7 +268,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent<IProp
}
}
render() {
public render() {
const hasPassphrase =
this.props.keyInfo &&
this.props.keyInfo.passphrase &&

View file

@ -33,7 +33,7 @@ export default class ConfirmDestroyCrossSigningDialog extends React.Component<IP
this.props.onFinished(false);
};
render() {
public render() {
return (
<BaseDialog
className="mx_ConfirmDestroyCrossSigningDialog"

View file

@ -46,7 +46,7 @@ interface IState {
* may need to complete some steps to proceed.
*/
export default class CreateCrossSigningDialog extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -167,7 +167,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
this.props.onFinished(false);
};
render() {
public render() {
let content;
if (this.state.error) {
content = (

View file

@ -77,11 +77,11 @@ interface IState {
* Dialog for restoring e2e keys from a backup and the user's recovery key
*/
export default class RestoreKeyBackupDialog extends React.PureComponent<IProps, IState> {
static defaultProps = {
public static defaultProps = {
showSummary: true,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {
backupInfo: null,

View file

@ -38,7 +38,7 @@ interface IState {
export default class SetupEncryptionDialog extends React.Component<IProps, IState> {
private store: SetupEncryptionStore;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.store = SetupEncryptionStore.sharedInstance();

View file

@ -36,14 +36,14 @@ interface IState {
}
export default class AccessibleTooltipButton extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
hover: false,
};
}
componentDidUpdate(prevProps: Readonly<IProps>) {
public componentDidUpdate(prevProps: Readonly<IProps>) {
if (!prevProps.forceHide && this.props.forceHide && this.state.hover) {
this.setState({
hover: false,
@ -73,7 +73,7 @@ export default class AccessibleTooltipButton extends React.PureComponent<IProps,
if (ev.relatedTarget) this.showTooltip();
};
render() {
public render() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { title, tooltip, children, tooltipClassName, forceHide, alignment, onHideTooltip, ...props } =
this.props;

View file

@ -44,11 +44,11 @@ interface IState {
}
export default class AppPermission extends React.Component<IProps, IState> {
static defaultProps: Partial<IProps> = {
public static defaultProps: Partial<IProps> = {
onPermissionGranted: () => {},
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
// The first step is to pick apart the widget so we can render information about it
@ -88,7 +88,7 @@ export default class AppPermission extends React.Component<IProps, IState> {
}
}
render() {
public render() {
const brand = SdkConfig.get().brand;
const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId;

View file

@ -104,7 +104,7 @@ interface IState {
export default class AppTile extends React.Component<IProps, IState> {
public static contextType = MatrixClientContext;
context: ContextType<typeof MatrixClientContext>;
public context: ContextType<typeof MatrixClientContext>;
public static defaultProps: Partial<IProps> = {
waitForIframeLoad: true,
@ -126,7 +126,7 @@ export default class AppTile extends React.Component<IProps, IState> {
private dispatcherRef: string;
private unmounted: boolean;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
// Tiles in miniMode are floating, and therefore not docked

View file

@ -47,7 +47,7 @@ export interface ExistingSourceIProps {
}
export class ExistingSource extends React.Component<ExistingSourceIProps> {
constructor(props: ExistingSourceIProps) {
public constructor(props: ExistingSourceIProps) {
super(props);
}
@ -55,7 +55,7 @@ export class ExistingSource extends React.Component<ExistingSourceIProps> {
this.props.onSelect(this.props.source);
};
render() {
public render() {
const thumbnailClasses = classNames({
mx_desktopCapturerSourcePicker_source_thumbnail: true,
mx_desktopCapturerSourcePicker_source_thumbnail_selected: this.props.selected,
@ -84,9 +84,9 @@ export interface PickerIProps {
}
export default class DesktopCapturerSourcePicker extends React.Component<PickerIProps, PickerIState> {
interval: number;
public interval: number;
constructor(props: PickerIProps) {
public constructor(props: PickerIProps) {
super(props);
this.state = {
@ -96,7 +96,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
};
}
async componentDidMount() {
public async componentDidMount() {
// window.setInterval() first waits and then executes, therefore
// we call getDesktopCapturerSources() here without any delay.
// Otherwise the dialog would be left empty for some time.
@ -112,7 +112,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
}, 500);
}
componentWillUnmount() {
public componentWillUnmount() {
clearInterval(this.interval);
}
@ -149,7 +149,7 @@ export default class DesktopCapturerSourcePicker extends React.Component<PickerI
return new Tab(type, label, null, <div className="mx_desktopCapturerSourcePicker_tab">{sources}</div>);
}
render() {
public render() {
const tabs = [
this.getTab("screen", _t("Share entire screen")),
this.getTab("window", _t("Application window")),

View file

@ -25,7 +25,7 @@ interface IProps {
}
export default class DialPadBackspaceButton extends React.PureComponent<IProps> {
render() {
public render() {
return (
<div className="mx_DialPadBackspaceButtonWrapper">
<AccessibleButton

View file

@ -34,7 +34,7 @@ export interface ILocationState {
}
export default class Draggable extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -73,7 +73,7 @@ export default class Draggable extends React.Component<IProps, IState> {
});
}
render() {
public render() {
return <div className={this.props.className} onMouseDown={this.onMouseDown} />;
}
}

View file

@ -35,7 +35,7 @@ interface IMenuOptionProps {
}
class MenuOption extends React.Component<IMenuOptionProps> {
static defaultProps = {
public static defaultProps = {
disabled: false,
};
@ -49,7 +49,7 @@ class MenuOption extends React.Component<IMenuOptionProps> {
this.props.onClick(this.props.dropdownKey);
};
render() {
public render() {
const optClasses = classnames({
mx_Dropdown_option: true,
mx_Dropdown_option_highlight: this.props.highlighted,
@ -117,7 +117,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
private ignoreEvent: MouseEvent = null;
private childrenByKey: Record<string, ReactNode> = {};
constructor(props: DropdownProps) {
public constructor(props: DropdownProps) {
super(props);
this.reindexChildren(this.props.children);
@ -149,7 +149,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
}
}
componentWillUnmount() {
public componentWillUnmount() {
document.removeEventListener("click", this.onDocumentClick, false);
}
@ -327,7 +327,7 @@ export default class Dropdown extends React.Component<DropdownProps, IState> {
return options;
}
render() {
public render() {
let currentValue;
const menuStyle: CSSProperties = {};

View file

@ -57,7 +57,7 @@ export class EditableItem extends React.Component<IItemProps, IItemState> {
this.setState({ verifyRemove: false });
};
render() {
public render() {
if (this.state.verifyRemove) {
return (
<div className="mx_EditableItem">
@ -148,7 +148,7 @@ export default class EditableItemList<P = {}> extends React.PureComponent<IProps
);
}
render() {
public render() {
const editableItems = this.props.items.map((item, index) => {
if (!this.props.canRemove) {
return <li key={item}>{item}</li>;

View file

@ -62,7 +62,7 @@ export default class EditableText extends React.Component<IProps, IState> {
blurToSubmit: false,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -66,7 +66,7 @@ export default class EditableTextContainer extends React.Component<IProps, IStat
},
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -34,7 +34,7 @@ interface IState {
* catch exceptions during rendering in the component tree below them.
*/
export default class ErrorBoundary extends React.PureComponent<{}, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
@ -42,13 +42,13 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
};
}
static getDerivedStateFromError(error: Error): Partial<IState> {
public static getDerivedStateFromError(error: Error): Partial<IState> {
// Side effects are not permitted here, so we only update the state so
// that the next render shows an error message.
return { error };
}
componentDidCatch(error: Error, { componentStack }: ErrorInfo): void {
public componentDidCatch(error: Error, { componentStack }: ErrorInfo): void {
// Browser consoles are better at formatting output when native errors are passed
// in their own `console.error` invocation.
logger.error(error);
@ -73,7 +73,7 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
});
};
render() {
public render() {
if (this.state.error) {
const newIssueUrl = "https://github.com/vector-im/element-web/issues/new/choose";

View file

@ -79,17 +79,17 @@ enum TransitionType {
const SEP = ",";
export default class EventListSummary extends React.Component<IProps> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
static defaultProps = {
public static defaultProps = {
summaryLength: 1,
threshold: 3,
avatarsMaxLength: 5,
layout: Layout.Group,
};
shouldComponentUpdate(nextProps: IProps): boolean {
public shouldComponentUpdate(nextProps: IProps): boolean {
// Update if
// - The number of summarised events has changed
// - or if the summary is about to toggle to become collapsed
@ -451,7 +451,7 @@ export default class EventListSummary extends React.Component<IProps> {
}
}
getAggregate(userEvents: Record<string, IUserEvents[]>) {
public getAggregate(userEvents: Record<string, IUserEvents[]>) {
// A map of aggregate type to arrays of display names. Each aggregate type
// is a comma-delimited string of transitions, e.g. "joined,left,kicked".
// The array of display names is the array of users who went through that
@ -489,7 +489,7 @@ export default class EventListSummary extends React.Component<IProps> {
};
}
render() {
public render() {
const eventsToRender = this.props.events;
// Map user IDs to latest Avatar Member. ES6 Maps are ordered by when the key was created,

View file

@ -63,7 +63,7 @@ interface IState {
const AVATAR_SIZE = 32;
export default class EventTilePreview extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
message: props.message,

View file

@ -145,7 +145,7 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
});
}, VALIDATION_THROTTLE_MS);
constructor(props) {
public constructor(props) {
super(props);
this.state = {
valid: undefined,

View file

@ -33,7 +33,7 @@ interface IState {
}
export default class IRCTimelineProfileResizer extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -42,7 +42,7 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
};
}
componentDidMount() {
public componentDidMount() {
this.setState(
{
IRCLayoutRoot: document.querySelector(".mx_IRCLayout"),
@ -91,7 +91,7 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
}
};
render() {
public render() {
return <Draggable className="mx_ProfileResizer" dragFunc={this.dragFunc} onMouseUp={this.onMoueUp} />;
}
}

View file

@ -91,7 +91,7 @@ interface IState {
}
export default class ImageView extends React.Component<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
const { thumbnailInfo } = this.props;
@ -126,7 +126,7 @@ export default class ImageView extends React.Component<IProps, IState> {
private animatingLoading = false;
private imageIsLoaded = false;
componentDidMount() {
public componentDidMount() {
// We have to use addEventListener() because the listener
// needs to be passive in order to work with Chromium
this.focusLock.current.addEventListener("wheel", this.onWheel, { passive: false });
@ -136,7 +136,7 @@ export default class ImageView extends React.Component<IProps, IState> {
this.image.current.addEventListener("load", this.imageLoaded);
}
componentWillUnmount() {
public componentWillUnmount() {
this.focusLock.current.removeEventListener("wheel", this.onWheel);
window.removeEventListener("resize", this.recalculateZoom);
this.image.current.removeEventListener("load", this.imageLoaded);
@ -411,7 +411,7 @@ export default class ImageView extends React.Component<IProps, IState> {
return <React.Fragment>{contextMenu}</React.Fragment>;
}
render() {
public render() {
const showEventMeta = !!this.props.mxEvent;
let transitionClassName;

View file

@ -35,11 +35,11 @@ interface ITooltipProps {
}
export default class InfoTooltip extends React.PureComponent<ITooltipProps> {
constructor(props: ITooltipProps) {
public constructor(props: ITooltipProps) {
super(props);
}
render() {
public render() {
const { tooltip, children, tooltipClassName, className, kind } = this.props;
const title = _t("Information");
const iconClassName =

View file

@ -25,12 +25,12 @@ interface IProps {
}
export default class InlineSpinner extends React.PureComponent<IProps> {
static defaultProps = {
public static defaultProps = {
w: 16,
h: 16,
};
render() {
public render() {
return (
<div className="mx_InlineSpinner">
<div

View file

@ -308,7 +308,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
side: Direction.Top,
};
constructor(props, context) {
public constructor(props, context) {
super(props, context);
this.state = {
@ -317,7 +317,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
};
}
componentDidUpdate() {
public componentDidUpdate() {
// Whenever this passthrough component updates, also render the tooltip
// in a separate DOM tree. This allows the tooltip content to participate
// the normal React rendering cycle: when this component re-renders, the
@ -327,7 +327,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
this.renderTooltip();
}
componentWillUnmount() {
public componentWillUnmount() {
document.removeEventListener("mousemove", this.onMouseMove);
}
@ -486,7 +486,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
ReactDOM.render(tooltip, getOrCreateContainer());
}
render() {
public render() {
return this.props.children({
ref: this.collectTarget,
onMouseOver: this.onTargetMouseOver,

View file

@ -30,7 +30,7 @@ interface IState {
}
export default class InviteReason extends React.PureComponent<IProps, IState> {
constructor(props) {
public constructor(props) {
super(props);
this.state = {
// We hide the reason for invitation by default, since it can be a
@ -39,13 +39,13 @@ export default class InviteReason extends React.PureComponent<IProps, IState> {
};
}
onViewClick = () => {
public onViewClick = () => {
this.setState({
hidden: false,
});
};
render() {
public render() {
const classes = classNames({
mx_InviteReason: true,
mx_InviteReason_hidden: this.state.hidden,

View file

@ -42,7 +42,7 @@ interface IState {
}
export default class LanguageDropdown extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -17,7 +17,7 @@ limitations under the License.
import React from "react";
class ItemRange {
constructor(public topCount: number, public renderCount: number, public bottomCount: number) {}
public constructor(public topCount: number, public renderCount: number, public bottomCount: number) {}
public contains(range: ItemRange): boolean {
// don't contain empty ranges
@ -85,7 +85,7 @@ export default class LazyRenderList<T = any> extends React.Component<IProps<T>,
overflowMargin: 5,
};
constructor(props: IProps<T>) {
public constructor(props: IProps<T>) {
super(props);
this.state = {

View file

@ -21,7 +21,7 @@ import TextWithTooltip from "./TextWithTooltip";
interface IProps extends Omit<React.ComponentProps<typeof TextWithTooltip>, "tabIndex" | "onClick"> {}
export default class LinkWithTooltip extends React.Component<IProps> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
}

View file

@ -28,21 +28,21 @@ export default class Measured extends React.PureComponent<IProps> {
private static instanceCount = 0;
private readonly instanceId: number;
static defaultProps = {
public static defaultProps = {
breakpoint: 500,
};
constructor(props) {
public constructor(props) {
super(props);
this.instanceId = Measured.instanceCount++;
}
componentDidMount() {
public componentDidMount() {
UIStore.instance.on(`Measured${this.instanceId}`, this.onResize);
}
componentDidUpdate(prevProps: Readonly<IProps>) {
public componentDidUpdate(prevProps: Readonly<IProps>) {
const previous = prevProps.sensor;
const current = this.props.sensor;
if (previous === current) return;
@ -54,7 +54,7 @@ export default class Measured extends React.PureComponent<IProps> {
}
}
componentWillUnmount() {
public componentWillUnmount() {
UIStore.instance.off(`Measured${this.instanceId}`, this.onResize);
UIStore.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`);
}
@ -64,7 +64,7 @@ export default class Measured extends React.PureComponent<IProps> {
this.props.onMeasurement(entry.contentRect.width <= this.props.breakpoint);
};
render() {
public render() {
return null;
}
}

View file

@ -78,7 +78,7 @@ export default class PersistedElement extends React.Component<IProps> {
private childContainer: HTMLDivElement;
private child: HTMLDivElement;
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.resizeObserver = new ResizeObserver(this.repositionChild);
@ -107,7 +107,7 @@ export default class PersistedElement extends React.Component<IProps> {
}
}
static isMounted(persistKey) {
public static isMounted(persistKey) {
return Boolean(getContainer("mx_persistedElement_" + persistKey));
}

View file

@ -32,10 +32,10 @@ interface IProps {
export default class PersistentApp extends React.Component<IProps> {
public static contextType = MatrixClientContext;
context: ContextType<typeof MatrixClientContext>;
public context: ContextType<typeof MatrixClientContext>;
private room: Room;
constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
super(props, context);
this.room = context.getRoom(this.props.persistentRoomId)!;
}

View file

@ -75,7 +75,7 @@ export default class Pill extends React.Component<IProps, IState> {
return "@room".length;
}
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -256,7 +256,7 @@ export default class PollCreateDialog extends ScrollableBaseModal<IProps, IState
);
}
onPollTypeChange = (e: ChangeEvent<HTMLSelectElement>) => {
public onPollTypeChange = (e: ChangeEvent<HTMLSelectElement>) => {
this.setState({
kind: M_POLL_KIND_DISCLOSED.matches(e.target.value) ? M_POLL_KIND_DISCLOSED : M_POLL_KIND_UNDISCLOSED,
});

View file

@ -60,7 +60,7 @@ export default class PowerSelector extends React.Component<IProps, IState> {
usersDefault: 0,
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -74,14 +74,14 @@ interface IState {
// craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would
// be low as each event being loaded (after the first) is triggered by an explicit user action.
export default class ReplyChain extends React.Component<IProps, IState> {
static contextType = RoomContext;
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
private unmounted = false;
private room: Room;
private blockquoteRef = React.createRef<HTMLQuoteElement>();
constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
super(props, context);
this.state = {
@ -98,17 +98,17 @@ export default class ReplyChain extends React.Component<IProps, IState> {
return MatrixClientPeg.get();
}
componentDidMount() {
public componentDidMount() {
this.initialize();
this.trySetExpandableQuotes();
}
componentDidUpdate() {
public componentDidUpdate() {
this.props.onHeightChanged();
this.trySetExpandableQuotes();
}
componentWillUnmount() {
public componentWillUnmount() {
this.unmounted = true;
}
@ -199,7 +199,7 @@ export default class ReplyChain extends React.Component<IProps, IState> {
return getUserNameColorClass(ev.getSender()).replace("Username", "ReplyChain");
}
render() {
public render() {
let header = null;
if (this.state.err) {
header = (

View file

@ -39,12 +39,12 @@ interface IState {
// Controlled form component wrapping Field for inputting a room alias scoped to a given domain
export default class RoomAliasField extends React.PureComponent<IProps, IState> {
static contextType = MatrixClientContext;
public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>;
private fieldRef = createRef<Field>();
constructor(props, context) {
public constructor(props, context) {
super(props, context);
this.state = {
@ -72,7 +72,7 @@ export default class RoomAliasField extends React.PureComponent<IProps, IState>
return { prefix, postfix, value, maxlength };
}
render() {
public render() {
const { prefix, postfix, value, maxlength } = this.domainProps;
return (
<Field

View file

@ -43,7 +43,7 @@ interface IState {
}
export default class SettingsFlag extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -70,7 +70,7 @@ export default class Slider extends React.Component<IProps> {
return 100 * (closest - 1 + linearInterpolation) * intervalWidth;
}
render(): React.ReactNode {
public render(): React.ReactNode {
const dots = this.props.values.map((v) => (
<Dot
active={v <= this.props.value}
@ -108,7 +108,7 @@ export default class Slider extends React.Component<IProps> {
);
}
onClick(event: React.MouseEvent) {
public onClick(event: React.MouseEvent) {
const width = (event.target as HTMLElement).clientWidth;
// nativeEvent is safe to use because https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX
// is supported by all modern browsers
@ -133,7 +133,7 @@ interface IDotProps {
}
class Dot extends React.PureComponent<IDotProps> {
render(): React.ReactNode {
public render(): React.ReactNode {
let className = "mx_Slider_dot";
if (!this.props.disabled && this.props.active) {
className += " mx_Slider_dotActive";

View file

@ -43,7 +43,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component<
SpellCheckLanguagesDropdownIProps,
SpellCheckLanguagesDropdownIState
> {
constructor(props) {
public constructor(props) {
super(props);
this.onSearchChange = this.onSearchChange.bind(this);
@ -53,7 +53,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component<
};
}
componentDidMount() {
public componentDidMount() {
const plaf = PlatformPeg.get();
if (plaf) {
plaf.getAvailableSpellCheckLanguages()
@ -82,7 +82,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component<
this.setState({ searchQuery });
}
render() {
public render() {
if (this.state.languages === null) {
return <Spinner />;
}

View file

@ -26,7 +26,7 @@ interface IState {
}
export default class Spoiler extends React.Component<IProps, IState> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
visible: false,

View file

@ -38,7 +38,7 @@ export default class StyledCheckbox extends React.PureComponent<IProps, IState>
className: "",
};
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
// 56^10 so unlikely chance of collision.
this.id = this.props.id || "checkbox_" + randomString(10);

View file

@ -28,7 +28,7 @@ interface IProps extends HTMLAttributes<HTMLSpanElement> {
}
export default class TextWithTooltip extends React.Component<IProps> {
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
}

View file

@ -68,7 +68,7 @@ export default class Tooltip extends React.PureComponent<ITooltipProps, State> {
alignment: Alignment.Natural,
};
constructor(props) {
public constructor(props) {
super(props);
this.state = {};

View file

@ -24,11 +24,11 @@ interface IProps {
}
export default class TooltipButton extends React.Component<IProps> {
constructor(props) {
public constructor(props) {
super(props);
}
render() {
public render() {
return (
<TooltipTarget
className="mx_TooltipButton_container"

View file

@ -38,7 +38,7 @@ interface IProps {
}
export default class TruncatedList extends React.Component<IProps> {
static defaultProps = {
public static defaultProps = {
truncateAt: 2,
createOverflowElement(overflowCount, totalCount) {
return <div>{_t("And %(count)s more...", { count: overflowCount })}</div>;

View file

@ -69,7 +69,7 @@ class Category extends React.PureComponent<IProps> {
);
};
render() {
public render() {
const { emojis, name, heightBefore, viewportHeight, scrollTop } = this.props;
if (!emojis || emojis.length === 0) {
return null;

View file

@ -30,7 +30,7 @@ interface IProps {
}
class Emoji extends React.PureComponent<IProps> {
render() {
public render() {
const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props;
const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode);
return (

View file

@ -57,7 +57,7 @@ class EmojiPicker extends React.Component<IProps, IState> {
private scrollRef = React.createRef<AutoHideScrollbar<"div">>();
constructor(props: IProps) {
public constructor(props: IProps) {
super(props);
this.state = {
@ -249,7 +249,7 @@ class EmojiPicker extends React.Component<IProps, IState> {
return CATEGORY_HEADER_HEIGHT + Math.ceil(count / EMOJIS_PER_ROW) * EMOJI_HEIGHT;
}
render() {
public render() {
let heightBefore = 0;
return (
<div className="mx_EmojiPicker" data-testid="mx_EmojiPicker">

View file

@ -82,7 +82,7 @@ class Header extends React.PureComponent<IProps> {
}
};
render() {
public render() {
return (
<nav
className="mx_EmojiPicker_header"

Some files were not shown because too many files have changed in this diff Show more