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 { 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"
>
<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
layout="desktop"
label={i18n.t('payment:result.loading')}

View File

@ -1,7 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries';
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 {
PaymentResult,
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({
params,
}: PaymentResultPageProps) {
@ -39,7 +42,13 @@ export default async function PaymentResultPage({
justifyContent="justify-center"
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
name="payment-result"
description={i18n.t('payment:result.error')}

View File

@ -3,6 +3,7 @@ import '../bootstrap/bootstrap.server';
import '../styles/app.css';
import { CRITICAL_FONT_URL } from '@lumina/island/constants';
import { ToastPlacementMarker } from '@lumina/island/molecules/toast';
import { Element } from '@lumina/island/primitives/element';
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
@ -27,7 +28,11 @@ export default function RootLayout({ children }: { children: ReactNode }) {
return (
<Element tag="html" lang={i18n.language} dir={i18n.dir()}>
<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>
);

View File

@ -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 (
<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={brandHref}
aria-label={i18n.t('auth:header.home')}
variant="heading-sm"
color="brand"
className="rounded-xs no-underline focus-visible:focus-ring"
<FlexBox direction="flex-col" className="sticky top-0 z-sticky">
<FlexBox
tag="header"
alignItems="items-center"
justifyContent="justify-between"
className="min-h-16 border-b border-border-subtle bg-surface ps-8 pe-6"
>
{i18n.t('auth:header.brand')}
</Typography>
<SupportEntry trigger="icon" placement="popover" />
<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>
<SupportEntry trigger="icon" placement="popover" />
</FlexBox>
<NetworkBar />
</FlexBox>
<FlexBox
tag="main"
justifyContent="justify-center"
className="px-4 pt-28 pb-16"
className="px-8 py-10"
>
{framed ? (
<Card
padding="none"
className={cn(
'w-full p-10',
width === 'wide' ? 'max-w-form' : 'max-w-checkout',
)}
<FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-form"
>
{children}
</Card>
{back && <StepBack step={back} />}
<Card padding="none" className="px-10 pt-10 pb-8">
{children}
</Card>
</FlexBox>
) : (
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';
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 };

View File

@ -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 (
<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">
<PaymentResultSkeleton
layout="mobile"

View File

@ -1,7 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PartBoundary } from '@lumina/market/app/error-boundaries';
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 {
PaymentResult,
PaymentResultSkeleton,
@ -20,8 +20,9 @@ export function generateMetadata(): Metadata {
}
/**
* «نتیجه پرداخت» (U10 ۹.۱–۹.۳): the name and support with no back, since the bank is behind it,
* the investor's own payment in the browser, and its two ways on pinned to the bottom.
* «نتیجه پرداخت» (U10 ۹.۱–۹.۳): back, the name and support, the investor's own payment in the
* 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({
params,
@ -36,7 +37,11 @@ export default async function PaymentResultPage({
return (
<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">
<PartBoundary
name="payment-result"

View File

@ -1,5 +1,7 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
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 { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
import NextLink from 'next/link';
@ -9,9 +11,10 @@ import { BackButton } from './components/BackButton';
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.
* The logged-out top bar: the brand (21/700) and support on a first step; back, the step's name
* (18/30) 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. The connection bar
* draws under it, in the same sticky box.
*/
export function AuthTopBar({
title,
@ -19,36 +22,41 @@ export function AuthTopBar({
brandHref = ROUTES.landing,
}: 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"
>
{back && <BackButton step={back} label={i18n.t('auth:header.back')} />}
{title ? (
<Typography
tag="span"
variant="heading-sm"
className={back ? 'flex-1' : 'flex-1 px-2'}
>
{title}
</Typography>
) : (
<FlexBox className="flex-1 px-2">
<FlexBox direction="flex-col" className="sticky top-0 z-sticky">
<FlexBox
tag="header"
alignItems="items-center"
gap="gap-1"
className={cn(
'min-h-14 border-b border-border-subtle bg-surface pe-2',
back ? 'ps-1' : 'ps-4',
)}
>
{back && <BackButton step={back} label={i18n.t('auth:header.back')} />}
{title ? (
<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"
tag="span"
variant="body-lg"
className="min-w-0 flex-1 truncate leading-7.5 font-semibold"
>
{i18n.t('auth:header.brand')}
{title}
</Typography>
</FlexBox>
)}
<SupportEntry trigger="icon" placement="bottom" />
) : (
<FlexBox className="min-w-0 flex-1">
<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>
);
}