Conform more code to strictNullChecks
(#10368
* Conform more code to `strictNullChecks` * Iterate
This commit is contained in:
parent
05e3fb09d6
commit
8cb8cd4eb1
24 changed files with 176 additions and 157 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue