WIP minimize
This commit is contained in:
parent
d4a58bdb2a
commit
d6af5b3bbd
5 changed files with 60 additions and 22 deletions
|
@ -20,7 +20,7 @@ import {
|
|||
IconizedContextMenuOptionList,
|
||||
} from "../views/context_menus/IconizedContextMenu";
|
||||
import { _t } from "../../languageHandler";
|
||||
import { OwnProfileStore } from "../../stores/OwnProfileStore";
|
||||
import { HostSignupStore } from "../../stores/HostSignupStore";
|
||||
|
||||
interface IProps {}
|
||||
|
||||
|
@ -28,7 +28,7 @@ interface IState {}
|
|||
|
||||
export default class HostSignupAction extends React.PureComponent<IProps, IState> {
|
||||
private openDialog = async () => {
|
||||
await OwnProfileStore.instance.setHostSignupActive(true);
|
||||
await HostSignupStore.instance.setHostSignupActive(true);
|
||||
}
|
||||
|
||||
public render(): React.ReactNode {
|
||||
|
|
|
@ -21,6 +21,7 @@ import QuestionDialog from './QuestionDialog';
|
|||
import SdkConfig from "../../../SdkConfig";
|
||||
import {_t} from "../../../languageHandler";
|
||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||
import {HostSignupStore} from "../../../stores/HostSignupStore";
|
||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||
import {IPostmessage, IPostmessageResponseData, PostmessageAction} from "./HostSignupDialogTypes";
|
||||
|
||||
|
@ -72,8 +73,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
});
|
||||
break;
|
||||
case PostmessageAction.CloseDialog:
|
||||
this.onFinished(true);
|
||||
break;
|
||||
return this.onFinished(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,10 +94,10 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
// Ensure we destroy the host signup persisted element
|
||||
PersistedElement.destroyElement("host_signup");
|
||||
// Finally clear the flag in
|
||||
return OwnProfileStore.instance.setHostSignupActive(false);
|
||||
return HostSignupStore.instance.setHostSignupActive(false);
|
||||
}
|
||||
|
||||
private onFinished = (result: boolean) => {
|
||||
private onFinished = async (result: boolean) => {
|
||||
if (result || this.state.completed) {
|
||||
// We're done, close
|
||||
return this.closeDialog();
|
||||
|
@ -153,7 +153,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
if (OwnProfileStore.instance.isHostSignupActive) {
|
||||
if (HostSignupStore.instance.isHostSignupActive) {
|
||||
// Run the close dialog actions if we're still active, otherwise good to go
|
||||
return this.closeDialog();
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@ limitations under the License.
|
|||
|
||||
import React, {useState} from 'react';
|
||||
import HostSignupDialog from "../dialogs/HostSignupDialog";
|
||||
import { OwnProfileStore } from "../../../stores/OwnProfileStore";
|
||||
import {HostSignupStore} from "../../../stores/HostSignupStore";
|
||||
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
||||
import {UPDATE_EVENT} from "../../../stores/AsyncStore";
|
||||
|
||||
const HostSignupContainer = () => {
|
||||
const [isActive, setIsActive] = useState(OwnProfileStore.instance.isHostSignupActive);
|
||||
useEventEmitter(OwnProfileStore.instance, UPDATE_EVENT, () => {
|
||||
setIsActive(OwnProfileStore.instance.isHostSignupActive);
|
||||
const [isActive, setIsActive] = useState(HostSignupStore.instance.isHostSignupActive);
|
||||
useEventEmitter(HostSignupStore.instance, UPDATE_EVENT, () => {
|
||||
setIsActive(HostSignupStore.instance.isHostSignupActive);
|
||||
});
|
||||
|
||||
return <div className="mx_HostSignupContainer">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue