feat(apps): auth frames on the 560 column with back, payment result back to the channel, layouts declare toast placement

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-10-09 17:38:43 +04:00
parent 0005b18d2a
commit 48166c17db
9 changed files with 142 additions and 74 deletions

View File

@ -1,5 +1,5 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; 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 { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result';
import { i18n } from '../../../../../i18n'; import { i18n } from '../../../../../i18n';
@ -14,7 +14,13 @@ export default function Loading() {
justifyContent="justify-center" justifyContent="justify-center"
className="px-8 py-10" className="px-8 py-10"
> >
<FlexBox direction="flex-col" className="w-full max-w-checkout"> <FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-checkout"
>
{/* To the channel paid for once the payment loads (R14), never to the bank. */}
<DeskBack href={ROUTES.dashboard.subscriptions} />
<PaymentResultSkeleton <PaymentResultSkeleton
layout="desktop" layout="desktop"
label={i18n.t('payment:result.loading')} label={i18n.t('payment:result.loading')}

View File

@ -1,7 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import { DesktopHeader } from '@lumina/market/app/navigation'; import { DeskBack, DesktopHeader, ROUTES } from '@lumina/market/app/navigation';
import { import {
PaymentResult, PaymentResult,
PaymentResultSkeleton, PaymentResultSkeleton,
@ -19,7 +19,10 @@ export function generateMetadata(): Metadata {
}; };
} }
/** «نتیجه پرداخت» on desktop (U10 ۹.۴, ۹.۵): one panel in the 480 column under the header. */ /**
* «نتیجه پرداخت» on desktop (U10 ۹.۴, ۹.۵): «بازگشت», then one panel in the 480 column under the
* header. Back goes to the channel paid for (R14), which the payment declares once it loads.
*/
export default async function PaymentResultPage({ export default async function PaymentResultPage({
params, params,
}: PaymentResultPageProps) { }: PaymentResultPageProps) {
@ -39,7 +42,13 @@ export default async function PaymentResultPage({
justifyContent="justify-center" justifyContent="justify-center"
className="px-8 py-10" className="px-8 py-10"
> >
<FlexBox direction="flex-col" className="w-full max-w-checkout"> <FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-checkout"
>
{/* To the channel paid for once the payment loads (R14), never to the bank. */}
<DeskBack href={ROUTES.dashboard.subscriptions} />
<PartBoundary <PartBoundary
name="payment-result" name="payment-result"
description={i18n.t('payment:result.error')} description={i18n.t('payment:result.error')}

View File

@ -3,6 +3,7 @@ import '../bootstrap/bootstrap.server';
import '../styles/app.css'; import '../styles/app.css';
import { CRITICAL_FONT_URL } from '@lumina/island/constants'; import { CRITICAL_FONT_URL } from '@lumina/island/constants';
import { ToastPlacementMarker } from '@lumina/island/molecules/toast';
import { Element } from '@lumina/island/primitives/element'; import { Element } from '@lumina/island/primitives/element';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
@ -27,7 +28,11 @@ export default function RootLayout({ children }: { children: ReactNode }) {
return ( return (
<Element tag="html" lang={i18n.language} dir={i18n.dir()}> <Element tag="html" lang={i18n.language} dir={i18n.dir()}>
<Element tag="body"> <Element tag="body">
<AppProviders>{children}</AppProviders> <AppProviders>
{/* Desktop toasts: centred, 32px from the bottom, whatever the page shows. */}
<ToastPlacementMarker placement="desktop" />
{children}
</AppProviders>
</Element> </Element>
</Element> </Element>
); );

View File

@ -1,61 +1,66 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography'; import { Typography } from '@lumina/island/atoms/typography';
import { Card } from '@lumina/island/molecules/card'; 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 { ROUTES } from '@lumina/market/app/navigation';
import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry'; import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
import NextLink from 'next/link'; import NextLink from 'next/link';
import { i18n } from '../../../i18n'; import { i18n } from '../../../i18n';
import { StepBack } from './components/StepBack';
import type { AuthTemplateProps } from './types'; import type { AuthTemplateProps } from './types';
/** /**
* Login and registration on desktop: the logged-out header (the brand and support) and each * Login and registration on desktop: the logged-out header (the brand and support, no login) and
* step in one centred card, its buttons inside the card under the fields. Registration step 5 * each step in one card of the 560 column, its buttons inside the card under the fields. A pushed
* keeps the header, signed in: there is no nav until registration is complete. Browser back is the * step has «بازگشت» above the card (R14), to the step before it. Registration step 5 keeps the
* way back; there is no back button. * 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({ export function AuthTemplate({
width = 'narrow',
framed = true, framed = true,
brandHref = ROUTES.landing, brandHref = ROUTES.landing,
back,
children, children,
}: AuthTemplateProps) { }: AuthTemplateProps) {
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page"> <FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<FlexBox <FlexBox direction="flex-col" className="sticky top-0 z-sticky">
tag="header" <FlexBox
alignItems="items-center" tag="header"
justifyContent="justify-between" alignItems="items-center"
className="min-h-16 border-b border-border-subtle bg-surface px-8" justifyContent="justify-between"
> className="min-h-16 border-b border-border-subtle bg-surface ps-8 pe-6"
<Typography
tag={NextLink}
href={brandHref}
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
</Typography> tag={NextLink}
<SupportEntry trigger="icon" placement="popover" /> href={brandHref}
aria-label={i18n.t('auth:header.home')}
variant="heading-md"
className="rounded-xs leading-7.5 whitespace-nowrap no-underline focus-visible:focus-ring"
>
{i18n.t('auth:header.brand')}
</Typography>
<SupportEntry trigger="icon" placement="popover" />
</FlexBox>
<NetworkBar />
</FlexBox> </FlexBox>
<FlexBox <FlexBox
tag="main" tag="main"
justifyContent="justify-center" justifyContent="justify-center"
className="px-4 pt-28 pb-16" className="px-8 py-10"
> >
{framed ? ( {framed ? (
<Card <FlexBox
padding="none" direction="flex-col"
className={cn( gap="gap-4"
'w-full p-10', className="w-full max-w-form"
width === 'wide' ? 'max-w-form' : 'max-w-checkout',
)}
> >
{children} {back && <StepBack step={back} />}
</Card> <Card padding="none" className="px-10 pt-10 pb-8">
{children}
</Card>
</FlexBox>
) : ( ) : (
children children
)} )}

View File

@ -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 <DeskBack href={withReturnPath(step, redirect)} />;
}

View File

@ -1,7 +1,10 @@
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
export type AuthTemplateProps = { 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'; width?: 'narrow' | 'wide';
/** /**
* false: no card; the step draws its own, such as registration step 5's form card beside its * 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; framed?: boolean;
/** Where the brand goes: the landing for login and registration, خانه on onboarding pages. */ /** Where the brand goes: the landing for login and registration, خانه on onboarding pages. */
brandHref?: string; 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; children: ReactNode;
}; };
export type StepBackProps = { step: string };

View File

@ -1,5 +1,5 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; 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 { PaymentResultSkeleton } from '@lumina/market/app/screens/(flow)/payment/result/[paymentId]/organisms/payment-result';
import { i18n } from '../../../../../i18n'; import { i18n } from '../../../../../i18n';
@ -8,7 +8,11 @@ import { i18n } from '../../../../../i18n';
export default function Loading() { export default function Loading() {
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface"> <FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={i18n.t('payment:result.title')} back={false} /> {/* Back goes to the channel paid for once the payment loads (R14), never to the bank. */}
<MobileTopBar
title={i18n.t('payment:result.title')}
backHref={ROUTES.dashboard.subscriptions}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<PaymentResultSkeleton <PaymentResultSkeleton
layout="mobile" layout="mobile"

View File

@ -1,7 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import { MobileTopBar } from '@lumina/market/app/navigation'; import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation';
import { import {
PaymentResult, PaymentResult,
PaymentResultSkeleton, PaymentResultSkeleton,
@ -20,8 +20,9 @@ export function generateMetadata(): Metadata {
} }
/** /**
* «نتیجه پرداخت» (U10 ۹.۱–۹.۳): the name and support with no back, since the bank is behind it, * «نتیجه پرداخت» (U10 ۹.۱–۹.۳): back, the name and support, the investor's own payment in the
* the investor's own payment in the browser, and its two ways on pinned to the bottom. * browser, and its two ways on pinned to the bottom. Back goes to the channel paid for (R14), which
* the payment declares once it loads; until then to اشتراک‌ها, never to the bank behind it.
*/ */
export default async function PaymentResultPage({ export default async function PaymentResultPage({
params, params,
@ -36,7 +37,11 @@ export default async function PaymentResultPage({
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface"> <FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={i18n.t('payment:result.title')} back={false} /> {/* Back goes to the channel paid for once the payment loads (R14), never to the bank. */}
<MobileTopBar
title={i18n.t('payment:result.title')}
backHref={ROUTES.dashboard.subscriptions}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<PartBoundary <PartBoundary
name="payment-result" name="payment-result"

View File

@ -1,5 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography'; import { Typography } from '@lumina/island/atoms/typography';
import { cn } from '@lumina/island/tools/cn';
import { NetworkBar } from '@lumina/market/app/app-shell';
import { ROUTES } from '@lumina/market/app/navigation'; import { ROUTES } from '@lumina/market/app/navigation';
import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry'; import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
import NextLink from 'next/link'; import NextLink from 'next/link';
@ -9,9 +11,10 @@ import { BackButton } from './components/BackButton';
import type { AuthTopBarProps } from './types'; import type { AuthTopBarProps } from './types';
/** /**
* The logged-out top bar: the brand and support on a first step; back, the step's name and * The logged-out top bar: the brand (21/700) and support on a first step; back, the step's name
* support on a pushed step; only the name on a step with no way back (registration step 4). * (18/30) and support on a pushed step; only the name on a step with no way back (registration
* Back keeps what was typed: the number lives in the flow store. * step 4). Back keeps what was typed: the number lives in the flow store. The connection bar
* draws under it, in the same sticky box.
*/ */
export function AuthTopBar({ export function AuthTopBar({
title, title,
@ -19,36 +22,41 @@ export function AuthTopBar({
brandHref = ROUTES.landing, brandHref = ROUTES.landing,
}: AuthTopBarProps) { }: AuthTopBarProps) {
return ( return (
<FlexBox <FlexBox direction="flex-col" className="sticky top-0 z-sticky">
tag="header" <FlexBox
alignItems="items-center" tag="header"
gap="gap-1" alignItems="items-center"
className="sticky top-0 z-sticky min-h-14 border-b border-border-subtle bg-surface px-2" gap="gap-1"
> className={cn(
{back && <BackButton step={back} label={i18n.t('auth:header.back')} />} 'min-h-14 border-b border-border-subtle bg-surface pe-2',
{title ? ( back ? 'ps-1' : 'ps-4',
<Typography )}
tag="span" >
variant="heading-sm" {back && <BackButton step={back} label={i18n.t('auth:header.back')} />}
className={back ? 'flex-1' : 'flex-1 px-2'} {title ? (
>
{title}
</Typography>
) : (
<FlexBox className="flex-1 px-2">
<Typography <Typography
tag={NextLink} tag="span"
href={brandHref} variant="body-lg"
aria-label={i18n.t('auth:header.home')} className="min-w-0 flex-1 truncate leading-7.5 font-semibold"
variant="heading-sm"
color="brand"
className="rounded-xs no-underline focus-visible:focus-ring"
> >
{i18n.t('auth:header.brand')} {title}
</Typography> </Typography>
</FlexBox> ) : (
)} <FlexBox className="min-w-0 flex-1">
<SupportEntry trigger="icon" placement="bottom" /> <Typography
tag={NextLink}
href={brandHref}
aria-label={i18n.t('auth:header.home')}
variant="heading-md"
className="rounded-xs leading-7.5 whitespace-nowrap no-underline focus-visible:focus-ring"
>
{i18n.t('auth:header.brand')}
</Typography>
</FlexBox>
)}
<SupportEntry trigger="icon" placement="bottom" />
</FlexBox>
<NetworkBar />
</FlexBox> </FlexBox>
); );
} }