feat(apps): login and registration pages in bull and bear
Add /auth/login, /auth/login/verify and /auth/register (type, phone, verify, details) to both apps, with each group's loading skeleton. bull renders the mobile top bar and column; bear the desktop header and centred card. Each page renders its frame on the server and its step only in the browser behind GuestGuard, with noindex metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d43e74237f
commit
fbb3a59677
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { LoginStep } from '@lumina/market/app/screens/(auth)/auth/login/organisms/login-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Login, the number. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function LoginPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset preset="form" label={i18n.t('auth:loading')} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<LoginStep size="md" supportPlacement="popover" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { LoginVerifyStep } from '@lumina/market/app/screens/(auth)/auth/login/verify/organisms/login-verify-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:login.verify-meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Login, the code. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function LoginVerifyPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset preset="form" label={i18n.t('auth:loading')} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<LoginVerifyStep size="md" supportPlacement="popover" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.details.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 4, account details or identity. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterDetailsPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate width="wide">
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={3}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterDetailsStep
|
||||||
|
size="md"
|
||||||
|
supportPlacement="popover"
|
||||||
|
haltPlacement="modal"
|
||||||
|
/>
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterTypeStep } from '@lumina/market/app/screens/(auth)/auth/register/organisms/register-type-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 1, the account type. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterTypePage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate width="wide">
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={2}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterTypeStep size="md" supportPlacement="popover" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterPhoneStep } from '@lumina/market/app/screens/(auth)/auth/register/phone/organisms/register-phone-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 2, the number. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterPhonePage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={1}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterPhoneStep size="md" supportPlacement="popover" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterVerifyStep } from '@lumina/market/app/screens/(auth)/auth/register/verify/organisms/register-verify-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.verify.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 3, the code. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterVerifyPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={1}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterVerifyStep size="md" supportPlacement="popover" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
import { AuthTemplate } from './templates/auth-template';
|
||||||
|
|
||||||
|
/** Login and registration, before their frame arrives: the header, the card and a form step's shape. */
|
||||||
|
export default function AuthLoading() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate>
|
||||||
|
<SkeletonPreset preset="form" delayed label={i18n.t('auth:loading')} />
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
import { Typography } from '@lumina/island/atoms/typography';
|
||||||
|
import { Card } from '@lumina/island/molecules/card';
|
||||||
|
import { cn } from '@lumina/island/tools/cn';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
import { SupportEntry } from '@lumina/market/app/screens/(auth)/organisms/support-entry';
|
||||||
|
import NextLink from 'next/link';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import type { AuthTemplateProps } from './types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login and registration on desktop: the logged-out header (the brand and support) and each
|
||||||
|
* step in one centred card, its buttons inside the card under the fields. Browser back is the
|
||||||
|
* way back; there is no back button.
|
||||||
|
*/
|
||||||
|
export function AuthTemplate({
|
||||||
|
width = 'narrow',
|
||||||
|
children,
|
||||||
|
}: AuthTemplateProps) {
|
||||||
|
return (
|
||||||
|
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
|
||||||
|
<FlexBox
|
||||||
|
tag="header"
|
||||||
|
alignItems="items-center"
|
||||||
|
justifyContent="justify-between"
|
||||||
|
className="min-h-16 border-b border-border-subtle bg-surface px-8"
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
tag={NextLink}
|
||||||
|
href={ROUTES.home}
|
||||||
|
aria-label={i18n.t('auth:header.home')}
|
||||||
|
variant="heading-sm"
|
||||||
|
color="brand"
|
||||||
|
className="rounded-xs no-underline focus-visible:focus-ring"
|
||||||
|
>
|
||||||
|
{i18n.t('auth:header.brand')}
|
||||||
|
</Typography>
|
||||||
|
<SupportEntry trigger="icon" placement="popover" />
|
||||||
|
</FlexBox>
|
||||||
|
<FlexBox
|
||||||
|
tag="main"
|
||||||
|
justifyContent="justify-center"
|
||||||
|
className="px-4 pt-28 pb-16"
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
padding="none"
|
||||||
|
className={cn(
|
||||||
|
'w-full p-10',
|
||||||
|
width === 'wide' ? 'max-w-form' : 'max-w-checkout',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Card>
|
||||||
|
</FlexBox>
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { AuthTemplate } from './AuthTemplate';
|
||||||
|
export type { AuthTemplateProps } from './types';
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
export type AuthTemplateProps = {
|
||||||
|
/** narrow (480): the number and the code. wide (560): the account type and step 4. */
|
||||||
|
width?: 'narrow' | 'wide';
|
||||||
|
children: ReactNode;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { LoginStep } from '@lumina/market/app/screens/(auth)/auth/login/organisms/login-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Login, the number. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function LoginPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate header={<AuthTopBar />}>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset preset="form" label={i18n.t('auth:loading')} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<LoginStep size="lg" supportPlacement="bottom" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { ROUTES, withReturnPath } from '@lumina/market/app/navigation';
|
||||||
|
import { LoginVerifyStep } from '@lumina/market/app/screens/(auth)/auth/login/verify/organisms/login-verify-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:login.verify-meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoginVerifyPageProps = {
|
||||||
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Login, the code. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default async function LoginVerifyPage({
|
||||||
|
searchParams,
|
||||||
|
}: LoginVerifyPageProps) {
|
||||||
|
const { redirect } = await searchParams;
|
||||||
|
const backHref = withReturnPath(
|
||||||
|
ROUTES.login,
|
||||||
|
typeof redirect === 'string' ? redirect : null,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthTemplate
|
||||||
|
header={
|
||||||
|
<AuthTopBar title={i18n.t('auth:login.header')} backHref={backHref} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset preset="form" label={i18n.t('auth:loading')} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<LoginVerifyStep size="lg" supportPlacement="bottom" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.details.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 4, account details or identity. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterDetailsPage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate
|
||||||
|
header={<AuthTopBar title={i18n.t('auth:register.header')} />}
|
||||||
|
>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={3}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterDetailsStep
|
||||||
|
size="lg"
|
||||||
|
supportPlacement="bottom"
|
||||||
|
haltPlacement="sheet"
|
||||||
|
/>
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { RegisterTypeStep } from '@lumina/market/app/screens/(auth)/auth/register/organisms/register-type-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Registration step 1, the account type. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default function RegisterTypePage() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate header={<AuthTopBar />}>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={2}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterTypeStep size="lg" supportPlacement="bottom" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { ROUTES, withReturnPath } from '@lumina/market/app/navigation';
|
||||||
|
import { RegisterPhoneStep } from '@lumina/market/app/screens/(auth)/auth/register/phone/organisms/register-phone-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterPhonePageProps = {
|
||||||
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Registration step 2, the number. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default async function RegisterPhonePage({
|
||||||
|
searchParams,
|
||||||
|
}: RegisterPhonePageProps) {
|
||||||
|
const { redirect } = await searchParams;
|
||||||
|
const backHref = withReturnPath(
|
||||||
|
ROUTES.register.type,
|
||||||
|
typeof redirect === 'string' ? redirect : null,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthTemplate
|
||||||
|
header={
|
||||||
|
<AuthTopBar
|
||||||
|
title={i18n.t('auth:register.header')}
|
||||||
|
backHref={backHref}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={1}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterPhoneStep size="lg" supportPlacement="bottom" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
|
||||||
|
import { ROUTES, withReturnPath } from '@lumina/market/app/navigation';
|
||||||
|
import { RegisterVerifyStep } from '@lumina/market/app/screens/(auth)/auth/register/verify/organisms/register-verify-step';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../../i18n';
|
||||||
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return {
|
||||||
|
title: i18n.t('auth:register.verify.meta-title'),
|
||||||
|
robots: { index: false },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterVerifyPageProps = {
|
||||||
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Registration step 3, the code. The frame renders on the server; the step only in the browser (0013). */
|
||||||
|
export default async function RegisterVerifyPage({
|
||||||
|
searchParams,
|
||||||
|
}: RegisterVerifyPageProps) {
|
||||||
|
const { redirect } = await searchParams;
|
||||||
|
const backHref = withReturnPath(
|
||||||
|
ROUTES.register.phone,
|
||||||
|
typeof redirect === 'string' ? redirect : null,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AuthTemplate
|
||||||
|
header={
|
||||||
|
<AuthTopBar
|
||||||
|
title={i18n.t('auth:register.header')}
|
||||||
|
backHref={backHref}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<GuestGuard
|
||||||
|
fallback={
|
||||||
|
<SkeletonPreset
|
||||||
|
preset="form"
|
||||||
|
count={1}
|
||||||
|
label={i18n.t('auth:loading')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<RegisterVerifyStep size="lg" supportPlacement="bottom" />
|
||||||
|
</GuestGuard>
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
import { AuthTopBar } from './organisms/auth-top-bar';
|
||||||
|
import { AuthTemplate } from './templates/auth-template';
|
||||||
|
|
||||||
|
/** Login and registration, before their frame arrives: the top bar and a form step's shape. */
|
||||||
|
export default function AuthLoading() {
|
||||||
|
return (
|
||||||
|
<AuthTemplate header={<AuthTopBar />}>
|
||||||
|
<SkeletonPreset preset="form" delayed label={i18n.t('auth:loading')} />
|
||||||
|
</AuthTemplate>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
import { Button } from '@lumina/island/atoms/button';
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
import { Typography } from '@lumina/island/atoms/typography';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
import { SupportEntry } from '@lumina/market/app/screens/(auth)/organisms/support-entry';
|
||||||
|
import NextLink from 'next/link';
|
||||||
|
|
||||||
|
import { i18n } from '../../../../i18n';
|
||||||
|
import type { AuthTopBarProps } from './types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The logged-out top bar: the brand and support on a first step; back, the step's name and
|
||||||
|
* support on a pushed step; only the name on a step with no way back (registration step 4).
|
||||||
|
* Back keeps what was typed: the number lives in the flow store.
|
||||||
|
*/
|
||||||
|
export function AuthTopBar({ title, backHref }: AuthTopBarProps) {
|
||||||
|
return (
|
||||||
|
<FlexBox
|
||||||
|
tag="header"
|
||||||
|
alignItems="items-center"
|
||||||
|
gap="gap-1"
|
||||||
|
className="sticky top-0 z-sticky min-h-14 border-b border-border-subtle bg-surface px-2"
|
||||||
|
>
|
||||||
|
{backHref && (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
icon="chevron-right"
|
||||||
|
label={i18n.t('auth:header.back')}
|
||||||
|
href={backHref}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{title ? (
|
||||||
|
<Typography
|
||||||
|
tag="span"
|
||||||
|
variant="heading-sm"
|
||||||
|
className={backHref ? 'flex-1' : 'flex-1 px-2'}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
|
<FlexBox className="flex-1 px-2">
|
||||||
|
<Typography
|
||||||
|
tag={NextLink}
|
||||||
|
href={ROUTES.home}
|
||||||
|
aria-label={i18n.t('auth:header.home')}
|
||||||
|
variant="heading-sm"
|
||||||
|
color="brand"
|
||||||
|
className="rounded-xs no-underline focus-visible:focus-ring"
|
||||||
|
>
|
||||||
|
{i18n.t('auth:header.brand')}
|
||||||
|
</Typography>
|
||||||
|
</FlexBox>
|
||||||
|
)}
|
||||||
|
<SupportEntry trigger="icon" placement="bottom" />
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { AuthTopBar } from './AuthTopBar';
|
||||||
|
export type { AuthTopBarProps } from './types';
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export type AuthTopBarProps = {
|
||||||
|
/** A pushed step's name, such as «ورود». Without it the bar shows the brand. */
|
||||||
|
title?: string;
|
||||||
|
/** The previous step, behind the back button. */
|
||||||
|
backHref?: string;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
|
||||||
|
import type { AuthTemplateProps } from './types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login and registration on mobile: the logged-out top bar over one white column. The submit
|
||||||
|
* buttons sit under their fields, never pinned to the bottom, so they stay above the keyboard.
|
||||||
|
*/
|
||||||
|
export function AuthTemplate({ header, children }: AuthTemplateProps) {
|
||||||
|
return (
|
||||||
|
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
|
||||||
|
{header}
|
||||||
|
<FlexBox
|
||||||
|
tag="main"
|
||||||
|
direction="flex-col"
|
||||||
|
className="w-full flex-1 px-4 pt-6 pb-5"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</FlexBox>
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { AuthTemplate } from './AuthTemplate';
|
||||||
|
export type { AuthTemplateProps } from './types';
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
export type AuthTemplateProps = {
|
||||||
|
/** The top bar: the brand, or back and the step's name. */
|
||||||
|
header: ReactNode;
|
||||||
|
/** The step; it fills the height, so support sits at the bottom. */
|
||||||
|
children: ReactNode;
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue