Conform more code to strictNullChecks (#10368

* Conform more code to `strictNullChecks`

* Iterate
This commit is contained in:
Michael Telatynski 2023-03-14 11:09:35 +00:00 committed by GitHub
parent 05e3fb09d6
commit 8cb8cd4eb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 176 additions and 157 deletions

View file

@ -42,16 +42,20 @@ interface IProps {
onFinished(opts?: IFinishedOpts): void;
}
interface Progress {
text: string;
progress: number;
total: number;
}
interface IState {
inviteUsersToNewRoom: boolean;
progressText?: string;
progress?: number;
total?: number;
progress?: Progress;
}
export default class RoomUpgradeWarningDialog extends React.Component<IProps, IState> {
private readonly isPrivate: boolean;
private readonly currentVersion: string;
private readonly currentVersion?: string;
public constructor(props: IProps) {
super(props);
@ -66,8 +70,14 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
};
}
private onProgressCallback = (progressText: string, progress: number, total: number): void => {
this.setState({ progressText, progress, total });
private onProgressCallback = (text: string, progress: number, total: number): void => {
this.setState({
progress: {
text,
progress,
total,
},
});
};
private onContinue = async (): Promise<void> => {
@ -98,7 +108,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
public render(): React.ReactNode {
const brand = SdkConfig.get().brand;
let inviteToggle = null;
let inviteToggle: JSX.Element | undefined;
if (this.isPrivate) {
inviteToggle = (
<LabelledToggleSwitch
@ -144,11 +154,11 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
}
let footer: JSX.Element;
if (this.state.progressText) {
if (this.state.progress) {
footer = (
<span className="mx_RoomUpgradeWarningDialog_progress">
<ProgressBar value={this.state.progress} max={this.state.total} />
<div className="mx_RoomUpgradeWarningDialog_progressText">{this.state.progressText}</div>
<ProgressBar value={this.state.progress.progress} max={this.state.progress.total} />
<div className="mx_RoomUpgradeWarningDialog_progressText">{this.state.progress.text}</div>
</span>
);
} else {