Fix ProfileSettings types

This commit is contained in:
Germain Souquet 2021-08-25 09:05:07 +01:00
parent d205585385
commit 6945e3f103
2 changed files with 5 additions and 9 deletions

View file

@ -19,7 +19,7 @@ import React, { ReactHTML } from 'react';
import { Key } from '../../../Keyboard'; import { Key } from '../../../Keyboard';
import classnames from 'classnames'; import classnames from 'classnames';
export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element>; export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element> | React.FormEvent<Element>;
/** /**
* children: React's magic prop. Represents all children given to the element. * children: React's magic prop. Represents all children given to the element.
@ -39,7 +39,7 @@ interface IProps extends React.InputHTMLAttributes<Element> {
tabIndex?: number; tabIndex?: number;
disabled?: boolean; disabled?: boolean;
className?: string; className?: string;
onClick(e?: ButtonEvent): void; onClick(e?: ButtonEvent): void | Promise<void>;
} }
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> { interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {

View file

@ -27,10 +27,6 @@ import { mediaFromMxc } from "../../../customisations/Media";
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import AvatarSetting from './AvatarSetting'; import AvatarSetting from './AvatarSetting';
interface IProps {
}
interface IState { interface IState {
userId?: string; userId?: string;
originalDisplayName?: string; originalDisplayName?: string;
@ -42,9 +38,9 @@ interface IState {
} }
@replaceableComponent("views.settings.ProfileSettings") @replaceableComponent("views.settings.ProfileSettings")
export default class ProfileSettings extends React.Component<IProps, IState> { export default class ProfileSettings extends React.Component<{}, IState> {
private avatarUpload: React.RefObject<HTMLInputElement> = createRef(); private avatarUpload: React.RefObject<HTMLInputElement> = createRef();
constructor(props: IProps) { constructor(props: {}) {
super(props); super(props);
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
@ -205,7 +201,7 @@ export default class ProfileSettings extends React.Component<IProps, IState> {
</p> </p>
</div> </div>
<AvatarSetting <AvatarSetting
avatarUrl={this.state.avatarUrl} avatarUrl={this.state.avatarUrl.toString()}
avatarName={this.state.displayName || this.state.userId} avatarName={this.state.displayName || this.state.userId}
avatarAltText={_t("Profile picture")} avatarAltText={_t("Profile picture")}
uploadAvatar={this.uploadAvatar} uploadAvatar={this.uploadAvatar}