Files
ThreadNet-Web/src/components/views/auth/Welcome.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
2.4 KiB
TypeScript
Raw Normal View History

2019-02-07 16:25:09 +00:00
/*
Copyright 2019 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React from "react";
import classNames from "classnames";
2019-02-07 16:25:09 +00:00
import SdkConfig from "../../../SdkConfig";
import AuthPage from "./AuthPage";
import SettingsStore from "../../../settings/SettingsStore";
2021-06-29 13:11:58 +01:00
import { UIFeature } from "../../../settings/UIFeature";
2021-07-20 12:22:32 +02:00
import LanguageSelector from "./LanguageSelector";
2022-03-02 16:33:40 -07:00
import EmbeddedPage from "../../structures/EmbeddedPage";
import { MATRIX_LOGO_HTML } from "../../structures/static-page-vars";
2020-03-27 14:05:14 +00:00
2021-07-15 15:45:36 +02:00
interface IProps {}
export default class Welcome extends React.PureComponent<IProps> {
public render(): React.ReactNode {
const pagesConfig = SdkConfig.getObject("embedded_pages");
let pageUrl: string | undefined;
2019-02-08 13:53:17 +00:00
if (pagesConfig) {
pageUrl = pagesConfig.get("welcome_url");
2019-02-08 13:53:17 +00:00
}
const replaceMap: Record<string, string> = {
"$riot:ssoUrl": "#/start_sso",
"$riot:casUrl": "#/start_cas",
"$matrixLogo": MATRIX_LOGO_HTML,
"[matrix]": MATRIX_LOGO_HTML,
};
2019-02-08 13:53:17 +00:00
if (!pageUrl) {
// Fall back to default and replace $logoUrl in welcome.html
const brandingConfig = SdkConfig.getObject("branding");
const logoUrl = brandingConfig?.get("auth_header_logo_url") ?? "themes/element/img/logos/element-logo.svg";
replaceMap["$logoUrl"] = logoUrl;
2019-02-08 13:53:17 +00:00
pageUrl = "welcome.html";
}
2019-02-07 17:16:02 +00:00
2019-02-07 16:25:09 +00:00
return (
<AuthPage>
<div
className={classNames("mx_Welcome", {
mx_WelcomePage_registrationDisabled: !SettingsStore.getValue(UIFeature.Registration),
})}
>
<EmbeddedPage className="mx_WelcomePage" url={pageUrl} replaceMap={replaceMap} />
2019-02-08 11:39:30 +00:00
<LanguageSelector />
</div>
2019-02-07 16:25:09 +00:00
</AuthPage>
);
}
}