import { useState, memo } from "react"; import { Template } from "./Template"; import type { KcPagesProperties } from "./KcProperties"; import { defaultKcPagesProperties } from "./KcProperties"; import { assert } from "evt/tools/typeSafety/assert"; import { kcContext } from "../kcContext"; import { useKcTranslation } from "../i18n/useKcTranslation"; import { cx } from "tss-react"; import { useConstCallback } from "powerhooks"; export type LoginProps = { kcProperties?: KcPagesProperties; }; export const Login = memo((props: LoginProps) => { const { kcProperties = {} } = props; const { t, tStr } = useKcTranslation(); Object.assign(kcProperties, defaultKcPagesProperties); const [{ social, realm, url, usernameEditDisabled, login, auth, registrationDisabled }] = useState(() => ( assert( kcContext !== undefined, "App is currently being served by keycloak" ), kcContext )); const [isLoginButtonDisabled, setIsLoginButtonDisabled] = useState(false); const onSubmit = useConstCallback(() => (setIsLoginButtonDisabled(true), true) ); return (