diff --git a/apps/bear/src/app/(auth)/auth/login/.gitkeep b/apps/bear/src/app/(auth)/auth/login/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bear/src/app/(auth)/auth/login/page.tsx b/apps/bear/src/app/(auth)/auth/login/page.tsx new file mode 100644 index 0000000..5899e5e --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/login/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/auth/login/verify/page.tsx b/apps/bear/src/app/(auth)/auth/login/verify/page.tsx new file mode 100644 index 0000000..51d7e94 --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/login/verify/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/auth/register/details/page.tsx b/apps/bear/src/app/(auth)/auth/register/details/page.tsx new file mode 100644 index 0000000..42f7699 --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/register/details/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/auth/register/page.tsx b/apps/bear/src/app/(auth)/auth/register/page.tsx new file mode 100644 index 0000000..630dfdf --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/register/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/auth/register/phone/page.tsx b/apps/bear/src/app/(auth)/auth/register/phone/page.tsx new file mode 100644 index 0000000..56554d4 --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/register/phone/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/auth/register/verify/page.tsx b/apps/bear/src/app/(auth)/auth/register/verify/page.tsx new file mode 100644 index 0000000..eb1d7e6 --- /dev/null +++ b/apps/bear/src/app/(auth)/auth/register/verify/page.tsx @@ -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 ( + + + } + > + + + + ); +} diff --git a/apps/bear/src/app/(auth)/loading.tsx b/apps/bear/src/app/(auth)/loading.tsx new file mode 100644 index 0000000..00f8489 --- /dev/null +++ b/apps/bear/src/app/(auth)/loading.tsx @@ -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 ( + + + + ); +} diff --git a/apps/bear/src/app/(auth)/templates/auth-template/AuthTemplate.tsx b/apps/bear/src/app/(auth)/templates/auth-template/AuthTemplate.tsx new file mode 100644 index 0000000..26347fe --- /dev/null +++ b/apps/bear/src/app/(auth)/templates/auth-template/AuthTemplate.tsx @@ -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 ( + + + + {i18n.t('auth:header.brand')} + + + + + + {children} + + + + ); +} diff --git a/apps/bear/src/app/(auth)/templates/auth-template/index.ts b/apps/bear/src/app/(auth)/templates/auth-template/index.ts new file mode 100644 index 0000000..9aaae34 --- /dev/null +++ b/apps/bear/src/app/(auth)/templates/auth-template/index.ts @@ -0,0 +1,2 @@ +export { AuthTemplate } from './AuthTemplate'; +export type { AuthTemplateProps } from './types'; diff --git a/apps/bear/src/app/(auth)/templates/auth-template/types.ts b/apps/bear/src/app/(auth)/templates/auth-template/types.ts new file mode 100644 index 0000000..811277a --- /dev/null +++ b/apps/bear/src/app/(auth)/templates/auth-template/types.ts @@ -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; +}; diff --git a/apps/bull/src/app/(auth)/auth/login/.gitkeep b/apps/bull/src/app/(auth)/auth/login/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/bull/src/app/(auth)/auth/login/page.tsx b/apps/bull/src/app/(auth)/auth/login/page.tsx new file mode 100644 index 0000000..f4001ca --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/login/page.tsx @@ -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 ( + }> + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/auth/login/verify/page.tsx b/apps/bull/src/app/(auth)/auth/login/verify/page.tsx new file mode 100644 index 0000000..d9ceee8 --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/login/verify/page.tsx @@ -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>; +}; + +/** 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 ( + + } + > + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/auth/register/details/page.tsx b/apps/bull/src/app/(auth)/auth/register/details/page.tsx new file mode 100644 index 0000000..10d3963 --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/register/details/page.tsx @@ -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 ( + } + > + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/auth/register/page.tsx b/apps/bull/src/app/(auth)/auth/register/page.tsx new file mode 100644 index 0000000..a36693a --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/register/page.tsx @@ -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 ( + }> + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/auth/register/phone/page.tsx b/apps/bull/src/app/(auth)/auth/register/phone/page.tsx new file mode 100644 index 0000000..6631ca9 --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/register/phone/page.tsx @@ -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>; +}; + +/** 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 ( + + } + > + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/auth/register/verify/page.tsx b/apps/bull/src/app/(auth)/auth/register/verify/page.tsx new file mode 100644 index 0000000..47081b5 --- /dev/null +++ b/apps/bull/src/app/(auth)/auth/register/verify/page.tsx @@ -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>; +}; + +/** 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 ( + + } + > + + } + > + + + + ); +} diff --git a/apps/bull/src/app/(auth)/loading.tsx b/apps/bull/src/app/(auth)/loading.tsx new file mode 100644 index 0000000..732f42f --- /dev/null +++ b/apps/bull/src/app/(auth)/loading.tsx @@ -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 ( + }> + + + ); +} diff --git a/apps/bull/src/app/(auth)/organisms/auth-top-bar/AuthTopBar.tsx b/apps/bull/src/app/(auth)/organisms/auth-top-bar/AuthTopBar.tsx new file mode 100644 index 0000000..ca975b6 --- /dev/null +++ b/apps/bull/src/app/(auth)/organisms/auth-top-bar/AuthTopBar.tsx @@ -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 ( + + {backHref && ( +