diff --git a/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx index 1f33abb..64bf071 100644 --- a/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx +++ b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -1,5 +1,5 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { DesktopHeader } from '@lumina/market/app/navigation'; +import { DeskBack, DesktopHeader, ROUTES } from '@lumina/market/app/navigation'; import { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; import { i18n } from '../../../../../i18n'; @@ -14,7 +14,13 @@ export default function Loading() { justifyContent="justify-center" className="px-8 py-10" > - + + {/* To the channel paid for once the payment loads (R14), never to the bank. */} + - + + {/* To the channel paid for once the payment loads (R14), never to the bank. */} + - {children} + + {/* Desktop toasts: centred, 32px from the bottom, whatever the page shows. */} + + {children} + ); diff --git a/apps/bear/src/app/templates/auth-template/AuthTemplate.tsx b/apps/bear/src/app/templates/auth-template/AuthTemplate.tsx index 51e27a5..5eec10d 100644 --- a/apps/bear/src/app/templates/auth-template/AuthTemplate.tsx +++ b/apps/bear/src/app/templates/auth-template/AuthTemplate.tsx @@ -1,61 +1,66 @@ 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 { NetworkBar } from '@lumina/market/app/app-shell'; import { ROUTES } from '@lumina/market/app/navigation'; import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry'; import NextLink from 'next/link'; import { i18n } from '../../../i18n'; +import { StepBack } from './components/StepBack'; 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. Registration step 5 - * keeps the header, signed in: there is no nav until registration is complete. Browser back is the - * way back; there is no back button. + * Login and registration on desktop: the logged-out header (the brand and support, no login) and + * each step in one card of the 560 column, its buttons inside the card under the fields. A pushed + * step has «بازگشت» above the card (R14), to the step before it. Registration step 5 keeps the + * header, signed in: there is no nav until registration is complete. The connection bar draws + * under the header, in the same sticky box. */ export function AuthTemplate({ - width = 'narrow', framed = true, brandHref = ROUTES.landing, + back, children, }: AuthTemplateProps) { return ( - - + - {i18n.t('auth:header.brand')} - - + + {i18n.t('auth:header.brand')} + + + + {framed ? ( - - {children} - + {back && } + + {children} + + ) : ( children )} diff --git a/apps/bear/src/app/templates/auth-template/components/StepBack.tsx b/apps/bear/src/app/templates/auth-template/components/StepBack.tsx new file mode 100644 index 0000000..30dd153 --- /dev/null +++ b/apps/bear/src/app/templates/auth-template/components/StepBack.tsx @@ -0,0 +1,16 @@ +'use client'; + +import { DeskBack, withReturnPath } from '@lumina/market/app/navigation'; +import { useSearchParams } from 'next/navigation'; + +import type { StepBackProps } from '../types'; + +/** + * «بازگشت» to the previous step, keeping `?redirect=` from the address bar, so a page and its + * loading frame lead to the same place and the person still returns to the page that asked for + * login. + */ +export function StepBack({ step }: StepBackProps) { + const redirect = useSearchParams().get('redirect'); + return ; +} diff --git a/apps/bear/src/app/templates/auth-template/types.ts b/apps/bear/src/app/templates/auth-template/types.ts index 4825514..2edecfe 100644 --- a/apps/bear/src/app/templates/auth-template/types.ts +++ b/apps/bear/src/app/templates/auth-template/types.ts @@ -1,7 +1,10 @@ import type { ReactNode } from 'react'; export type AuthTemplateProps = { - /** narrow (480): the number and the code. wide (560): the account type and step 4. */ + /** + * The card's column. Both are the design's 560 form column now (J01, J02), so pages may drop it; + * kept so they don't have to change at once. + */ width?: 'narrow' | 'wide'; /** * false: no card; the step draws its own, such as registration step 5's form card beside its @@ -10,5 +13,12 @@ export type AuthTemplateProps = { framed?: boolean; /** Where the brand goes: the landing for login and registration, خانه on onboarding pages. */ brandHref?: string; + /** + * The previous step's path, behind «بازگشت» above the card; `?redirect=` is kept from the + * address. First steps, step 4 and 5 and the suspended page have none, as on mobile. + */ + back?: string; children: ReactNode; }; + +export type StepBackProps = { step: string }; diff --git a/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx index 689e527..8886055 100644 --- a/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx +++ b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -1,5 +1,5 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { MobileTopBar } from '@lumina/market/app/navigation'; +import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; import { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result'; import { i18n } from '../../../../../i18n'; @@ -8,7 +8,11 @@ import { i18n } from '../../../../../i18n'; export default function Loading() { return ( - + {/* Back goes to the channel paid for once the payment loads (R14), never to the bank. */} + - + {/* Back goes to the channel paid for once the payment loads (R14), never to the bank. */} + - {back && } - {title ? ( - - {title} - - ) : ( - + + + {back && } + {title ? ( - {i18n.t('auth:header.brand')} + {title} - - )} - + ) : ( + + + {i18n.t('auth:header.brand')} + + + )} + + + ); }