Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
import Link from "next/link";
|
|
import { useTranslation } from "@plane/i18n";
|
|
import { PlaneLockup } from "@plane/propel/icons";
|
|
import { PageHead } from "@/components/core/page-title";
|
|
import { EAuthModes } from "@/helpers/authentication.helper";
|
|
import { useInstance } from "@/hooks/store/use-instance";
|
|
|
|
const authContentMap = {
|
|
[EAuthModes.SIGN_IN]: {
|
|
pageTitle: "Sign up",
|
|
text: "auth.common.new_to_plane",
|
|
linkText: "Sign up",
|
|
linkHref: "/sign-up",
|
|
},
|
|
[EAuthModes.SIGN_UP]: {
|
|
pageTitle: "Sign in",
|
|
text: "auth.common.already_have_an_account",
|
|
linkText: "Sign in",
|
|
linkHref: "/sign-in",
|
|
},
|
|
};
|
|
|
|
type AuthHeaderProps = {
|
|
type: EAuthModes;
|
|
};
|
|
|
|
export const AuthHeader = observer(function AuthHeader({ type }: AuthHeaderProps) {
|
|
const { t } = useTranslation();
|
|
// store
|
|
const { config } = useInstance();
|
|
// derived values
|
|
const enableSignUpConfig = config?.enable_signup ?? false;
|
|
|
|
return (
|
|
<AuthHeaderBase
|
|
pageTitle={t(authContentMap[type].pageTitle)}
|
|
additionalAction={
|
|
enableSignUpConfig && (
|
|
<div className="flex flex-col items-end text-center text-13 font-medium text-tertiary sm:flex-row sm:items-center sm:gap-2">
|
|
<span className="text-body-sm-regular text-tertiary">{t(authContentMap[type].text)}</span>
|
|
<Link
|
|
href={authContentMap[type].linkHref}
|
|
className="text-body-sm-semibold text-accent-primary hover:underline"
|
|
>
|
|
{t(authContentMap[type].linkText)}
|
|
</Link>
|
|
</div>
|
|
)
|
|
}
|
|
/>
|
|
);
|
|
});
|
|
|
|
type TAuthHeaderBase = {
|
|
pageTitle: string;
|
|
additionalAction?: React.ReactNode;
|
|
};
|
|
|
|
export function AuthHeaderBase(props: TAuthHeaderBase) {
|
|
const { pageTitle, additionalAction } = props;
|
|
return (
|
|
<>
|
|
<PageHead title={pageTitle + " - Plane"} />
|
|
<div className="sticky top-0 flex w-full flex-shrink-0 items-center justify-between gap-6">
|
|
<Link href="/">
|
|
<PlaneLockup height={20} width={95} className="text-primary" />
|
|
</Link>
|
|
{additionalAction}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|