1. Marketing Layout: speed up rendering by retrieving user session from cookies instead of using server side request 2. Use "redirecting" state when signing in to keep displaying a loading state while Next.js redirects to home page 3. Use "useCallback" to prevent double tracking when switching pages 4. Add links pre-fetching in marketing navigation 5. Add new pending state to MFA verification form 6. Pre-fetch sign-in/sign-up pages 7. Fix i18n when using regional languages 8. currency formatter should default to the region if it exists 9. Update packages
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
import Link from 'next/link';
|
|
|
|
import { SignUpMethodsContainer } from '@kit/auth/sign-up';
|
|
import { Button } from '@kit/ui/button';
|
|
import { Heading } from '@kit/ui/heading';
|
|
import { Trans } from '@kit/ui/trans';
|
|
|
|
import authConfig from '~/config/auth.config';
|
|
import pathsConfig from '~/config/paths.config';
|
|
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
|
|
import { withI18n } from '~/lib/i18n/with-i18n';
|
|
|
|
export const generateMetadata = async () => {
|
|
const i18n = await createI18nServerInstance();
|
|
|
|
return {
|
|
title: i18n.t('auth:signUp'),
|
|
};
|
|
};
|
|
|
|
interface Props {
|
|
searchParams: Promise<{
|
|
invite_token?: string;
|
|
}>;
|
|
}
|
|
|
|
const paths = {
|
|
callback: pathsConfig.auth.callback,
|
|
appHome: pathsConfig.app.home,
|
|
};
|
|
|
|
async function SignUpPage({ searchParams }: Props) {
|
|
const inviteToken = (await searchParams).invite_token;
|
|
|
|
const signInPath =
|
|
pathsConfig.auth.signIn +
|
|
(inviteToken ? `?invite_token=${inviteToken}` : '');
|
|
|
|
return (
|
|
<>
|
|
<div className={'flex flex-col items-center gap-1'}>
|
|
<Heading level={4} className={'tracking-tight'}>
|
|
<Trans i18nKey={'auth:signUpHeading'} />
|
|
</Heading>
|
|
|
|
<p className={'text-muted-foreground text-sm'}>
|
|
<Trans i18nKey={'auth:signUpSubheading'} />
|
|
</p>
|
|
</div>
|
|
|
|
<SignUpMethodsContainer
|
|
providers={authConfig.providers}
|
|
displayTermsCheckbox={authConfig.displayTermsCheckbox}
|
|
inviteToken={inviteToken}
|
|
paths={paths}
|
|
/>
|
|
|
|
<div className={'flex justify-center'}>
|
|
<Button asChild variant={'link'} size={'sm'}>
|
|
<Link href={signInPath} prefetch={true}>
|
|
<Trans i18nKey={'auth:alreadyHaveAnAccount'} />
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default withI18n(SignUpPage);
|