You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
WIP minimize
This commit is contained in:
@@ -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 * as React from "react";
|
||||||
import BaseDialog from '../../views/dialogs/BaseDialog';
|
import BaseDialog from '../../views/dialogs/BaseDialog';
|
||||||
|
import GenericToast from "../toasts/GenericToast";
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import QuestionDialog from './QuestionDialog';
|
import QuestionDialog from './QuestionDialog';
|
||||||
import SdkConfig from "../../../SdkConfig";
|
import SdkConfig from "../../../SdkConfig";
|
||||||
|
import ToastStore from "../../../stores/ToastStore";
|
||||||
import {_t} from "../../../languageHandler";
|
import {_t} from "../../../languageHandler";
|
||||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||||
@@ -32,6 +34,7 @@ interface IState {
|
|||||||
completed: boolean;
|
completed: boolean;
|
||||||
error: string;
|
error: string;
|
||||||
loadIframe: boolean;
|
loadIframe: boolean;
|
||||||
|
minimized: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class HostSignupDialog extends React.PureComponent<IProps, IState> {
|
export default class HostSignupDialog extends React.PureComponent<IProps, IState> {
|
||||||
@@ -45,6 +48,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||||||
completed: false,
|
completed: false,
|
||||||
error: null,
|
error: null,
|
||||||
loadIframe: false,
|
loadIframe: false,
|
||||||
|
minimized: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hostSignupSetupUrl = SdkConfig.get().host_signup.url;
|
this.hostSignupSetupUrl = SdkConfig.get().host_signup.url;
|
||||||
@@ -58,6 +62,9 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||||||
case PostmessageAction.HostSignupAccountDetailsRequest:
|
case PostmessageAction.HostSignupAccountDetailsRequest:
|
||||||
await this.sendAccountDetails();
|
await this.sendAccountDetails();
|
||||||
break;
|
break;
|
||||||
|
case PostmessageAction.Minimize:
|
||||||
|
this.minimizeDialog();
|
||||||
|
break;
|
||||||
case PostmessageAction.SetupComplete:
|
case PostmessageAction.SetupComplete:
|
||||||
// Set as completed but let the user close the modal themselves
|
// Set as completed but let the user close the modal themselves
|
||||||
// so they have time to finish reading any information
|
// 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) => {
|
private onFinished = (result: boolean) => {
|
||||||
if (result || this.state.completed) {
|
if (result || this.state.completed) {
|
||||||
// We're done, close
|
// We're done, close
|
||||||
@@ -132,6 +163,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
|
<div className={this.state.minimized ? "mx_HostSignupBaseDialog_minimized" : ""}>
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
className="mx_HostSignupBaseDialog"
|
className="mx_HostSignupBaseDialog"
|
||||||
onFinished={this.onFinished}
|
onFinished={this.onFinished}
|
||||||
@@ -165,6 +197,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||||||
<button onClick={this.loadIframe} className="mx_Dialog_primary">
|
<button onClick={this.loadIframe} className="mx_Dialog_primary">
|
||||||
Lets get started
|
Lets get started
|
||||||
</button>
|
</button>
|
||||||
|
<button onClick={this.minimizeDialog}>Minimize</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -175,6 +208,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export enum PostmessageAction {
|
|||||||
CloseDialog = "close_dialog",
|
CloseDialog = "close_dialog",
|
||||||
HostSignupAccountDetails = "host_signup_account_details",
|
HostSignupAccountDetails = "host_signup_account_details",
|
||||||
HostSignupAccountDetailsRequest = "host_signup_account_details_request",
|
HostSignupAccountDetailsRequest = "host_signup_account_details_request",
|
||||||
|
Minimize = "host_signup_minimize",
|
||||||
|
Maximize = "host_signup_maximize",
|
||||||
SetupComplete = "setup_complete",
|
SetupComplete = "setup_complete",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user