diff --git a/src/routes/login/MetamaskLoginButton.tsx b/src/routes/login/MetamaskLoginButton.tsx index a3964b83..b06d0921 100644 --- a/src/routes/login/MetamaskLoginButton.tsx +++ b/src/routes/login/MetamaskLoginButton.tsx @@ -7,12 +7,15 @@ import { StyledSocialButton } from "./styled"; import Onboarding from "@metamask/onboarding"; import { LoginCredential } from "../../types/auth"; import { useTranslation } from "react-i18next"; +import { AuthType } from "../../types/common"; // import toast from "react-hot-toast"; export default function MetamaskLoginButton({ - login + login, + type = "login" }: { login: (params: LoginCredential) => void; + type?: AuthType }) { const { t } = useTranslation("auth"); const [requesting, setRequesting] = useState(false); @@ -93,7 +96,7 @@ export default function MetamaskLoginButton({ return ( meta mask icon - {t("login.metamask")} + {type == "login" ? t("login.metamask") : t("reg.metamask")} ); } diff --git a/src/routes/login/OidcLoginButton.tsx b/src/routes/login/OidcLoginButton.tsx index dc247715..19e5263f 100644 --- a/src/routes/login/OidcLoginButton.tsx +++ b/src/routes/login/OidcLoginButton.tsx @@ -8,6 +8,7 @@ import StyledButton from "../../common/component/styled/Button"; import OidcLoginEntry from "./OidcLoginEntry"; import { OIDCConfig } from "../../types/auth"; import { useTranslation } from "react-i18next"; +import { AuthType } from "../../types/common"; const StyledOidcLoginModal = styled(StyledModal)` text-align: center; @@ -30,8 +31,9 @@ const StyledOidcLoginModal = styled(StyledModal)` `; interface IProps { issuers?: OIDCConfig[]; + type?: AuthType } -const OidcLoginButton: FC = ({ issuers }) => { +const OidcLoginButton: FC = ({ issuers, type = "login" }) => { const { t } = useTranslation("auth"); const [modal, setModal] = useState(false); if (!issuers) return null; @@ -42,7 +44,7 @@ const OidcLoginButton: FC = ({ issuers }) => { setModal(true); }} > - {t("login.oidc")} + {type == "login" ? t("login.oidc") : t("reg.oidc")} {modal && ( diff --git a/src/routes/login/SocialLoginButtons.tsx b/src/routes/login/SocialLoginButtons.tsx index 010bf50a..35d48a09 100644 --- a/src/routes/login/SocialLoginButtons.tsx +++ b/src/routes/login/SocialLoginButtons.tsx @@ -9,10 +9,13 @@ import MetamaskLoginButton from "./MetamaskLoginButton"; import OidcLoginButton from "./OidcLoginButton"; import { useLoginMutation } from '../../app/services/auth'; import { LoginConfig } from '../../types/server'; +import { AuthType } from '../../types/common'; -// type Props = {} +type Props = { + type?: AuthType +} -const SocialLoginButtons = () => { +const SocialLoginButtons = ({ type = "login" }: Props) => { const [login, { isSuccess }] = useLoginMutation(); const { config: githubAuthConfig } = useGithubAuthConfig(); const { data: loginConfig, isSuccess: loginConfigSuccess } = useGetLoginConfigQuery(); @@ -34,12 +37,12 @@ const SocialLoginButtons = () => { const googleLogin = enableGoogleLogin && !!clientId; return ( <> - {googleLogin && } + {googleLogin && } {enableGithubLogin && ( - + )} - {enableMetamaskLogin && } - {oidc.length > 0 && } + {enableMetamaskLogin && } + {oidc.length > 0 && } ); }; diff --git a/src/routes/reg/Register.tsx b/src/routes/reg/Register.tsx index 500df7f2..cefd32b6 100644 --- a/src/routes/reg/Register.tsx +++ b/src/routes/reg/Register.tsx @@ -147,7 +147,7 @@ export default function Reg() {
- +