Skip to content

Commit

Permalink
feat: add htmlPageTitle hook and use it in login and sign up pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvikn committed Jun 14, 2023
1 parent 29b2554 commit 3639a5a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/client/src/ce/pages/UserAuth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import {
getThirdPartyAuths,
getIsFormLoginEnabled,
} from "@appsmith/selectors/tenantSelectors";
import Helmet from "react-helmet";
import { useHtmlPageTitle } from "@appsmith/utils";

const validate = (values: LoginFormValues, props: ValidateProps) => {
const errors: LoginFormValues = {};
Expand Down Expand Up @@ -86,6 +88,7 @@ export function Login(props: LoginFormProps) {
const isFormLoginEnabled = useSelector(getIsFormLoginEnabled);
const socialLoginList = useSelector(getThirdPartyAuths);
const queryParams = new URLSearchParams(location.search);
const htmlPageTitle = useHtmlPageTitle();
const invalidCredsForgotPasswordLinkText = createMessage(
LOGIN_PAGE_INVALID_CREDS_FORGOT_PASSWORD_LINK,
);
Expand Down Expand Up @@ -133,6 +136,10 @@ export function Login(props: LoginFormProps) {
subtitle={createMessage(LOGIN_PAGE_SUBTITLE)}
title={createMessage(LOGIN_PAGE_TITLE)}
>
<Helmet>
<title>{htmlPageTitle}</title>
</Helmet>

{showError && (
<Callout
kind="error"
Expand Down
7 changes: 7 additions & 0 deletions app/client/src/ce/pages/UserAuth/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import {
getIsFormLoginEnabled,
getThirdPartyAuths,
} from "@appsmith/selectors/tenantSelectors";
import Helmet from "react-helmet";
import { useHtmlPageTitle } from "@appsmith/utils";

declare global {
interface Window {
Expand Down Expand Up @@ -93,6 +95,7 @@ export function SignUp(props: SignUpFormProps) {
const socialLoginList = useSelector(getThirdPartyAuths);
const shouldDisableSignupButton = pristine || !isFormValid;
const location = useLocation();
const htmlPageTitle = useHtmlPageTitle();

const recaptchaStatus = useScript(
`https://www.google.com/recaptcha/api.js?render=${googleRecaptchaSiteKey.apiKey}`,
Expand Down Expand Up @@ -166,6 +169,10 @@ export function SignUp(props: SignUpFormProps) {
subtitle={createMessage(SIGNUP_PAGE_SUBTITLE)}
title={createMessage(SIGNUP_PAGE_TITLE)}
>
<Helmet>
<title>{htmlPageTitle}</title>
</Helmet>

{showError && <Callout kind="error">{errorMessage}</Callout>}
{socialLoginList.length > 0 && (
<ThirdPartyAuth logins={socialLoginList} type={"SIGNUP"} />
Expand Down
4 changes: 4 additions & 0 deletions app/client/src/ce/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ export const addItemsInContextMenu = (
) => {
return moreActionItems;
};

export const useHtmlPageTitle = () => {
return "Appsmith";
};

0 comments on commit 3639a5a

Please sign in to comment.