/* Copyright 2022-2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ import { type FC, useCallback, useState } from "react"; import { useLocation } from "react-router-dom"; import { Trans, useTranslation } from "react-i18next"; import { logger } from "matrix-js-sdk/lib/logger"; import { Button, Heading, Text } from "@vector-im/compound-web"; import styles from "./RoomAuthView.module.css"; import { Header, HeaderLogo, LeftNav, RightNav } from "../Header"; import { FieldRow, InputField, ErrorMessage } from "../input/Input"; import { Form } from "../form/Form"; import { UserMenuContainer } from "../UserMenuContainer"; import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser"; import { Config } from "../config/Config"; import { ExternalLink, Link } from "../button/Link"; import { useUrlParams } from "../UrlParams"; export const RoomAuthView: FC = () => { const { header } = useUrlParams(); const [loading, setLoading] = useState(false); const [error, setError] = useState(); const { registerPasswordlessUser, recaptchaId } = useRegisterPasswordlessUser(); const onSubmit = useCallback( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore (e) => { e.preventDefault(); setLoading(true); const data = new FormData(e.target); const dataForDisplayName = data.get("displayName"); const displayName = typeof dataForDisplayName === "string" ? dataForDisplayName : ""; registerPasswordlessUser(displayName).catch((error) => { logger.error("Failed to register passwordless user", e); setLoading(false); setError(error); }); }, [registerPasswordlessUser], ); const { t } = useTranslation(); const location = useLocation(); return ( <> {header === "standard" && (
)}
{t("lobby.join_as_guest")}
By clicking "Join call now", you agree to our{" "} Software and Services License Agreement (SSLA) {error && ( )}
Not registered yet?{" "} Create an account
); };