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 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.
@ -39,7 +39,7 @@ interface IProps extends React.InputHTMLAttributes<Element> {
tabIndex?: number;
disabled?: boolean;
className?: string;
onClick(e?: ButtonEvent): void;
onClick(e?: ButtonEvent): void | Promise<void>;
}
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {

View file

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