Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add htmlPageTitle hook and use it in login and sign up pages #24458

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
};
Loading