Rename Element Pro -> Host Signup

This commit is contained in:
Jason Robinson 2021-01-04 16:05:49 +02:00
parent 6286c23aa5
commit bb53ae8038
6 changed files with 33 additions and 33 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import * as React from "react";
import ElementProDialog from "../views/dialogs/ElementProDialog";
import HostSignupDialog from "../views/dialogs/HostSignupDialog";
import Modal, {IHandle} from "../../Modal";
import {
IconizedContextMenuOption,
@ -27,15 +27,15 @@ interface IProps {}
interface IState {}
export default class ElementProAction extends React.PureComponent<IProps, IState> {
export default class HostSignupAction extends React.PureComponent<IProps, IState> {
private closingAllowed = false;
private modalRef: IHandle<void[]>;
private openDialog = () => {
this.modalRef = Modal.createTrackedDialog(
'Element Pro Open', '', ElementProDialog, {
'Host Signup Open', '', HostSignupDialog, {
requestClose: this.requestClose,
}, "mx_ElementProDialog", false, true, {
}, "mx_HostSignupDialog", false, true, {
onBeforeClose: async () => this.closingAllowed,
},
);

View file

@ -51,7 +51,7 @@ import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import ErrorDialog from "../views/dialogs/ErrorDialog";
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
import {UIFeature} from "../../settings/UIFeature";
import ElementProAction from "./ElementProAction";
import HostSignupAction from "./HostSignupAction";
interface IProps {
isMinimized: boolean;
@ -274,7 +274,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
let topSection;
const signupLink = getHostingLink("user-context-menu");
const elementProConfig = SdkConfig.get().element_pro;
const hostSignupConfig = SdkConfig.get().host_signup;
if (MatrixClientPeg.get().isGuest()) {
topSection = (
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
@ -294,20 +294,20 @@ export default class UserMenu extends React.Component<IProps, IState> {
})}
</div>
)
} else if (signupLink || elementProConfig) {
let elementProIFrame;
if (elementProConfig && elementProConfig.url) {
// If element_pro.domains is set to a non-empty array, only show
} else if (signupLink || hostSignupConfig) {
let hostSignupAction;
if (hostSignupConfig && hostSignupConfig.url) {
// If host_signup.domains is set to a non-empty array, only show
// dialog if the user is on the domain or a subdomain.
const elementProDomains = elementProConfig.domains || [];
const hostSignupDomains = hostSignupConfig.domains || [];
const mxDomain = MatrixClientPeg.get().getDomain();
const validDomains = elementProDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
if (!elementProDomains || validDomains.length > 0) {
elementProIFrame = <div
const validDomains = hostSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
if (!hostSignupDomains || validDomains.length > 0) {
hostSignupAction = <div
className=""
onClick={this.onCloseMenu}
>
<ElementProAction />
<HostSignupAction />
</div>;
}
}
@ -327,7 +327,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
)}
</div>
}
{elementProIFrame}
{hostSignupAction}
</>
);
}