mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-02 12:07:34 +00:00
4b4289e211
* Convert welcome.html to React component In advance of changes to use Compound * Fix types * Fix tests * Update styling to match Figma * Fix random capitalisation * Tweak styling * Regenerate i18n * Update tests * Make linter happy * Iterate
58 lines
2.0 KiB
TypeScript
58 lines
2.0 KiB
TypeScript
/*
|
|
Copyright 2019-2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import React, { type ReactNode } from "react";
|
|
import classNames from "classnames";
|
|
import { type EmptyObject } from "matrix-js-sdk/src/matrix";
|
|
import { Glass } from "@vector-im/compound-web";
|
|
|
|
import SdkConfig from "../../../SdkConfig";
|
|
import AuthPage from "./AuthPage";
|
|
import SettingsStore from "../../../settings/SettingsStore";
|
|
import { UIFeature } from "../../../settings/UIFeature";
|
|
import LanguageSelector from "./LanguageSelector";
|
|
import EmbeddedPage from "../../structures/EmbeddedPage";
|
|
import { MATRIX_LOGO_HTML } from "../../structures/static-page-vars";
|
|
import DefaultWelcome from "./DefaultWelcome.tsx";
|
|
|
|
export default class Welcome extends React.PureComponent<EmptyObject> {
|
|
public render(): React.ReactNode {
|
|
const pagesConfig = SdkConfig.getObject("embedded_pages");
|
|
const pageUrl = pagesConfig?.get("welcome_url");
|
|
|
|
const replaceMap: Record<string, string> = {
|
|
"$brand": SdkConfig.get("brand"),
|
|
"$riot:ssoUrl": "#/start_sso",
|
|
"$riot:casUrl": "#/start_cas",
|
|
"$matrixLogo": MATRIX_LOGO_HTML,
|
|
"[matrix]": MATRIX_LOGO_HTML,
|
|
};
|
|
|
|
let body: ReactNode;
|
|
if (pageUrl) {
|
|
body = <EmbeddedPage className="mx_WelcomePage" url={pageUrl} replaceMap={replaceMap} />;
|
|
} else {
|
|
body = <DefaultWelcome />;
|
|
}
|
|
|
|
return (
|
|
<AuthPage addBlur={false}>
|
|
<Glass>
|
|
<div
|
|
className={classNames("mx_Welcome", {
|
|
mx_WelcomePage_registrationDisabled: !SettingsStore.getValue(UIFeature.Registration),
|
|
})}
|
|
>
|
|
{body}
|
|
<LanguageSelector />
|
|
</div>
|
|
</Glass>
|
|
</AuthPage>
|
|
);
|
|
}
|
|
}
|