diff --git a/app/scenes/Login/index.js b/app/scenes/Login/index.js index 1f674c8bf..c793c5707 100644 --- a/app/scenes/Login/index.js +++ b/app/scenes/Login/index.js @@ -21,11 +21,36 @@ import Provider from "./Provider"; import env from "env"; import useQuery from "hooks/useQuery"; import useStores from "hooks/useStores"; +import { isCustomDomain } from "utils/domains"; type Props = {| location: Location, |}; +function Header({ config }) { + const { t } = useTranslation(); + const isHosted = env.DEPLOYMENT === "hosted"; + const isSubdomain = !!config.hostname; + + if (!isHosted || isCustomDomain()) { + return null; + } + + if (isSubdomain) { + return ( + + {t("Back to home")} + + ); + } + + return ( + + {t("Back to website")} + + ); +} + function Login({ location }: Props) { const query = useQuery(); const { t, i18n } = useTranslation(); @@ -79,22 +104,10 @@ function Login({ location }: Props) { (provider) => provider.id === auth.lastSignedIn && !isCreate ); - const header = - env.DEPLOYMENT === "hosted" && - (config.hostname ? ( - - {t("Back to home")} - - ) : ( - - {t("Back to website")} - - )); - if (emailLinkSentTo) { return ( - {header} +
@@ -117,7 +130,7 @@ function Login({ location }: Props) { return ( - {header} +