Address some more pr feedback

pull/21833/head
Jason Robinson 2021-02-09 22:41:40 +02:00
parent 2197c1e519
commit dc549a9e4b
1 changed files with 18 additions and 9 deletions

View File

@ -20,10 +20,11 @@ import Modal from "../../../Modal";
import PersistedElement from "../elements/PersistedElement"; import PersistedElement from "../elements/PersistedElement";
import QuestionDialog from './QuestionDialog'; import QuestionDialog from './QuestionDialog';
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import {_t} from "../../../languageHandler"; import classNames from "classnames";
import {MatrixClientPeg} from "../../../MatrixClientPeg"; import { _t } from "../../../languageHandler";
import {HostSignupStore} from "../../../stores/HostSignupStore"; import { MatrixClientPeg } from "../../../MatrixClientPeg";
import {OwnProfileStore} from "../../../stores/OwnProfileStore"; import { HostSignupStore } from "../../../stores/HostSignupStore";
import { OwnProfileStore } from "../../../stores/OwnProfileStore";
import { import {
IHostSignupConfig, IHostSignupConfig,
IPostmessage, IPostmessage,
@ -31,6 +32,8 @@ import {
PostmessageAction, PostmessageAction,
} from "./HostSignupDialogTypes"; } from "./HostSignupDialogTypes";
const HOST_SIGNUP_KEY = "host_signup";
interface IProps {} interface IProps {}
interface IState { interface IState {
@ -141,6 +144,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
private async sendAccountDetails() { private async sendAccountDetails() {
const openIdToken = await MatrixClientPeg.get().getOpenIdToken(); const openIdToken = await MatrixClientPeg.get().getOpenIdToken();
if (!openIdToken || !openIdToken.access_token) { if (!openIdToken || !openIdToken.access_token) {
console.warn("Failed to connect to homeserver for OpenID token.")
this.setState({ this.setState({
completed: true, completed: true,
error: _t("Failed to connect to your homeserver. Please close this dialog and try again."), error: _t("Failed to connect to your homeserver. Please close this dialog and try again."),
@ -213,11 +217,16 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
public render(): React.ReactNode { public render(): React.ReactNode {
return ( return (
<div className="mx_HostSignup_persisted"> <div className="mx_HostSignup_persisted">
<PersistedElement key="host_signup" persistKey="host_signup"> <PersistedElement key={HOST_SIGNUP_KEY} persistKey={HOST_SIGNUP_KEY}>
<div className={this.state.minimized ? "" : "mx_Dialog_wrapper"}> <div className={classNames({ "mx_Dialog_wrapper": !this.state.minimized })}>
<div className={["mx_Dialog", <div
this.state.minimized ? "mx_HostSignupDialog_minimized" : "mx_HostSignupDialog"].join(" ") className={classNames("mx_Dialog",
}> {
"mx_HostSignupDialog_minimized": this.state.minimized,
"mx_HostSignupDialog": !this.state.minimized,
},
)}
>
{this.state.minimized && {this.state.minimized &&
<div className="mx_Dialog_header mx_Dialog_headerWithButton"> <div className="mx_Dialog_header mx_Dialog_headerWithButton">
<div className="mx_Dialog_title"> <div className="mx_Dialog_title">