Rename a few things, make hosting signup config an object
This commit is contained in:
parent
54b22290e7
commit
a1d750a4aa
3 changed files with 15 additions and 15 deletions
|
@ -16,22 +16,22 @@ limitations under the License.
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import Modal from "../../Modal";
|
import Modal from "../../Modal";
|
||||||
import HostingProviderDialog from "./HostingProviderDialog";
|
import HostingSignupDialog from "./HostingSignupDialog";
|
||||||
|
|
||||||
interface IProps {}
|
interface IProps {}
|
||||||
|
|
||||||
interface IState {}
|
interface IState {}
|
||||||
|
|
||||||
export default class HostingProviderTrigger extends React.PureComponent<IProps, IState> {
|
export default class HostingSignupAction extends React.PureComponent<IProps, IState> {
|
||||||
private static openDialog() {
|
private static openDialog() {
|
||||||
Modal.createDialog(
|
Modal.createDialog(
|
||||||
HostingProviderDialog, {}, "mx_HostingProviderDialog",
|
HostingSignupDialog, {}, "mx_HostingSignupDialog",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<div onClick={HostingProviderTrigger.openDialog} className="mx_HostingProviderTrigger">
|
<div onClick={HostingSignupAction.openDialog} className="mx_HostingSignupAction">
|
||||||
Get your own personal Element!
|
Get your own personal Element!
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
|
@ -24,7 +24,7 @@ interface IState {
|
||||||
error: string,
|
error: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class HostingProviderDialog extends React.PureComponent<IProps, IState> {
|
export default class HostingSignupDialog extends React.PureComponent<IProps, IState> {
|
||||||
iframeRef;
|
iframeRef;
|
||||||
hostingSignupUrl: string;
|
hostingSignupUrl: string;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ export default class HostingProviderDialog extends React.PureComponent<IProps, I
|
||||||
};
|
};
|
||||||
|
|
||||||
this.iframeRef = React.createRef();
|
this.iframeRef = React.createRef();
|
||||||
this.hostingSignupUrl = SdkConfig.get().hosting_signup_iframe;
|
this.hostingSignupUrl = SdkConfig.get().hosting_signup.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private messageHandler = (message) => {
|
private messageHandler = (message) => {
|
||||||
|
@ -83,7 +83,7 @@ export default class HostingProviderDialog extends React.PureComponent<IProps, I
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
return (
|
return (
|
||||||
<div className="mx_HostingProviderDialog_container">
|
<div className="mx_HostingSignupDialog_container">
|
||||||
<iframe
|
<iframe
|
||||||
src={this.hostingSignupUrl}
|
src={this.hostingSignupUrl}
|
||||||
ref={ref => this.iframeRef = ref}
|
ref={ref => this.iframeRef = ref}
|
|
@ -51,7 +51,7 @@ import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
|
||||||
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
import ErrorDialog from "../views/dialogs/ErrorDialog";
|
||||||
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
import EditCommunityPrototypeDialog from "../views/dialogs/EditCommunityPrototypeDialog";
|
||||||
import {UIFeature} from "../../settings/UIFeature";
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
import HostingProviderTrigger from "./HostingProviderTrigger";
|
import HostingSignupAction from "./HostingSignupAction";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isMinimized: boolean;
|
isMinimized: boolean;
|
||||||
|
@ -312,20 +312,20 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const hostingSignupIFrame = SdkConfig.get().hosting_signup_iframe;
|
const hostingSignupOptions = SdkConfig.get().hosting_signup;
|
||||||
let hostingIFrame;
|
let hostingSignupIFrame;
|
||||||
if (hostingSignupIFrame) {
|
if (hostingSignupOptions && hostingSignupOptions.url) {
|
||||||
// If hosting_signup_domains is set to a non-empty array, only show
|
// If hosting_signup_domains is set to a non-empty array, only show
|
||||||
// dialog if the user is on the domain or a subdomain.
|
// dialog if the user is on the domain or a subdomain.
|
||||||
const hostingSignupDomains = SdkConfig.get().hosting_signup_domains || [];
|
const hostingSignupDomains = hostingSignupOptions.domains || [];
|
||||||
const mxDomain = MatrixClientPeg.get().getDomain();
|
const mxDomain = MatrixClientPeg.get().getDomain();
|
||||||
const validDomains = hostingSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
|
const validDomains = hostingSignupDomains.filter(d => (d === mxDomain || mxDomain.endsWith(`.${d}`)));
|
||||||
if (!hostingSignupDomains || validDomains.length > 0) {
|
if (!hostingSignupDomains || validDomains.length > 0) {
|
||||||
hostingIFrame = <div
|
hostingSignupIFrame = <div
|
||||||
className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_hostingLink"
|
className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_hostingLink"
|
||||||
onClick={this.onCloseMenu}
|
onClick={this.onCloseMenu}
|
||||||
>
|
>
|
||||||
<HostingProviderTrigger />
|
<HostingSignupAction />
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +513,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
</AccessibleTooltipButton>
|
</AccessibleTooltipButton>
|
||||||
</div>
|
</div>
|
||||||
{topSection}
|
{topSection}
|
||||||
{hostingIFrame}
|
{hostingSignupIFrame}
|
||||||
{primaryOptionList}
|
{primaryOptionList}
|
||||||
{secondarySection}
|
{secondarySection}
|
||||||
</IconizedContextMenu>;
|
</IconizedContextMenu>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue