mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 09:46:09 +03:00
WIP minimize
This commit is contained in:
parent
e8c716f33e
commit
e6605441aa
3 changed files with 79 additions and 39 deletions
|
@ -38,3 +38,7 @@ limitations under the License.
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mx_HostSignupBaseDialog_minimized {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,11 @@ limitations under the License.
|
|||
|
||||
import * as React from "react";
|
||||
import BaseDialog from '../../views/dialogs/BaseDialog';
|
||||
import GenericToast from "../toasts/GenericToast";
|
||||
import Modal from "../../../Modal";
|
||||
import QuestionDialog from './QuestionDialog';
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import ToastStore from "../../../stores/ToastStore";
|
||||
import {_t} from "../../../languageHandler";
|
||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||
|
@ -32,6 +34,7 @@ interface IState {
|
|||
completed: boolean;
|
||||
error: string;
|
||||
loadIframe: boolean;
|
||||
minimized: boolean;
|
||||
}
|
||||
|
||||
export default class HostSignupDialog extends React.PureComponent<IProps, IState> {
|
||||
|
@ -45,6 +48,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
completed: false,
|
||||
error: null,
|
||||
loadIframe: false,
|
||||
minimized: false,
|
||||
};
|
||||
|
||||
this.hostSignupSetupUrl = SdkConfig.get().host_signup.url;
|
||||
|
@ -58,6 +62,9 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
case PostmessageAction.HostSignupAccountDetailsRequest:
|
||||
await this.sendAccountDetails();
|
||||
break;
|
||||
case PostmessageAction.Minimize:
|
||||
this.minimizeDialog();
|
||||
break;
|
||||
case PostmessageAction.SetupComplete:
|
||||
// Set as completed but let the user close the modal themselves
|
||||
// so they have time to finish reading any information
|
||||
|
@ -71,6 +78,30 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
}
|
||||
}
|
||||
|
||||
private maximizeDialog = () => {
|
||||
this.setState({
|
||||
minimized: false,
|
||||
});
|
||||
}
|
||||
|
||||
private minimizeDialog = () => {
|
||||
ToastStore.sharedInstance().addOrReplaceToast({
|
||||
priority: 0,
|
||||
key: 'host_signup_dialog',
|
||||
title: "Building your home",
|
||||
icon: "verification",
|
||||
props: {
|
||||
description: "",
|
||||
onAccept: this.maximizeDialog,
|
||||
acceptLabel: "Return",
|
||||
},
|
||||
component: GenericToast,
|
||||
});
|
||||
this.setState({
|
||||
minimized: true,
|
||||
});
|
||||
}
|
||||
|
||||
private onFinished = (result: boolean) => {
|
||||
if (result || this.state.completed) {
|
||||
// We're done, close
|
||||
|
@ -132,6 +163,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
|
||||
public render(): React.ReactNode {
|
||||
return (
|
||||
<div className={this.state.minimized ? "mx_HostSignupBaseDialog_minimized" : ""}>
|
||||
<BaseDialog
|
||||
className="mx_HostSignupBaseDialog"
|
||||
onFinished={this.onFinished}
|
||||
|
@ -165,6 +197,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
<button onClick={this.loadIframe} className="mx_Dialog_primary">
|
||||
Lets get started
|
||||
</button>
|
||||
<button onClick={this.minimizeDialog}>Minimize</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -175,6 +208,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||
}
|
||||
</div>
|
||||
</BaseDialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ export enum PostmessageAction {
|
|||
CloseDialog = "close_dialog",
|
||||
HostSignupAccountDetails = "host_signup_account_details",
|
||||
HostSignupAccountDetailsRequest = "host_signup_account_details_request",
|
||||
Minimize = "host_signup_minimize",
|
||||
Maximize = "host_signup_maximize",
|
||||
SetupComplete = "setup_complete",
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue