Compare commits

..

No commits in common. "c593e095542aaf53e7903e4d78c0ab9cfb0b65b9" and "7a6cd93b4102a269cf53ef20ac7980e0226471dd" have entirely different histories.

322 changed files with 1263 additions and 4955 deletions

View File

@ -1,5 +1,4 @@
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { ROUTES } from '@lumina/market/app/navigation';
import { i18n } from '../../../../../i18n'; import { i18n } from '../../../../../i18n';
import { AuthTemplate } from '../../../../templates/auth-template'; import { AuthTemplate } from '../../../../templates/auth-template';
@ -7,7 +6,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
/** Registration step 4, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */ /** Registration step 4, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
export default function Loading() { export default function Loading() {
return ( return (
<AuthTemplate back={ROUTES.landing}> <AuthTemplate>
<SkeletonPreset <SkeletonPreset
preset="form" preset="form"
count={3} count={3}

View File

@ -1,14 +1,5 @@
// First: the rules sheet reads a server-only namespace, which the server bootstrap adds to i18n
// when this module loads (0055).
import '../../../../../bootstrap/bootstrap.server';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { GuestGuard } from '@lumina/market/app/guards/guest-guard'; import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
import { ROUTES } from '@lumina/market/app/navigation';
import {
GeneralRules,
generalRulesLabels,
} from '@lumina/market/app/screens/organisms/general-rules';
import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step'; import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
@ -23,7 +14,7 @@ export const metadata: Metadata = {
/** Registration step 4, account details or identity. The frame renders on the server; the step only in the browser (0013). */ /** Registration step 4, account details or identity. The frame renders on the server; the step only in the browser (0013). */
export default function RegisterDetailsPage() { export default function RegisterDetailsPage() {
return ( return (
<AuthTemplate back={ROUTES.landing}> <AuthTemplate>
<GuestGuard <GuestGuard
fallback={ fallback={
<SkeletonPreset <SkeletonPreset
@ -37,12 +28,6 @@ export default function RegisterDetailsPage() {
size="md" size="md"
supportPlacement="popover" supportPlacement="popover"
haltPlacement="modal" haltPlacement="modal"
rules={
<GeneralRules
layout="sheet"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
}
/> />
</GuestGuard> </GuestGuard>
</AuthTemplate> </AuthTemplate>

View File

@ -22,7 +22,6 @@ export default function Loading() {
> >
<DesktopPageTitle title={i18n.t('payment:checkout.title')} /> <DesktopPageTitle title={i18n.t('payment:checkout.title')} />
<CheckoutSkeleton <CheckoutSkeleton
delayed
layout="desktop" layout="desktop"
creator={<CheckoutCreatorSkeleton />} creator={<CheckoutCreatorSkeleton />}
label={i18n.t('payment:checkout.loading')} label={i18n.t('payment:checkout.loading')}

View File

@ -45,8 +45,6 @@ export function CheckoutTemplate({ channel }: CheckoutTemplateProps) {
channelHref={ROUTES.channel(channel.username)} channelHref={ROUTES.channel(channel.username)}
layout="desktop" layout="desktop"
creator={<CheckoutCreator creator={channel} />} creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/> />
</PartBoundary> </PartBoundary>
</FlexBox> </FlexBox>

View File

@ -1,7 +1,17 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { DesktopHeader } from '@lumina/market/app/navigation'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { PricingEditor } from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-editor'; import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import {
DesktopHeader,
DesktopPageTitle,
ROUTES,
} from '@lumina/market/app/navigation';
import {
PricingForm,
PricingFormSkeleton,
} from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-form';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { Suspense } from 'react';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
@ -12,11 +22,14 @@ export const metadata: Metadata = {
/** /**
* C7, «ویرایش قیمت‌ها» on desktop (C7 ۸.۱): the creator header with داشبورد on, «بازگشت» above * C7, «ویرایش قیمت‌ها» on desktop (C7 ۸.۱): the creator header with داشبورد on, «بازگشت» above
* the title (to طرح‌های اشتراک when opened on its own, R14), and the form in the 560 column; with * the title (to طرح‌های اشتراک when opened on its own, R14), and the form in the 560 column. The form is the creator's own, so it renders in the
* unsaved changes, leaving asks first (J10-4n). The form is the creator's own, so it renders in * browser behind cards of the same size.
* the browser behind cards of the same size.
*/ */
export default function PricingPage() { export default function PricingPage() {
const skeleton = (
<PricingFormSkeleton layout="desktop" label={i18n.t('pricing:loading')} />
);
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page"> <FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<DesktopHeader /> <DesktopHeader />
@ -25,8 +38,22 @@ export default function PricingPage() {
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-form"> <FlexBox direction="flex-col" gap="gap-4" className="w-full max-w-form">
<PricingEditor layout="desktop" /> <DesktopPageTitle
title={i18n.t('pricing:title')}
parentHref={ROUTES.dashboard.plans}
/>
<PartBoundary
name="pricing-form"
description={i18n.t('pricing:error')}
framed
>
<AuthGuard role="creator" fallback={skeleton}>
<Suspense fallback={skeleton}>
<PricingForm layout="desktop" />
</Suspense>
</AuthGuard>
</PartBoundary>
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>

View File

@ -22,7 +22,6 @@ export default function Loading() {
{/* 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. */}
<DeskBack href={ROUTES.dashboard.subscriptions} /> <DeskBack href={ROUTES.dashboard.subscriptions} />
<PaymentResultSkeleton <PaymentResultSkeleton
delayed
layout="desktop" layout="desktop"
label={i18n.t('payment:result.loading')} label={i18n.t('payment:result.loading')}
/> />

View File

@ -1,54 +0,0 @@
// First: the static `metadata` below reads a server-only namespace, which the server bootstrap
// adds to i18n when this module loads, whichever module Next loads first (0055).
import '../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation';
import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rules-tabs';
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/**
* «قوانین لومینا» on desktop (G-2r): the 640 column under the header, with back beside the title
* «قوانین لومینا» and the tab row «قوانین عمومی» · «شرایط اشتراک»; each tab's text sits in a panel.
* Each tab is its own route with its own loading, so the title and the row stay while one loads;
* back returns to where the rules were opened. No nav item is active.
*/
export default function RulesLayout({ children }: { children: ReactNode }) {
const t = i18n.getFixedT(null, 'rules');
return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<DesktopHeader />
<FlexBox
tag="main"
justifyContent="justify-center"
className="px-8 py-10"
>
<FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-content"
>
<DesktopPageTitle title={t('title')} />
<RulesTabs
layout="desktop"
labels={{
label: t('tabs.label'),
general: t('tabs.general'),
subscription: t('tabs.subscription'),
}}
/>
{children}
</FlexBox>
</FlexBox>
</FlexBox>
);
}

View File

@ -1,20 +0,0 @@
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { Card } from '@lumina/island/molecules/card';
import { i18n } from '../../../i18n';
/** «قوانین عمومی» before it arrives, under the section's title and tabs: its panel of lines. */
export default function Loading() {
return (
<SkeletonRegion delayed label={i18n.t('rules:meta-title')}>
<Card padding="lg">
<Skeleton width="40%" height="1.25rem" className="mb-3" />
<Skeleton lines={3} />
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />
<Skeleton lines={3} />
<Skeleton width="45%" height="1.25rem" className="mt-6 mb-3" />
<Skeleton lines={4} />
</Card>
</SkeletonRegion>
);
}

View File

@ -1,29 +1,10 @@
// First: the static `metadata` below reads a server-only namespace, which the server bootstrap import { ROUTES } from '@lumina/market/app/navigation';
// adds to i18n when this module loads, whichever module Next loads first (0055). import { redirect } from 'next/navigation';
import '../../../bootstrap/bootstrap.server';
import { Card } from '@lumina/island/molecules/card'; /**
import { * `/terms`, the address the boards give «شرایط اشتراک» (G-2), sends on to the page at its own
GeneralRules, * address. Temporary, so `/terms` can become a page of its own later.
generalRulesLabels, */
} from '@lumina/market/app/screens/organisms/general-rules'; export default function TermsPage(): never {
import type { Metadata } from 'next'; redirect(ROUTES.terms);
import { i18n } from '../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/** «قوانین عمومی», the first tab of «قوانین لومینا» on desktop (G-2r): the text in a panel. */
export default function GeneralRulesPage() {
return (
<Card padding="lg">
<GeneralRules
layout="desktop"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
</Card>
);
} }

View File

@ -1,18 +1,19 @@
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { Card } from '@lumina/island/molecules/card';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
/** The terms before they arrive, under the section's title and tabs: their panel of lines. */ /** The terms before they arrive: a few paragraphs' worth of lines. */
export default function Loading() { export default function Loading() {
return ( return (
<SkeletonRegion delayed label={i18n.t('terms:meta-title')}> <SkeletonRegion
<Card padding="lg"> delayed
label={i18n.t('terms:meta-title')}
className="mx-auto w-full max-w-content p-4"
>
<Skeleton width="40%" height="1.25rem" className="mb-3" /> <Skeleton width="40%" height="1.25rem" className="mb-3" />
<Skeleton lines={4} /> <Skeleton lines={4} />
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" /> <Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />
<Skeleton lines={5} /> <Skeleton lines={5} />
</Card>
</SkeletonRegion> </SkeletonRegion>
); );
} }

View File

@ -2,7 +2,9 @@
// adds to i18n when this module loads, whichever module Next loads first (0055). // adds to i18n when this module loads, whichever module Next loads first (0055).
import '../../../../bootstrap/bootstrap.server'; import '../../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Card } from '@lumina/island/molecules/card'; import { Card } from '@lumina/island/molecules/card';
import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation';
import { import {
SubscriptionTerms, SubscriptionTerms,
subscriptionTermsLabels, subscriptionTermsLabels,
@ -19,8 +21,8 @@ export const metadata: Metadata = {
}; };
/** /**
* «شرایط اشتراک», the second tab of «قوانین لومینا» on desktop (S5 ۲.۱, G-2): the text in a panel * «شرایط اشتراک» on desktop (S5 ۲.۱): the text in a panel of the 640 column under the header,
* of the section's 640 column, about 75 characters a line; the title and tabs come from the layout. * about 75 characters a line, with back beside the title.
*/ */
export default function SubscriptionTermsPage() { export default function SubscriptionTermsPage() {
const labels = subscriptionTermsLabels( const labels = subscriptionTermsLabels(
@ -30,6 +32,19 @@ export default function SubscriptionTermsPage() {
); );
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<DesktopHeader />
<FlexBox
tag="main"
justifyContent="justify-center"
className="px-8 py-10"
>
<FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-content"
>
<DesktopPageTitle title={labels.title} />
<Card padding="lg"> <Card padding="lg">
<SubscriptionTerms <SubscriptionTerms
layout="desktop" layout="desktop"
@ -37,5 +52,8 @@ export default function SubscriptionTermsPage() {
labels={labels} labels={labels}
/> />
</Card> </Card>
</FlexBox>
</FlexBox>
</FlexBox>
); );
} }

View File

@ -49,7 +49,6 @@ export function PostTemplate({
username={channel.username} username={channel.username}
channelUrl={channelUrl} channelUrl={channelUrl}
layout="desktop" layout="desktop"
saleOpen={channel.saleOpen}
/> />
</PartBoundary> </PartBoundary>
} }

View File

@ -1,7 +1,6 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome';
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
import { ChannelDeskBack } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-desk-back'; import { ChannelDeskBack } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-desk-back';
import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server';
@ -9,7 +8,6 @@ import {
ChannelHeader, ChannelHeader,
channelHeaderLabels, channelHeaderLabels,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share';
import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server';
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
@ -58,9 +56,14 @@ export function ChannelTemplate({
); );
} }
const publicChannel = ( return (
<> <FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<ApprovedWelcome creatorId={channel.creatorId} layout="desktop" /> <FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-content"
>
<ChannelDeskBack creatorId={channel.creatorId} />
<ChannelHeader <ChannelHeader
channel={channel} channel={channel}
layout="desktop" layout="desktop"
@ -101,41 +104,24 @@ export function ChannelTemplate({
username={channel.username} username={channel.username}
channelUrl={channelUrl} channelUrl={channelUrl}
layout="desktop" layout="desktop"
saleOpen={channel.saleOpen}
inviteNoteName={channel.displayName}
/> />
</PartBoundary> </PartBoundary>
} }
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
verified={!channel.verificationPending}
/> />
<PartBoundary name="channel-feed"> <PartBoundary name="channel-feed">
<Suspense <Suspense
fallback={ fallback={
<SkeletonPreset preset="post" count={2} label={t('feed.loading')} /> <SkeletonPreset
preset="post"
count={2}
label={t('feed.loading')}
/>
} }
> >
<ChannelFeed channel={channel} now={now} layout="desktop" /> <ChannelFeed channel={channel} now={now} layout="desktop" />
</Suspense> </Suspense>
</PartBoundary> </PartBoundary>
</>
);
return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">
<FlexBox
direction="flex-col"
gap="gap-4"
className="w-full max-w-content"
>
<ChannelDeskBack creatorId={channel.creatorId} />
{channel.verificationPending ? (
<PendingChannelGate layout="desktop" channelUrl={channelUrl}>
{publicChannel}
</PendingChannelGate>
) : (
publicChannel
)}
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -26,7 +26,11 @@ export default function SubscriptionsPage() {
); );
return ( return (
<PartBoundary name="subscription-list" size="page"> <PartBoundary
name="subscription-list"
description={i18n.t('dashboard:subscriptions.error')}
framed
>
<AuthGuard role="investor" fallback={skeleton}> <AuthGuard role="investor" fallback={skeleton}>
<Suspense fallback={skeleton}> <Suspense fallback={skeleton}>
<SubscriptionList layout="desktop" /> <SubscriptionList layout="desktop" />

View File

@ -26,7 +26,11 @@ export default function TransactionsPage() {
); );
return ( return (
<PartBoundary name="transaction-list" size="page"> <PartBoundary
name="transaction-list"
description={i18n.t('dashboard:transactions.error')}
framed
>
<AuthGuard role="investor" fallback={skeleton}> <AuthGuard role="investor" fallback={skeleton}>
<Suspense fallback={skeleton}> <Suspense fallback={skeleton}>
<TransactionList layout="desktop" /> <TransactionList layout="desktop" />

View File

@ -9,7 +9,6 @@ export default function Loading() {
return ( return (
<AuthTemplate brandHref={ROUTES.home} framed={false}> <AuthTemplate brandHref={ROUTES.home} framed={false}>
<CreatorProfileStepSkeleton <CreatorProfileStepSkeleton
delayed
layout="desktop" layout="desktop"
label={i18n.t('auth:loading')} label={i18n.t('auth:loading')}
/> />

View File

@ -8,7 +8,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
export default function Loading() { export default function Loading() {
return ( return (
<AuthTemplate brandHref={ROUTES.home}> <AuthTemplate brandHref={ROUTES.home}>
<CreatorProfileDoneStepSkeleton delayed label={i18n.t('auth:loading')} /> <CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
</AuthTemplate> </AuthTemplate>
); );
} }

View File

@ -8,7 +8,7 @@ import { AuthTemplate } from '../../../templates/auth-template';
export default function Loading() { export default function Loading() {
return ( return (
<AuthTemplate brandHref={ROUTES.home}> <AuthTemplate brandHref={ROUTES.home}>
<InvestorProfileStepSkeleton delayed label={i18n.t('auth:loading')} /> <InvestorProfileStepSkeleton label={i18n.t('auth:loading')} />
</AuthTemplate> </AuthTemplate>
); );
} }

View File

@ -4,13 +4,7 @@ import { http } from '@lumina/libs/http';
import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa'; import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa';
import { mapApiErrorBody } from '@lumina/market/app/http'; import { mapApiErrorBody } from '@lumina/market/app/http';
import { setEnv as setMarketEnv } from '@lumina/market/env'; import { setEnv as setMarketEnv } from '@lumina/market/env';
import { import { AUTH_ENDPOINTS, AUTH_EVENTS } from '@lumina/market/features/auth';
AUTH_ENDPOINTS,
AUTH_EVENTS,
endSuspendedSession,
isSessionSuspended,
suspendedSessionOf,
} from '@lumina/market/features/auth';
import { API_PROXY_PATH, API_VERSION_PATH } from '../constants'; import { API_PROXY_PATH, API_VERSION_PATH } from '../constants';
import { clientEnv } from '../env'; import { clientEnv } from '../env';
@ -26,27 +20,16 @@ setMarketEnv({
}); });
// The browser calls the API on this site's origin, proxied to the gateway (0018). The session // The browser calls the API on this site's origin, proxied to the gateway (0018). The session
// lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app; // lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app;
// when that fails the session is over and the shell signs the user out. A 401 `ACCOUNT_SUSPENDED` // when that fails the session is over and the shell signs the user out.
// never refreshes: the account was suspended mid-session, so the session ends and the page halts
// (J01-3d), once, whichever request learns it first.
http.configure({ http.configure({
baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`, baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`,
refresh: { refresh: {
endpoint: AUTH_ENDPOINTS.refresh, endpoint: AUTH_ENDPOINTS.refresh,
shouldRefresh: (error) => onFailure: () =>
error.status === 401 && suspendedSessionOf(error) === null, eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }),
onFailure: () => {
if (isSessionSuspended()) return;
eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' });
},
}, },
mapErrorBody: mapApiErrorBody, mapErrorBody: mapApiErrorBody,
}); });
http.interceptors.response.use(undefined, (error) => {
const suspension = suspendedSessionOf(error);
if (suspension) endSuspendedSession(suspension);
return error;
});
configureErrorHandler(ERROR_HANDLER_CONFIG); configureErrorHandler(ERROR_HANDLER_CONFIG);
// The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell // The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell
// registers it when this flag is on, and turning the flag off unregisters it for every visitor. // registers it when this flag is on, and turning the flag off unregisters it for every visitor.

View File

@ -1,5 +1,4 @@
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { ROUTES } from '@lumina/market/app/navigation';
import { i18n } from '../../../../../i18n'; import { i18n } from '../../../../../i18n';
import { AuthTopBar } from '../../../../organisms/auth-top-bar'; import { AuthTopBar } from '../../../../organisms/auth-top-bar';
@ -9,12 +8,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
export default function Loading() { export default function Loading() {
return ( return (
<AuthTemplate <AuthTemplate
header={ header={<AuthTopBar title={i18n.t('auth:register.header')} />}
<AuthTopBar
title={i18n.t('auth:register.header')}
back={ROUTES.landing}
/>
}
> >
<SkeletonPreset <SkeletonPreset
preset="form" preset="form"

View File

@ -1,14 +1,5 @@
// First: the rules sheet reads a server-only namespace, which the server bootstrap adds to i18n
// when this module loads (0055).
import '../../../../../bootstrap/bootstrap.server';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { GuestGuard } from '@lumina/market/app/guards/guest-guard'; import { GuestGuard } from '@lumina/market/app/guards/guest-guard';
import { ROUTES } from '@lumina/market/app/navigation';
import {
GeneralRules,
generalRulesLabels,
} from '@lumina/market/app/screens/organisms/general-rules';
import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step'; import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/register/details/organisms/register-details-step';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
@ -25,12 +16,7 @@ export const metadata: Metadata = {
export default function RegisterDetailsPage() { export default function RegisterDetailsPage() {
return ( return (
<AuthTemplate <AuthTemplate
header={ header={<AuthTopBar title={i18n.t('auth:register.header')} />}
<AuthTopBar
title={i18n.t('auth:register.header')}
back={ROUTES.landing}
/>
}
> >
<GuestGuard <GuestGuard
fallback={ fallback={
@ -45,12 +31,6 @@ export default function RegisterDetailsPage() {
size="lg" size="lg"
supportPlacement="bottom" supportPlacement="bottom"
haltPlacement="sheet" haltPlacement="sheet"
rules={
<GeneralRules
layout="sheet"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
}
/> />
</GuestGuard> </GuestGuard>
</AuthTemplate> </AuthTemplate>

View File

@ -12,7 +12,6 @@ export default function Loading() {
<MobileTopBar title={i18n.t('payment:checkout.title')} /> <MobileTopBar title={i18n.t('payment:checkout.title')} />
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<CheckoutSkeleton <CheckoutSkeleton
delayed
layout="mobile" layout="mobile"
creator={<CheckoutCreatorSkeleton />} creator={<CheckoutCreatorSkeleton />}
label={i18n.t('payment:checkout.loading')} label={i18n.t('payment:checkout.loading')}

View File

@ -27,8 +27,6 @@ export function CheckoutTemplate({ channel }: CheckoutTemplateProps) {
channelHref={ROUTES.channel(channel.username)} channelHref={ROUTES.channel(channel.username)}
layout="mobile" layout="mobile"
creator={<CheckoutCreator creator={channel} />} creator={<CheckoutCreator creator={channel} />}
creatorName={channel.displayName ?? channel.username}
creatorLinks={channel.socialLinks}
/> />
</PartBoundary> </PartBoundary>
</FlexBox> </FlexBox>

View File

@ -1,6 +1,13 @@
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { PricingEditor } from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-editor'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation';
import {
PricingForm,
PricingFormSkeleton,
} from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-form';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { Suspense } from 'react';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
@ -12,14 +19,33 @@ export const metadata: Metadata = {
/** /**
* C7, «ویرایش قیمت‌ها» on mobile: a task page pushed from the «قیمت طرح‌ها» card, back · title · * C7, «ویرایش قیمت‌ها» on mobile: a task page pushed from the «قیمت طرح‌ها» card, back · title ·
* support and no bottom nav (Creator Dashboard ۴.۱; consistency rules R7, R8); opened on its own, * support and no bottom nav (Creator Dashboard ۴.۱; consistency rules R7, R8); opened on its own,
* back goes to طرح‌های اشتراک (R14), and with unsaved changes it asks first (J10-4n). The form * back goes to طرح‌های اشتراک (R14). The form pads itself and pins its save to the bottom. It is
* pads itself and pins its save to the bottom. It is the creator's own, so it renders in the * the creator's own, so it renders in the browser behind cards of the same size.
* browser behind cards of the same size.
*/ */
export default function PricingPage() { export default function PricingPage() {
const skeleton = (
<PricingFormSkeleton layout="mobile" label={i18n.t('pricing:loading')} />
);
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-bg-page"> <FlexBox direction="flex-col" className="min-h-dvh bg-bg-page">
<PricingEditor layout="mobile" /> <MobileTopBar
title={i18n.t('pricing:title')}
parentHref={ROUTES.dashboard.plans}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1">
<PartBoundary
name="pricing-form"
description={i18n.t('pricing:error')}
framed
>
<AuthGuard role="creator" fallback={skeleton}>
<Suspense fallback={skeleton}>
<PricingForm layout="mobile" />
</Suspense>
</AuthGuard>
</PartBoundary>
</FlexBox>
</FlexBox> </FlexBox>
); );
} }

View File

@ -15,7 +15,6 @@ export default function Loading() {
/> />
<FlexBox tag="main" direction="flex-col" className="flex-1"> <FlexBox tag="main" direction="flex-col" className="flex-1">
<PaymentResultSkeleton <PaymentResultSkeleton
delayed
layout="mobile" layout="mobile"
label={i18n.t('payment:result.loading')} label={i18n.t('payment:result.loading')}
/> />

View File

@ -1,47 +0,0 @@
// First: the static `metadata` below reads a server-only namespace, which the server bootstrap
// adds to i18n when this module loads, whichever module Next loads first (0055).
import '../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { MobileTopBar } from '@lumina/market/app/navigation';
import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rules-tabs';
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/**
* «قوانین لومینا» on mobile (G-2r): a task page pushed from حساب کاربری, checkout, a suspended card
* or the support sheet: back · «قوانین لومینا» · support, no bottom nav, then the tab row
* «قوانین عمومی» · «شرایط اشتراک». Each tab is its own route with its own loading, so the bar and
* the row stay while one loads; back returns to where the rules were opened.
*/
export default function RulesLayout({ children }: { children: ReactNode }) {
const t = i18n.getFixedT(null, 'rules');
return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={t('title')} />
<RulesTabs
layout="mobile"
labels={{
label: t('tabs.label'),
general: t('tabs.general'),
subscription: t('tabs.subscription'),
}}
/>
<FlexBox
tag="main"
direction="flex-col"
className="flex-1 px-4 pt-4 pb-8"
>
{children}
</FlexBox>
</FlexBox>
);
}

View File

@ -1,17 +0,0 @@
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { i18n } from '../../../i18n';
/** «قوانین عمومی» before it arrives, under the section's bar and tabs: a few sections' worth of lines. */
export default function Loading() {
return (
<SkeletonRegion delayed label={i18n.t('rules:meta-title')}>
<Skeleton width="40%" height="1.25rem" className="mb-3" />
<Skeleton lines={3} />
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />
<Skeleton lines={3} />
<Skeleton width="45%" height="1.25rem" className="mt-6 mb-3" />
<Skeleton lines={4} />
</SkeletonRegion>
);
}

View File

@ -1,26 +1,10 @@
// First: the static `metadata` below reads a server-only namespace, which the server bootstrap import { ROUTES } from '@lumina/market/app/navigation';
// adds to i18n when this module loads, whichever module Next loads first (0055). import { redirect } from 'next/navigation';
import '../../../bootstrap/bootstrap.server';
import { /**
GeneralRules, * `/terms`, the address the boards give «شرایط اشتراک» (G-2), sends on to the page at its own
generalRulesLabels, * address. Temporary, so `/terms` can become a page of its own later.
} from '@lumina/market/app/screens/organisms/general-rules'; */
import type { Metadata } from 'next'; export default function TermsPage(): never {
redirect(ROUTES.terms);
import { i18n } from '../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/** «قوانین عمومی», the first tab of «قوانین لومینا» on mobile (G-2r), under the section's bar. */
export default function GeneralRulesPage() {
return (
<GeneralRules
layout="mobile"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
);
} }

View File

@ -2,10 +2,14 @@ import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { i18n } from '../../../../i18n'; import { i18n } from '../../../../i18n';
/** The terms before they arrive, under the section's bar and tabs: a few paragraphs' worth of lines. */ /** The terms before they arrive: a few paragraphs' worth of lines. */
export default function Loading() { export default function Loading() {
return ( return (
<SkeletonRegion delayed label={i18n.t('terms:meta-title')}> <SkeletonRegion
delayed
label={i18n.t('terms:meta-title')}
className="mx-auto w-full max-w-content p-4"
>
<Skeleton width="40%" height="1.25rem" className="mb-3" /> <Skeleton width="40%" height="1.25rem" className="mb-3" />
<Skeleton lines={4} /> <Skeleton lines={4} />
<Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" /> <Skeleton width="35%" height="1.25rem" className="mt-6 mb-3" />

View File

@ -2,6 +2,8 @@
// adds to i18n when this module loads, whichever module Next loads first (0055). // adds to i18n when this module loads, whichever module Next loads first (0055).
import '../../../../bootstrap/bootstrap.server'; import '../../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { MobileTopBar } from '@lumina/market/app/navigation';
import { import {
SubscriptionTerms, SubscriptionTerms,
subscriptionTermsLabels, subscriptionTermsLabels,
@ -18,9 +20,8 @@ export const metadata: Metadata = {
}; };
/** /**
* «شرایط اشتراک», the second tab of «قوانین لومینا» on mobile (S5 ۱.۱, G-2): the section's bar and * «شرایط اشتراک» on mobile (S5 ۱.۱): a task page pushed from checkout, a suspended card or the
* tabs come from its layout; back returns to where the rules were opened (checkout, a suspended * support sheet, back · title · support and no bottom nav; back returns to where it was opened.
* card, the support sheet).
*/ */
export default function SubscriptionTermsPage() { export default function SubscriptionTermsPage() {
const labels = subscriptionTermsLabels( const labels = subscriptionTermsLabels(
@ -30,10 +31,19 @@ export default function SubscriptionTermsPage() {
); );
return ( return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={labels.title} />
<FlexBox
tag="main"
direction="flex-col"
className="flex-1 px-4 pt-4 pb-8"
>
<SubscriptionTerms <SubscriptionTerms
layout="mobile" layout="mobile"
chats={supportChatUrls()} chats={supportChatUrls()}
labels={labels} labels={labels}
/> />
</FlexBox>
</FlexBox>
); );
} }

View File

@ -46,7 +46,6 @@ export function PostTemplate({
username={channel.username} username={channel.username}
channelUrl={channelUrl} channelUrl={channelUrl}
layout="mobile" layout="mobile"
saleOpen={channel.saleOpen}
/> />
</PartBoundary> </PartBoundary>
} }

View File

@ -2,14 +2,12 @@ import { FlexBox } from '@lumina/island/atoms/flex-box';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { PartBoundary } from '@lumina/market/app/error-boundaries';
import { MobileTopBar } from '@lumina/market/app/navigation'; import { MobileTopBar } from '@lumina/market/app/navigation';
import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome';
import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions';
import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server';
import { import {
ChannelHeader, ChannelHeader,
channelHeaderLabels, channelHeaderLabels,
} from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header';
import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found';
import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share';
import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server';
import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable';
@ -54,9 +52,13 @@ export function ChannelTemplate({
); );
} }
const publicChannel = ( return (
<> <>
<ApprovedWelcome creatorId={channel.creatorId} layout="mobile" /> <MobileTopBar
title={t('top-bar.channel')}
tabOwnerId={channel.creatorId}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1">
<ChannelHeader <ChannelHeader
channel={channel} channel={channel}
layout="mobile" layout="mobile"
@ -97,13 +99,10 @@ export function ChannelTemplate({
username={channel.username} username={channel.username}
channelUrl={channelUrl} channelUrl={channelUrl}
layout="mobile" layout="mobile"
saleOpen={channel.saleOpen}
inviteNoteName={channel.displayName}
/> />
</PartBoundary> </PartBoundary>
} }
labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))}
verified={!channel.verificationPending}
/> />
<FlexBox direction="flex-col" className="p-4"> <FlexBox direction="flex-col" className="p-4">
<PartBoundary name="channel-feed"> <PartBoundary name="channel-feed">
@ -120,23 +119,6 @@ export function ChannelTemplate({
</Suspense> </Suspense>
</PartBoundary> </PartBoundary>
</FlexBox> </FlexBox>
</>
);
return (
<>
<MobileTopBar
title={t('top-bar.channel')}
tabOwnerId={channel.creatorId}
/>
<FlexBox tag="main" direction="flex-col" className="flex-1">
{channel.verificationPending ? (
<PendingChannelGate layout="mobile" channelUrl={channelUrl}>
{publicChannel}
</PendingChannelGate>
) : (
publicChannel
)}
</FlexBox> </FlexBox>
</> </>
); );

View File

@ -26,7 +26,11 @@ export default function SubscriptionsPage() {
); );
return ( return (
<PartBoundary name="subscription-list" size="page"> <PartBoundary
name="subscription-list"
description={i18n.t('dashboard:subscriptions.error')}
framed
>
<AuthGuard role="investor" fallback={skeleton}> <AuthGuard role="investor" fallback={skeleton}>
<Suspense fallback={skeleton}> <Suspense fallback={skeleton}>
<SubscriptionList layout="mobile" /> <SubscriptionList layout="mobile" />

View File

@ -26,7 +26,11 @@ export default function TransactionsPage() {
); );
return ( return (
<PartBoundary name="transaction-list" size="page"> <PartBoundary
name="transaction-list"
description={i18n.t('dashboard:transactions.error')}
framed
>
<AuthGuard role="investor" fallback={skeleton}> <AuthGuard role="investor" fallback={skeleton}>
<Suspense fallback={skeleton}> <Suspense fallback={skeleton}>
<TransactionList layout="mobile" /> <TransactionList layout="mobile" />

View File

@ -11,7 +11,6 @@ export default function Loading() {
header={<AuthTopBar title={i18n.t('auth:register.header')} />} header={<AuthTopBar title={i18n.t('auth:register.header')} />}
> >
<CreatorProfileStepSkeleton <CreatorProfileStepSkeleton
delayed
layout="mobile" layout="mobile"
label={i18n.t('auth:loading')} label={i18n.t('auth:loading')}
/> />

View File

@ -9,7 +9,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
export default function Loading() { export default function Loading() {
return ( return (
<AuthTemplate header={<AuthTopBar brandHref={ROUTES.home} />}> <AuthTemplate header={<AuthTopBar brandHref={ROUTES.home} />}>
<CreatorProfileDoneStepSkeleton delayed label={i18n.t('auth:loading')} /> <CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
</AuthTemplate> </AuthTemplate>
); );
} }

View File

@ -10,7 +10,7 @@ export default function Loading() {
<AuthTemplate <AuthTemplate
header={<AuthTopBar title={i18n.t('auth:register.header')} />} header={<AuthTopBar title={i18n.t('auth:register.header')} />}
> >
<InvestorProfileStepSkeleton delayed label={i18n.t('auth:loading')} /> <InvestorProfileStepSkeleton label={i18n.t('auth:loading')} />
</AuthTemplate> </AuthTemplate>
); );
} }

View File

@ -4,13 +4,7 @@ import { http } from '@lumina/libs/http';
import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa'; import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa';
import { mapApiErrorBody } from '@lumina/market/app/http'; import { mapApiErrorBody } from '@lumina/market/app/http';
import { setEnv as setMarketEnv } from '@lumina/market/env'; import { setEnv as setMarketEnv } from '@lumina/market/env';
import { import { AUTH_ENDPOINTS, AUTH_EVENTS } from '@lumina/market/features/auth';
AUTH_ENDPOINTS,
AUTH_EVENTS,
endSuspendedSession,
isSessionSuspended,
suspendedSessionOf,
} from '@lumina/market/features/auth';
import { API_PROXY_PATH, API_VERSION_PATH } from '../constants'; import { API_PROXY_PATH, API_VERSION_PATH } from '../constants';
import { clientEnv } from '../env'; import { clientEnv } from '../env';
@ -26,27 +20,16 @@ setMarketEnv({
}); });
// The browser calls the API on this site's origin, proxied to the gateway (0018). The session // The browser calls the API on this site's origin, proxied to the gateway (0018). The session
// lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app; // lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app;
// when that fails the session is over and the shell signs the user out. A 401 `ACCOUNT_SUSPENDED` // when that fails the session is over and the shell signs the user out.
// never refreshes: the account was suspended mid-session, so the session ends and the page halts
// (J01-3d), once, whichever request learns it first.
http.configure({ http.configure({
baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`, baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`,
refresh: { refresh: {
endpoint: AUTH_ENDPOINTS.refresh, endpoint: AUTH_ENDPOINTS.refresh,
shouldRefresh: (error) => onFailure: () =>
error.status === 401 && suspendedSessionOf(error) === null, eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }),
onFailure: () => {
if (isSessionSuspended()) return;
eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' });
},
}, },
mapErrorBody: mapApiErrorBody, mapErrorBody: mapApiErrorBody,
}); });
http.interceptors.response.use(undefined, (error) => {
const suspension = suspendedSessionOf(error);
if (suspension) endSuspendedSession(suspension);
return error;
});
configureErrorHandler(ERROR_HANDLER_CONFIG); configureErrorHandler(ERROR_HANDLER_CONFIG);
// The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell // The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell
// registers it when this flag is on, and turning the flag off unregisters it for every visitor. // registers it when this flag is on, and turning the flag off unregisters it for every visitor.

View File

@ -1,6 +1,6 @@
# 0032 The notification centre is a page on mobile and a panel on desktop # 0032 The notification centre is a page on mobile and a panel on desktop
Status: Superseded by 0058 · Area: architecture · Date: 2026-10-08 · Decided by: agent Status: Proposed · Area: architecture · Date: 2026-10-08 · Decided by: agent
## Context ## Context

View File

@ -8,7 +8,7 @@ C7 ۶.۲ removes «ذخیره قیمت‌گذاری» during the lock while prom
## Decision ## Decision
During the lock, standing prices and period switches are read-only (50%), promotions stay editable, and the save button stays as «ذخیره تخفیف», so promotion changes go through the promotion check and confirmation (J10-4m). During the lock, standing prices and period switches are read-only (50%), promotions stay editable, and the save button stays, so promotion changes go through the same check and confirmation as any save.
## Alternatives ## Alternatives

View File

@ -1,6 +1,6 @@
# 0044 An invite link's code is kept per creator in the checkout draft # 0044 An invite link's code is kept per creator in the checkout draft
Status: Superseded by 0059 · Area: architecture · Date: 2026-10-09 · Decided by: agent Status: Proposed · Area: architecture · Date: 2026-10-09 · Decided by: agent
## Context ## Context
Creators share `/@username?code=…` (J10-2). The code must survive a guest's login and reach that creator's checkout (J06-1b/1c, 2n/2o). 0030 keeps checkout state out of the URL. Creators share `/@username?code=…` (J10-2). The code must survive a guest's login and reach that creator's checkout (J06-1b/1c, 2n/2o). 0030 keeps checkout state out of the URL.

View File

@ -1,6 +1,6 @@
# 0048 Composers check publish standing and publish idempotently # 0048 Composers check publish standing and publish idempotently
Status: Superseded by 0060 · Area: architecture · Date: 2026-10-09 · Decided by: agent Status: Proposed · Area: architecture · Date: 2026-10-09 · Decided by: agent
## Context ## Context
A pending, rejected or suspended creator could open a composer by URL and fail only on publish. A retried publish could duplicate a post. A pending, rejected or suspended creator could open a composer by URL and fail only on publish. A retried publish could duplicate a post.

View File

@ -1,18 +0,0 @@
# 0058 Opening notifications clears the bell; a row is read when tapped
Status: Accepted · Area: architecture · Date: 2026-10-10 · Decided by: user · Supersedes: 0032
## Context
The new canvas (J07-5h, A9) keeps an unread dot on each row until it is tapped, while opening the list clears the bell count. 0032 marked everything read on open.
## Decision
- `ROUTES.notifications` (`/notifications`) is a `(main)` page in both apps; bull's bell links there, bear's header bell opens the 400px side panel, loaded on the first click; a direct visit renders the page.
- Opening the list records "seen" (`POST /v1/notifications/seen`), which zeroes the bell count. A row stays unread, with its dot, until it is tapped (`POST /v1/notifications/:id/read`).
- Creators get one list with filter chips «همه · پیش‌بینی‌ها · مالی · حساب» that filter in place; categories come from the notification type.
- The bell shows for a member of either role on every tab bar and the desktop header.
## Alternatives
- Mark all read on open (0032): loses which rows the person never looked at.
## Consequences
The API keeps `seenAt` per user beside each row's `readAt`.

View File

@ -1,17 +0,0 @@
# 0059 Checkout takes an invite code from its link once, then forgets the URL
Status: Accepted · Area: architecture · Date: 2026-10-10 · Decided by: user · Supersedes: 0044
## Context
J06-7: the capacity-opened alert and SMS open `/checkout/@user?code=…` with the investor's code applied. 0044 kept the code out of checkout's URL.
## Decision
- The channel reads `?code=` and checkout reads `?code=` on arrival. Either one saves it in the persisted `session.checkout-draft` store under `inviteCodes[creatorId]`, written only after the draft is restored.
- Checkout then removes `code` from the address bar with `router.replace`, fills the field, marks it as from the link and checks it.
- The code is dropped after a paid subscription to that creator or on sign-out.
## Alternatives
- Link the alert to the channel (0044): one extra tap before paying while capacity lasts.
## Consequences
A shared checkout link carries a code only until it is opened.

View File

@ -1,16 +0,0 @@
# 0060 An analyst who can't publish sees the reason on their own channel
Status: Accepted · Area: architecture · Date: 2026-10-10 · Decided by: user · Supersedes: 0048
## Context
J09-1e draws «پیش‌بینی جدید» for a pending, rejected or suspended analyst as the locked dialog over their own channel. 0048 rendered a locked page on `/compose/*`.
## Decision
- `/compose/post` and `/compose/prediction` read the creator's standing in the browser; when publishing is blocked they replace the route with the creator's own channel and open the locked dialog there (`?locked=post|prediction`, removed once shown). A 403 on publish re-reads the standing and does the same.
- Every publish sends an `Idempotency-Key` that stays the same while the body is unchanged and is renewed after any change or `IDEMPOTENCY_KEY_REUSED`.
## Alternatives
- A locked page on the composer route (0048): a second place for the same message.
## Consequences
Published predictions can't be edited or deleted (API `PREDICTION_LOCKED`).

View File

@ -21,9 +21,6 @@
- 0054 Set `htmlLimitedBots: /.*/` in both apps' `next.config.ts`, so every visitor gets metadata in `<head>`. - 0054 Set `htmlLimitedBots: /.*/` in both apps' `next.config.ts`, so every visitor gets metadata in `<head>`.
- 0055 Export static `metadata` from every layout and page; only the channel and post pages use `generateMetadata`, through the page's cached read. - 0055 Export static `metadata` from every layout and page; only the channel and post pages use `generateMetadata`, through the page's cached read.
- 0057 Back links to `parentHref` and traverses history only when that is the previous entry; `backToPrevious` pages (and pages without `parentHref`) accept any previous page. - 0057 Back links to `parentHref` and traverses history only when that is the previous entry; `backToPrevious` pages (and pages without `parentHref`) accept any previous page.
- 0058 Opening notifications records "seen" and clears the bell; a row stays unread until tapped; creators filter one list by «همه · پیش‌بینی‌ها · مالی · حساب».
- 0059 Checkout and the channel save `?code=` into the per-creator checkout draft on arrival; checkout then strips it from the URL.
- 0060 Composers send a creator who can't publish to their own channel with the locked dialog; every publish carries a stable `Idempotency-Key`.
## Proposed ## Proposed
@ -43,18 +40,21 @@
- 0029 architecture: End every payment on `/payment/result/[paymentId]`; the API's bank callback returns to `/payment/return`, which polls the payment until settled (30 s at most) and replaces itself. - 0029 architecture: End every payment on `/payment/result/[paymentId]`; the API's bank callback returns to `/payment/return`, which polls the payment until settled (30 s at most) and replaces itself.
- 0030 architecture: Keep the last checkout's period, invite code and bank payment in the persisted `session.checkout-draft` store from payment start until success, and restore them on the same creator's checkout. - 0030 architecture: Keep the last checkout's period, invite code and bank payment in the persisted `session.checkout-draft` store from payment start until success, and restore them on the same creator's checkout.
- 0031 design: List renew and reactivate periods as island `TierOption` cards, as checkout does, instead of R3's chip grid. - 0031 design: List renew and reactivate periods as island `TierOption` cards, as checkout does, instead of R3's chip grid.
- 0032 architecture: Serve the notification centre at `/notifications` on mobile and as a lazily loaded side panel from bear's header bell; opening it marks all read.
- 0033 architecture: Keep the payment sent to the bank in the checkout draft and settle it through `POST /subscriptions/payments/:id/abandon` only on the page that came back from the bank (bfcache or a history load), triggered by the app shell and awaited by checkout's screen read. - 0033 architecture: Keep the payment sent to the bank in the checkout draft and settle it through `POST /subscriptions/payments/:id/abandon` only on the page that came back from the bank (bfcache or a history load), triggered by the app shell and awaited by checkout's screen read.
- 0034 architecture: Serve the creator's داشبورد from `dashboard/(creator)` as `/dashboard/plans` (default), `/dashboard/predictions` and `/dashboard/finance`, and C7 at `/dashboard/pricing` in `(flow)`; the شبا form and ledger details open in place. - 0034 architecture: Serve the creator's داشبورد from `dashboard/(creator)` as `/dashboard/plans` (default), `/dashboard/predictions` and `/dashboard/finance`, and C7 at `/dashboard/pricing` in `(flow)`; the شبا form and ledger details open in place.
- 0035 design: Pick a promotion's Shamsi date and time with island `Select`s in a sheet or modal, not a drawn wheel. - 0035 design: Pick a promotion's Shamsi date and time with island `Select`s in a sheet or modal, not a drawn wheel.
- 0036 architecture: During the 7-day lock the save button reads «ذخیره تخفیف» and saves promotion changes; standing prices and period switches stay read-only. - 0036 architecture: Keep «ذخیره قیمت‌گذاری» live during the 7-day lock so promotion changes save; standing prices and period switches stay read-only.
- 0037 architecture: Open payout receipts from the API's session-authorized `/payouts/me/payouts/:id/receipt` through `/api`, not signed expiring URLs. - 0037 architecture: Open payout receipts from the API's session-authorized `/payouts/me/payouts/:id/receipt` through `/api`, not signed expiring URLs.
- 0039 design: Place toasts above whatever draws the bottom edge, declared by that part (nav 80, pinned footer 152, desktop 32, low in sheets). - 0039 design: Place toasts above whatever draws the bottom edge, declared by that part (nav 80, pinned footer 152, desktop 32, low in sheets).
- 0040 architecture: Render the connection bar under the sticky bars, inside their sticky box, never above or over content. - 0040 architecture: Render the connection bar under the sticky bars, inside their sticky box, never above or over content.
- 0041 architecture: Confirm sign-out, call `auth.logout`, then reload to the landing. - 0041 architecture: Confirm sign-out, call `auth.logout`, then reload to the landing.
- 0042 architecture: When a session ends mid-use, show the session-ended state and keep drafts; only an explicit sign-out clears drafts and `session.*` keys. - 0042 architecture: When a session ends mid-use, show the session-ended state and keep drafts; only an explicit sign-out clears drafts and `session.*` keys.
- 0043 architecture: Freeze every network action offline with island `useOfflineFreeze`, showing the reason. - 0043 architecture: Freeze every network action offline with island `useOfflineFreeze`, showing the reason.
- 0044 architecture: Keep an invite link's `?code=` per creator in the persisted checkout draft, applied by that creator's checkout; never put it in checkout's URL.
- 0045 architecture: The channel's server read carries the public follower count; the browser keeps it live and shows «مشترک فعال» only to the owner. - 0045 architecture: The channel's server read carries the public follower count; the browser keeps it live and shows «مشترک فعال» only to the owner.
- 0046 architecture: Serve `/account/profile` in `(flow)` for both roles, switching investor form and creator profile edit in the browser. - 0046 architecture: Serve `/account/profile` in `(flow)` for both roles, switching investor form and creator profile edit in the browser.
- 0047 architecture: The pwa lib keeps the browser's install offer; offer install at `/account/install` and once on bull's خانه with a 30-day snooze; the manifest starts at `/feed`. - 0047 architecture: The pwa lib keeps the browser's install offer; offer install at `/account/install` and once on bull's خانه with a 30-day snooze; the manifest starts at `/feed`.
- 0048 architecture: Composer routes check publish standing and render the locked state; every publish sends an Idempotency-Key stable while the body is unchanged.
- 0049 design: A page error keeps the page's own bar, derived from the path; route groups without a frame pass `standalone`. - 0049 design: A page error keeps the page's own bar, derived from the path; route groups without a frame pass `standalone`.
- 0050 design: A post being read shows an info toast when the reader's access ends mid-read (J05-4f), the one toast not tied to the reader's own action. - 0050 design: A post being read shows an info toast when the reader's access ends mid-read (J05-4f), the one toast not tied to the reader's own action.

View File

@ -5,7 +5,6 @@ import { useId, useState } from 'react';
import { Button } from '../../atoms/button'; import { Button } from '../../atoms/button';
import { FlexBox } from '../../atoms/flex-box'; import { FlexBox } from '../../atoms/flex-box';
import { Icon } from '../../atoms/icon'; import { Icon } from '../../atoms/icon';
import { LinkButton } from '../../atoms/link-button';
import { Typography } from '../../atoms/typography'; import { Typography } from '../../atoms/typography';
import { Element } from '../../primitives/element'; import { Element } from '../../primitives/element';
import { cn } from '../../tools/cn'; import { cn } from '../../tools/cn';
@ -17,9 +16,8 @@ import { codeInputButtonVariants } from './variants';
/** /**
* An invite code with its own «ثبت» (DS CodeInput): left to right, the button checks the code and * An invite code with its own «ثبت» (DS CodeInput): left to right, the button checks the code and
* so does Enter, which never submits the outer form. Checking locks the field with a spinner; * so does Enter, which never submits the outer form. Checking locks the field with a spinner;
* a valid code turns green and read-only, and the button becomes «تغییر». Given `onNoCode`, the * a valid code turns green and read-only, and the button becomes «تغییر». The status and every
* message row ends with «کد ندارم» while the code can still change. The status and every text come * text come from the caller.
* from the caller.
*/ */
export function CodeInput({ export function CodeInput({
label, label,
@ -32,7 +30,6 @@ export function CodeInput({
onCheck, onCheck,
onEdit, onEdit,
onBlur, onBlur,
onNoCode,
hint, hint,
message, message,
placeholder, placeholder,
@ -61,13 +58,6 @@ export function CodeInput({
? hint ? hint
: labels[status]); : labels[status]);
const showsNoCode =
onNoCode !== undefined &&
labels.noCode != null &&
!isValid &&
!isChecking &&
!isLocked;
const check = () => { const check = () => {
if (!isFixed && !frozen && code !== '') onCheck(code); if (!isFixed && !frozen && code !== '') onCheck(code);
}; };
@ -157,37 +147,16 @@ export function CodeInput({
) )
)} )}
</FlexBox> </FlexBox>
{(shown != null || showsNoCode) && ( {shown != null && (
<FlexBox
alignItems="items-start"
justifyContent="justify-between"
gap="gap-3"
>
{shown != null ? (
<Typography <Typography
tag="span" tag="span"
variant="caption" variant="caption"
id={messageId} id={messageId}
role={ role={isError ? 'alert' : status !== 'idle' ? 'status' : undefined}
isError ? 'alert' : status !== 'idle' ? 'status' : undefined
}
color={isError ? 'danger' : isValid ? 'success' : 'secondary'} color={isError ? 'danger' : isValid ? 'success' : 'secondary'}
> >
{shown} {shown}
</Typography> </Typography>
) : (
<Element tag="span" />
)}
{showsNoCode && (
<LinkButton
aria-haspopup="dialog"
onClick={onNoCode}
className="flex-none text-caption"
>
{labels.noCode}
</LinkButton>
)}
</FlexBox>
)} )}
</FlexBox> </FlexBox>
); );

View File

@ -33,8 +33,6 @@ export type CodeInputLabels = {
error?: ReactNode; error?: ReactNode;
/** Why a locked code can't change. */ /** Why a locked code can't change. */
locked?: ReactNode; locked?: ReactNode;
/** The link at the end of the message row that helps without a code: «کد ندارم». */
noCode?: ReactNode;
}; };
export type CodeInputProps = { export type CodeInputProps = {
@ -53,11 +51,6 @@ export type CodeInputProps = {
onEdit?: () => void; onEdit?: () => void;
/** Leaving the field, with the trimmed code, such as for a quiet check. */ /** Leaving the field, with the trimmed code, such as for a quiet check. */
onBlur?: (code: string) => void; onBlur?: (code: string) => void;
/**
* «کد ندارم» (`labels.noCode`) at the end of the message row, opening help as a dialog; shown
* while the code isn't valid, checking or locked. Leave it out for no link.
*/
onNoCode?: () => void;
/** Under the field while idle. */ /** Under the field while idle. */
hint?: ReactNode; hint?: ReactNode;
/** Replaces the status's text. */ /** Replaces the status's text. */

View File

@ -12,8 +12,8 @@ import { listRowIconVariants, listRowVariants } from './variants';
/** /**
* One row of a List (DS ListRow): a lead (avatar or a 40px icon tile), the title with an optional * One row of a List (DS ListRow): a lead (avatar or a 40px icon tile), the title with an optional
* subtitle and meta, an end column (an Amount, a StatusBadge, a caption) and a chevron for a link. * subtitle and meta, an end column (an Amount, a StatusBadge, a caption) and a chevron for a link.
* With `href` the whole row is a link (`external`: to another site, in a new tab), with `onClick` a * With `href` the whole row is a link, with `onClick` a button (such as one that opens a detail
* button (such as one that opens a detail sheet), otherwise a plain row. Renders its own `li`, so it always sits in a List. Every text * sheet), otherwise a plain row. Renders its own `li`, so it always sits in a List. Every text
* comes from the caller. * comes from the caller.
*/ */
export function ListRow(props: ListRowProps) { export function ListRow(props: ListRowProps) {
@ -134,21 +134,7 @@ export function ListRow(props: ListRowProps) {
); );
let row; let row;
if (props.href !== undefined && !disabled && props.external) { if (props.href !== undefined && !disabled) {
row = (
<FlexBox
tag="a"
href={props.href}
target="_blank"
rel="noopener noreferrer"
onClick={props.onClick}
{...layout}
className={classes}
>
{content}
</FlexBox>
);
} else if (props.href !== undefined && !disabled) {
row = ( row = (
<FlexBox <FlexBox
tag={NextLink} tag={NextLink}

View File

@ -64,18 +64,12 @@ type ListRowBaseProps = {
/** A link row: the whole row goes to `href`. */ /** A link row: the whole row goes to `href`. */
export type ListRowAsLinkProps = ListRowBaseProps & { export type ListRowAsLinkProps = ListRowBaseProps & {
href: string; href: string;
/**
* Another site, such as a creator's channel link: a plain `<a>` that opens in a new tab, with no
* opener or referrer, instead of the app's client navigation.
*/
external?: boolean;
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void; onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
}; };
/** A button row, such as one that opens a detail sheet; a plain row when `onClick` is absent too. */ /** A button row, such as one that opens a detail sheet; a plain row when `onClick` is absent too. */
export type ListRowAsButtonProps = ListRowBaseProps & { export type ListRowAsButtonProps = ListRowBaseProps & {
href?: undefined; href?: undefined;
external?: undefined;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void; onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
}; };

View File

@ -87,7 +87,6 @@ export function PostCard(props: PostCardProps) {
now={now} now={now}
premium={premium} premium={premium}
onClosePrediction={owner?.onClosePrediction} onClosePrediction={owner?.onClosePrediction}
pendingClose={owner?.pendingClose}
predictionLabels={predictionLabels} predictionLabels={predictionLabels}
labels={labels} labels={labels}
/> />

View File

@ -21,7 +21,6 @@ export function PostContent({
now, now,
premium, premium,
onClosePrediction, onClosePrediction,
pendingClose,
predictionLabels, predictionLabels,
labels, labels,
}: PostContentProps) { }: PostContentProps) {
@ -62,7 +61,6 @@ export function PostContent({
publishedAt={publishedAt} publishedAt={publishedAt}
now={now} now={now}
onClosePrediction={onClosePrediction} onClosePrediction={onClosePrediction}
pendingClose={pendingClose}
labels={predictionLabels} labels={predictionLabels}
className={EMBEDDED_PREDICTION_CLASS} className={EMBEDDED_PREDICTION_CLASS}
/> />

View File

@ -39,11 +39,6 @@ export type PostCardOwner = {
onPreview?: () => void; onPreview?: () => void;
/** The embedded open prediction's «بستن پیش‌بینی». */ /** The embedded open prediction's «بستن پیش‌بینی». */
onClosePrediction?: () => void; onClosePrediction?: () => void;
/**
* The embedded open prediction's close waiting for ops (J09-5): PredictionCard's `pendingClose`
* detail, which freezes «بستن پیش‌بینی».
*/
pendingClose?: ReactNode;
/** 15 minutes after publishing: the edit icon stays, frozen, and explains itself. */ /** 15 minutes after publishing: the edit icon stays, frozen, and explains itself. */
editFrozen?: boolean; editFrozen?: boolean;
/** Replaces `labels.owner.editFrozen` as the frozen edit's reason. */ /** Replaces `labels.owner.editFrozen` as the frozen edit's reason. */
@ -245,7 +240,6 @@ export type PostContentProps = Pick<
variant: 'compact' | 'expanded'; variant: 'compact' | 'expanded';
premium: boolean; premium: boolean;
onClosePrediction?: () => void; onClosePrediction?: () => void;
pendingClose?: ReactNode;
}; };
export type PostLockedProps = Pick< export type PostLockedProps = Pick<

View File

@ -28,7 +28,6 @@ export function PredictionCard(props: PredictionCardProps) {
publishedAt, publishedAt,
now, now,
onClosePrediction, onClosePrediction,
pendingClose,
preview = false, preview = false,
labels, labels,
className, className,
@ -66,7 +65,6 @@ export function PredictionCard(props: PredictionCardProps) {
) : ( ) : (
<PredictionBody <PredictionBody
prediction={props.prediction} prediction={props.prediction}
pendingClose={preview ? undefined : pendingClose}
href={href} href={href}
expanded={expanded} expanded={expanded}
premium={showPremium} premium={showPremium}
@ -86,10 +84,6 @@ export function PredictionCard(props: PredictionCardProps) {
variant="secondary" variant="secondary"
icon="flag" icon="flag"
onClick={onClosePrediction} onClick={onClosePrediction}
// An automatic close is waiting for ops (J10-3f).
frozen={pendingClose != null}
frozenReason={labels.closeFrozen}
frozenAlign="end"
// Above a PostCard's stretched link. // Above a PostCard's stretched link.
className="relative ms-auto" className="relative ms-auto"
> >

View File

@ -1,27 +0,0 @@
import { FlexBox } from '../../../atoms/flex-box';
import { Icon } from '../../../atoms/icon';
import { Typography } from '../../../atoms/typography';
import type { PendingCloseRowProps } from '../types';
/**
* The owner's open card whose automatic close waits for ops (J09-5, J10-3f): a warning row under
* the head, a clock, «در انتظار تأیید بسته‌شدن» in bold, then what triggered it, at what price and
* when. Investors see the card as open until ops confirm.
*/
export function PendingCloseRow({ title, children }: PendingCloseRowProps) {
return (
<FlexBox
alignItems="items-start"
className="gap-1.5 rounded-md bg-warning-subtle px-2.5 py-2 text-warning-text"
>
<Icon name="clock" size={16} className="mt-0.5 flex-none" />
<Typography tag="p" variant="caption" color="inherit">
<Typography tag="strong" variant="inherit" className="font-semibold">
{title}
</Typography>
{' · '}
{children}
</Typography>
</FlexBox>
);
}

View File

@ -15,13 +15,11 @@ import { PredictionHead } from './PredictionHead';
import { PredictionLadder } from './PredictionLadder'; import { PredictionLadder } from './PredictionLadder';
import { PredictionLevels } from './PredictionLevels'; import { PredictionLevels } from './PredictionLevels';
import { PredictionMeta } from './PredictionMeta'; import { PredictionMeta } from './PredictionMeta';
import { PendingCloseRow } from './PendingCloseRow';
import { PredictionRange } from './PredictionRange'; import { PredictionRange } from './PredictionRange';
/** Header, hero, range bar, then the levels (compact) or the ladder, progress and caption (expanded). */ /** Header, hero, range bar, then the levels (compact) or the ladder, progress and caption (expanded). */
export function PredictionBody({ export function PredictionBody({
prediction: data, prediction: data,
pendingClose,
href, href,
expanded, expanded,
premium, premium,
@ -76,11 +74,6 @@ export function PredictionBody({
/> />
} }
/> />
{isOpen && pendingClose != null && labels.pendingClose != null && (
<PendingCloseRow title={labels.pendingClose}>
{pendingClose}
</PendingCloseRow>
)}
{!isOpen && math.roi != null ? ( {!isOpen && math.roi != null ? (
<ClosedHero <ClosedHero
{...part} {...part}

View File

@ -138,13 +138,6 @@ export type PredictionCardLabels = {
immutable: ReactNode; immutable: ReactNode;
/** The owner's «بستن زودهنگام». */ /** The owner's «بستن زودهنگام». */
closePrediction?: ReactNode; closePrediction?: ReactNode;
/** The owner's pending-close row title, in bold: «در انتظار تأیید بسته‌شدن» (J09-5). */
pendingClose?: ReactNode;
/**
* Why «بستن زودهنگام» is frozen while a close waits for ops: «این پیش‌بینی به‌زودی به‌صورت خودکار
* بسته می‌شود.» (J10-3f).
*/
closeFrozen?: ReactNode;
/** /**
* A closed card's reason row: «علت: رسیدن به هدف | منبع قیمت: TGJU». Without it the row never * A closed card's reason row: «علت: رسیدن به هدف | منبع قیمت: TGJU». Without it the row never
* shows, even when the prediction has a reason or a source. * shows, even when the prediction has a reason or a source.
@ -206,12 +199,6 @@ type PredictionCardOwnProps = {
* in a preview. * in a preview.
*/ */
onClosePrediction?: () => void; onClosePrediction?: () => void;
/**
* The owner's open card whose automatic close waits for ops (J09-5, J10-3f): the detail after
* `labels.pendingClose`, such as «هدف ۱ زده شد · ۲٬۶۰۰ · ۱۰ مهر، ۰۷:۴۲», in a warning row under
* the head; «بستن زودهنگام» is frozen with `labels.closeFrozen`. Never pass it to anyone else.
*/
pendingClose?: ReactNode;
/** /**
* The composer's confirm step (J09-3): the seal says «پیش‌نمایش | پس از انتشار، غیرقابل ویرایش و * The composer's confirm step (J09-3): the seal says «پیش‌نمایش | پس از انتشار، غیرقابل ویرایش و
* حذف» instead of the publish time. Pass the time it would publish (now) as `publishedAt`. * حذف» instead of the publish time. Pass the time it would publish (now) as `publishedAt`.
@ -373,17 +360,8 @@ export type LockedBodyProps = {
labels: PredictionCardLabels; labels: PredictionCardLabels;
}; };
export type PendingCloseRowProps = {
/** «در انتظار تأیید بسته‌شدن». */
title: ReactNode;
/** What triggered it, at what price and when. */
children: ReactNode;
};
export type PredictionBodyProps = { export type PredictionBodyProps = {
prediction: PredictionData; prediction: PredictionData;
/** The owner's pending close detail, on an open card only. */
pendingClose?: ReactNode;
href?: string; href?: string;
expanded: boolean; expanded: boolean;
/** Already false when embedded. */ /** Already false when embedded. */

View File

@ -39,8 +39,7 @@ function displayDate(value: ReactNode): ReactNode {
* card, so a status always looks and acts the same. The status picks the badge and the action, * card, so a status always looks and acts the same. The status picks the badge and the action,
* the days left pick the time line. An active card with `href` opens the channel through its * the days left pick the time line. An active card with `href` opens the channel through its
* name, stretched over the card, while «تمدید» keeps its own tap. A suspended card dims all but * name, stretched over the card, while «تمدید» keeps its own tap. A suspended card dims all but
* support and terms, and does nothing on tap. In the history, only the latest expired row with each * support and terms, and does nothing on tap.
* analyst offers «فعال‌سازی مجدد»; older rows link to the channel.
*/ */
export function SubscriptionCard({ export function SubscriptionCard({
status, status,
@ -53,7 +52,6 @@ export function SubscriptionCard({
daysLeft, daysLeft,
analystSuspended = false, analystSuspended = false,
density = 'full', density = 'full',
latest = false,
href, href,
onRenew, onRenew,
onReactivate, onReactivate,
@ -269,13 +267,6 @@ export function SubscriptionCard({
</Button> </Button>
</Element> </Element>
)} )}
{isCompact && latest && status === 'expired' && !analystSuspended && (
<Element className="mt-3">
<Button variant="secondary" size="sm" block onClick={onReactivate}>
{labels.reactivate}
</Button>
</Element>
)}
{/* The refund right has no deadline, so support outlives the subscription. */} {/* The refund right has no deadline, so support outlives the subscription. */}
{status === 'expired' && analystSuspended && ( {status === 'expired' && analystSuspended && (

View File

@ -85,12 +85,6 @@ export type SubscriptionCardProps = {
analystSuspended?: boolean; analystSuspended?: boolean;
/** `compact`: the history and secondary row, header only, with the date range under the name. */ /** `compact`: the history and secondary row, header only, with the date range under the name. */
density?: 'full' | 'compact'; density?: 'full' | 'compact';
/**
* Compact and expired: the latest period with this analyst, so it offers «فعال‌سازی مجدد» (a
* small secondary button); older rows only link to the channel. Not while the analyst is
* suspended.
*/
latest?: boolean;
/** The analyst's channel: links the name, and makes an active card open it (not a suspended one). */ /** The analyst's channel: links the name, and makes an active card open it (not a suspended one). */
href?: string; href?: string;
/** Active: «تمدید», which opens the renewal sheet. */ /** Active: «تمدید», which opens the renewal sheet. */

View File

@ -11,14 +11,12 @@ import { NetworkBoundary } from './components/NetworkBoundary';
import { usePwa } from './hooks/use-pwa'; import { usePwa } from './hooks/use-pwa';
import { useSession } from './hooks/use-session'; import { useSession } from './hooks/use-session';
import { useSettleAbandonedPayment } from './hooks/use-settle-abandoned-payment'; import { useSettleAbandonedPayment } from './hooks/use-settle-abandoned-payment';
import { useSuspendedHalt } from './hooks/use-suspended-halt';
import type { AppShellProps } from './types'; import type { AppShellProps } from './types';
/** /**
* The provider shell shared by bull and bear: the query client, i18n, the connection bar (drawn * The provider shell shared by bull and bear: the query client, i18n, the connection bar (drawn
* under each page's top bar or header by `NetworkBar`), the one toast region, and the viewer's * under each page's top bar or header by `NetworkBar`), the one toast region, and the viewer's
* session (read once per load in the browser), which halts on the suspended screen when the * session (read once per load in the browser). The app's root client component renders it after
* account is suspended mid-session (J01-3d). The app's root client component renders it after
* running the client bootstrap. * running the client bootstrap.
* *
* The toasts sit above whatever the screen declares with island's `useToastPlacement`: the bottom * The toasts sit above whatever the screen declares with island's `useToastPlacement`: the bottom
@ -27,7 +25,6 @@ import type { AppShellProps } from './types';
*/ */
export function AppShell({ queryClient, i18n, children }: AppShellProps) { export function AppShell({ queryClient, i18n, children }: AppShellProps) {
useSession(queryClient); useSession(queryClient);
useSuspendedHalt();
useSettleAbandonedPayment(queryClient); useSettleAbandonedPayment(queryClient);
usePwa(); usePwa();
// Persisted stores wait for the first browser render, so it matches the server's. // Persisted stores wait for the first browser render, so it matches the server's.

View File

@ -14,8 +14,8 @@ import { usePostDraftStore } from '../../../stores/post-draft';
* skeleton until then. A read that failed offline or on a gateway error leaves the viewer unknown, * skeleton until then. A read that failed offline or on a gateway error leaves the viewer unknown,
* so it runs again when the connection comes back. When the session ends (sign-out, or a refresh * so it runs again when the connection comes back. When the session ends (sign-out, or a refresh
* that failed), the store goes back to guest and every cached query is dropped: it belonged to the * that failed), the store goes back to guest and every cached query is dropped: it belonged to the
* old account. A sign-out, or a suspension mid-session (J01-3d), also drops what the account kept * old account. A sign-out also drops what the account kept on the device (`session.` keys); a
* on the device (`session.` keys); a session that ran out keeps its drafts for the next sign-in. * session that ran out keeps its drafts for the next sign-in.
*/ */
export function useSession(queryClient: QueryClient): void { export function useSession(queryClient: QueryClient): void {
useEffect(() => { useEffect(() => {
@ -33,7 +33,7 @@ export function useSession(queryClient: QueryClient): void {
queryClient.clear(); queryClient.clear();
// A session that ran out keeps the drafts: the person signs in again and carries on (G-4f). // A session that ran out keeps the drafts: the person signs in again and carries on (G-4f).
if (reason === 'session-ended') return; if (reason === 'session-ended') return;
// Signing out (or a suspension) takes the account's own drafts and choices off the device. The stores go // Signing out takes the account's own drafts and choices off the device. The stores go
// first: a persisted store writes its key again on every change. // first: a persisted store writes its key again on every change.
usePostDraftStore.getState().clearDraft(); usePostDraftStore.getState().clearDraft();
useCheckoutDraftStore.getState().clearDraft(); useCheckoutDraftStore.getState().clearDraft();

View File

@ -1,22 +0,0 @@
import { eventEmitter } from '@lumina/libs/event-emitter';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { AUTH_EVENTS } from '../../../features/auth';
import { ROUTES } from '../../navigation';
/**
* A session that ends because the account was suspended while in use (J01-3d) replaces the page
* with the halt: the suspended screen, with the brand bar and support only, no nav, no back and no
* bell. `useSession` has already cleared the session, the cached reads and the drafts.
*/
export function useSuspendedHalt(): void {
const router = useRouter();
useEffect(
() =>
eventEmitter.on(AUTH_EVENTS.logout, ({ reason }) => {
if (reason === 'suspended') router.replace(ROUTES.loginSuspended);
}),
[router],
);
}

View File

@ -34,7 +34,6 @@ export function ErrorFallback({
title, title,
description, description,
framed = false, framed = false,
stateSize = 'section',
children, children,
}: ErrorFallbackProps) { }: ErrorFallbackProps) {
const { t } = useTranslation('errors'); const { t } = useTranslation('errors');
@ -83,7 +82,7 @@ export function ErrorFallback({
return frame( return frame(
<ErrorState <ErrorState
kind={kind} kind={kind}
size={size === 'part' ? stateSize : 'page'} size={size === 'part' ? 'section' : 'page'}
headingRef={headingRef} headingRef={headingRef}
title={own.title ?? t(`fallback.${kind}.title`)} title={own.title ?? t(`fallback.${kind}.title`)}
description={own.description ?? t(`fallback.${kind}.description`)} description={own.description ?? t(`fallback.${kind}.description`)}

View File

@ -27,12 +27,6 @@ export type ErrorFallbackProps = {
description?: string; description?: string;
/** Sits in a Card, where the board draws the part's error as a card (S3-03, U8 ۴.۵). */ /** Sits in a Card, where the board draws the part's error as a card (S3-03, U8 ۴.۵). */
framed?: boolean; framed?: boolean;
/**
* A part whose board draws its error page-size, such as a dashboard tab's list (J07-1, J07-3):
* the ErrorState is `size="page"`, while the part still reports as a part and keeps focus where
* it is. `section` by default.
*/
stateSize?: 'section' | 'page';
/** The way out after retry: «بازگشت به خانه», or «تماس با پشتیبانی» after a second failure. */ /** The way out after retry: «بازگشت به خانه», or «تماس با پشتیبانی» after a second failure. */
children?: ReactNode; children?: ReactNode;
}; };

View File

@ -8,7 +8,7 @@ import { ErrorFallback } from '../error-fallback';
import type { PartBoundaryProps } from './types'; import type { PartBoundaryProps } from './types';
function PartFallback( function PartFallback(
{ name, title, description, framed, size }: PartBoundaryProps, { name, title, description, framed }: PartBoundaryProps,
{ error, retry, reset }: ErrorInfo, { error, retry, reset }: ErrorInfo,
) { ) {
const queryErrors = useQueryErrorResetBoundary(); const queryErrors = useQueryErrorResetBoundary();
@ -24,7 +24,6 @@ function PartFallback(
title={title} title={title}
description={description} description={description}
framed={framed} framed={framed}
stateSize={size}
onRetry={() => { onRetry={() => {
queryErrors.reset(); queryErrors.reset();
if (isServerError) retry(); if (isServerError) retry();

View File

@ -9,9 +9,4 @@ export type PartBoundaryProps = {
description?: string; description?: string;
/** The fallback sits in a Card, where the board draws the part's error as a card (S3-03). */ /** The fallback sits in a Card, where the board draws the part's error as a card (S3-03). */
framed?: boolean; framed?: boolean;
/**
* `page`: the board draws this part's error page-size, such as a dashboard tab's list (J07-1,
* J07-3). `section` by default.
*/
size?: 'section' | 'page';
}; };

View File

@ -4,7 +4,6 @@ import { useRouter } from 'next/navigation';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useCurrentAccount, useViewerStatus } from '../../../stores/auth'; import { useCurrentAccount, useViewerStatus } from '../../../stores/auth';
import { useAuthFlowStore } from '../../../stores/auth-flow';
import { StatusEmptyState } from '../../error-boundaries'; import { StatusEmptyState } from '../../error-boundaries';
import { loginRoute } from '../../navigation'; import { loginRoute } from '../../navigation';
import { SessionEnded } from './components/SessionEnded'; import { SessionEnded } from './components/SessionEnded';
@ -25,16 +24,12 @@ export function AuthGuard({ fallback, role, children }: AuthGuardProps) {
const router = useRouter(); const router = useRouter();
const endedHere = useSessionEnded(status); const endedHere = useSessionEnded(status);
const showsEnded = status === 'guest' && endedHere !== null; const showsEnded = status === 'guest' && endedHere !== null;
// A suspension mid-session goes to the halt screen (J01-3d), not to login.
const isHalted = useAuthFlowStore(
(state) => state.suspension?.midSession === true,
);
useEffect(() => { useEffect(() => {
if (status !== 'guest' || showsEnded || isHalted) return; if (status !== 'guest' || showsEnded) return;
const { pathname, search } = window.location; const { pathname, search } = window.location;
router.replace(loginRoute(`${pathname}${search}`)); router.replace(loginRoute(`${pathname}${search}`));
}, [status, showsEnded, isHalted, router]); }, [status, showsEnded, router]);
if (showsEnded) return <SessionEnded returnTo={endedHere} />; if (showsEnded) return <SessionEnded returnTo={endedHere} />;
if (status !== 'member' || !account) return fallback; if (status !== 'member' || !account) return fallback;

View File

@ -9,7 +9,6 @@ import type { ActionMenuItem } from '@lumina/island/molecules/action-menu';
import { useState } from 'react'; import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { PAYOUT_ACCOUNT_ANCHOR } from '../../../../features/finance';
import { SignOutConfirm } from '../../../screens/organisms/sign-out-confirm'; import { SignOutConfirm } from '../../../screens/organisms/sign-out-confirm';
import { useIsStandalone } from '../../hooks/use-is-standalone'; import { useIsStandalone } from '../../hooks/use-is-standalone';
import { ROUTES } from '../../navigation'; import { ROUTES } from '../../navigation';
@ -18,7 +17,7 @@ import type { AccountMenuProps } from './types';
/** /**
* The desktop header's avatar (J12-1c): it opens the account menu under it. Its header says whose * The desktop header's avatar (J12-1c): it opens the account menu under it. Its header says whose
* account it is (the avatar, the member's own name and `@username`), then حساب کاربری, اطلاعات * account it is (the avatar, the member's own name and `@username`), then حساب کاربری, اطلاعات
* کاربری, a creator's «اطلاعات تسویه‌حساب» (J12-1e, the شبا on مالی), تنظیمات اعلان‌ها and نصب اپلیکیشن (hidden in the installed app), and after a separator * کاربری, تنظیمات اعلان‌ها and نصب اپلیکیشن (hidden in the installed app), and after a separator
* «خروج از حساب» in red, which asks first (J12-1d). Mobile links the avatar to حساب کاربری instead. * «خروج از حساب» in red, which asks first (J12-1d). Mobile links the avatar to حساب کاربری instead.
*/ */
export function AccountMenu({ account }: AccountMenuProps) { export function AccountMenu({ account }: AccountMenuProps) {
@ -41,15 +40,6 @@ export function AccountMenu({ account }: AccountMenuProps) {
icon: 'edit', icon: 'edit',
label: t('account-menu.profile'), label: t('account-menu.profile'),
}, },
...(account.role === 'creator'
? [
{
href: `${ROUTES.dashboard.finance}#${PAYOUT_ACCOUNT_ANCHOR}`,
icon: 'wallet',
label: t('account-menu.payout'),
} as const,
]
: []),
{ {
href: ROUTES.account.notifications, href: ROUTES.account.notifications,
icon: 'bell', icon: 'bell',

View File

@ -1,5 +1,3 @@
import type { UserRole } from '../../../../features/auth';
export type AccountMenuProps = { export type AccountMenuProps = {
/** The signed-in member's account. */ /** The signed-in member's account. */
account: { account: {
@ -7,7 +5,5 @@ export type AccountMenuProps = {
firstName: string; firstName: string;
lastName: string; lastName: string;
avatarUrl: string | null; avatarUrl: string | null;
/** A creator's menu adds «اطلاعات تسویه‌حساب» (J12-1e). */
role: UserRole;
}; };
}; };

View File

@ -4,13 +4,11 @@ import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { ActionMenu } from '@lumina/island/molecules/action-menu'; import { ActionMenu } from '@lumina/island/molecules/action-menu';
import { Element } from '@lumina/island/primitives/element'; import { Element } from '@lumina/island/primitives/element';
import { useRouter, useSearchParams } from 'next/navigation'; import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useCreatorStanding } from '../../../../features/profile'; import { useCreatorStanding } from '../../../../features/profile';
import { useCurrentAccount } from '../../../../stores/auth'; import { useCurrentAccount } from '../../../../stores/auth';
import { LOCKED_PARAM } from '../../constants';
import { ROUTES } from '../../navigation'; import { ROUTES } from '../../navigation';
import { BlockedPublishDialog } from './components/BlockedPublishDialog'; import { BlockedPublishDialog } from './components/BlockedPublishDialog';
import type { BlockedStanding, PublishMenuProps } from './types'; import type { BlockedStanding, PublishMenuProps } from './types';
@ -22,9 +20,7 @@ const isBlocked = (standing: string): standing is BlockedStanding =>
* «انتشار» (C4 ۱.۱, ۱.۲, ۷.۱): a verified creator gets the menu, «پست جدید» or «پیش‌بینی جدید». A * «انتشار» (C4 ۱.۱, ۱.۲, ۷.۱): a verified creator gets the menu, «پست جدید» or «پیش‌بینی جدید». A
* creator who can't publish sees it frozen, and a press explains why instead of a tooltip. On * creator who can't publish sees it frozen, and a press explains why instead of a tooltip. On
* mobile the open menu sits centred over the nav, on a light scrim that dims the page down to the * mobile the open menu sits centred over the nav, on a light scrim that dims the page down to the
* nav; a press on the scrim closes it, and the FAB turns into an icon-only ✕ «بستن» (J08-1b). A * nav; a press on the scrim closes it, and the FAB turns into an icon-only ✕ «بستن» (J08-1b).
* composer the creator may not use sends them to their channel with `?locked=`: the why opens at
* once there, and the parameter goes (0060).
*/ */
export function PublishMenu({ placement }: PublishMenuProps) { export function PublishMenu({ placement }: PublishMenuProps) {
const { t } = useTranslation(); const { t } = useTranslation();
@ -33,26 +29,6 @@ export function PublishMenu({ placement }: PublishMenuProps) {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [isExplaining, setIsExplaining] = useState(false); const [isExplaining, setIsExplaining] = useState(false);
const blocked = isBlocked(standing) ? standing : null; const blocked = isBlocked(standing) ? standing : null;
const router = useRouter();
const lockedBy = useSearchParams().get(LOCKED_PARAM);
const [shownLock, setShownLock] = useState<string | null>(null);
// Opened once per arrival, while rendering: no extra pass through an effect.
if (lockedBy && blocked && shownLock !== lockedBy) {
setShownLock(lockedBy);
setIsExplaining(true);
}
if (!lockedBy && shownLock) setShownLock(null);
useEffect(() => {
if (!lockedBy || standing === 'unknown') return;
// Shown once: a reload or a shared link doesn't open it again.
const params = new URLSearchParams(window.location.search);
params.delete(LOCKED_PARAM);
const query = params.toString();
router.replace(`${window.location.pathname}${query ? `?${query}` : ''}`, {
scroll: false,
});
}, [lockedBy, standing, router]);
// J08-1b-M: the open FAB is just the ✕, named «بستن»; desktop keeps «انتشار» beside it. // J08-1b-M: the open FAB is just the ✕, named «بستن»; desktop keeps «انتشار» beside it.
const isClosingFab = placement === 'nav' && isOpen; const isClosingFab = placement === 'nav' && isOpen;

View File

@ -4,12 +4,6 @@ export const CHANNEL_PREFIX = '/@';
/** The App Router's own path for a channel, which `/@username` is rewritten onto. */ /** The App Router's own path for a channel, which `/@username` is rewritten onto. */
export const CHANNEL_ROUTE_PREFIX = '/channels/'; export const CHANNEL_ROUTE_PREFIX = '/channels/';
/**
* `?locked=post|prediction` on a creator's own channel: a composer they may not use sent them here,
* and «انتشار» explains why at once; the parameter is removed once shown (0060).
*/
export const LOCKED_PARAM = 'locked';
/** `?preview=visitor|subscriber`: the creator's preview of their own post as others see it (C5 §6). */ /** `?preview=visitor|subscriber`: the creator's preview of their own post as others see it (C5 §6). */
export const PREVIEW_PARAM = 'preview'; export const PREVIEW_PARAM = 'preview';

View File

@ -72,11 +72,7 @@ export const ROUTES = {
creatorProfileDone: '/onboarding/creator-profile/done', creatorProfileDone: '/onboarding/creator-profile/done',
investorProfile: '/onboarding/investor-profile', investorProfile: '/onboarding/investor-profile',
}, },
/** «قوانین لومینا» (G-2r): «قوانین عمومی» and «شرایط اشتراک», one tab each. */ terms: '/terms/subscription',
rules: {
general: '/terms',
subscription: '/terms/subscription',
},
} as const; } as const;
/** `/auth/login?redirect=…`: auth returns to the page that asked for it. */ /** `/auth/login?redirect=…`: auth returns to the page that asked for it. */

View File

@ -36,7 +36,6 @@ export function LoginStep({ size, supportPlacement }: LoginStepProps) {
} = useLoginPage({ } = useLoginPage({
codeHref: routes.loginVerify, codeHref: routes.loginVerify,
registerHref: routes.register.type, registerHref: routes.register.type,
resumeHref: routes.register.verify,
subscribeTo: routes.subscribeTo, subscribeTo: routes.subscribeTo,
}); });

View File

@ -1,25 +1,21 @@
'use client'; 'use client';
import { Button } from '@lumina/island/atoms/button'; import { FlexBox } from '@lumina/island/atoms/flex-box';
import { StateArt } from '@lumina/island/atoms/state-art';
import { Typography } from '@lumina/island/atoms/typography'; import { Typography } from '@lumina/island/atoms/typography';
import { PinnedFooter } from '@lumina/island/molecules/pinned-footer';
import { ResultPanel } from '@lumina/island/molecules/result-panel';
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLoginSuspendedPage } from '../../../../../../../../features/auth'; import { useLoginSuspendedPage } from '../../../../../../../../features/auth';
import { ROUTES, useAuthRoutes } from '../../../../../../../navigation'; import { useAuthRoutes } from '../../../../../../../navigation';
import { SupportEntry } from '../../../../../../organisms/support-entry'; import { SupportEntry } from '../../../../../../organisms/support-entry';
import type { LoginSuspendedStepProps } from './types'; import type { LoginSuspendedStepProps } from './types';
/** /**
* A suspended account (J01-3, J01-3c), after a valid login code or mid-session (J01-3d): no * A valid code for a suspended account (S6 1.11, 2.1, 3.1): no session, nothing else reachable,
* session and nothing else reachable, only support and the landing. Amber, because a suspension is * one way out to support. Amber, because a suspension is a state, not an error. The admin's reason
* a state, not an error. A creator sees the admin's reason when there is one and that an SMS * shows when there is one. Focus starts on the heading, as the page replaces the code step.
* follows the lift; an investor sees neither, and mid-session learns they were signed out. Mobile
* pins both buttons to the bottom; desktop keeps them in the card. Focus starts on the heading,
* as the screen replaces the one before.
*/ */
export function LoginSuspendedStep({ export function LoginSuspendedStep({
size, size,
@ -37,43 +33,42 @@ export function LoginSuspendedStep({
// The page's own skeleton, while a reload goes back to login. // The page's own skeleton, while a reload goes back to login.
return <SkeletonPreset preset="state" label={t('loading')} />; return <SkeletonPreset preset="state" label={t('loading')} />;
} }
const isCreator = suspension.role === 'creator';
const body =
isCreator && suspension.reason
? t('suspended.reason', { reason: suspension.reason })
: !isCreator && suspension.midSession
? t('suspended.mid-session')
: t('suspended.description');
const actions = (
<>
<SupportEntry trigger="button" placement={supportPlacement} size={size} />
<Button variant="secondary" size={size} block href={ROUTES.landing}>
{t('suspended.home')}
</Button>
</>
);
return ( return (
<> <FlexBox
<ResultPanel direction="flex-col"
tone="warning" alignItems="items-center"
icon="ban" gap="gap-4"
title={t('suspended.title')} className={
titleRef={headingRef} layout === 'mobile' ? 'flex-1 pt-6 text-center' : 'pt-6 text-center'
body={body} }
actions={layout === 'desktop' ? actions : undefined}
className={layout === 'mobile' ? 'flex-1 justify-center' : undefined}
> >
{isCreator && ( <StateArt icon="ban" tone="warning" />
<Typography variant="caption" color="secondary"> <FlexBox direction="flex-col" alignItems="items-center" gap="gap-2">
{t('suspended.sms-note')} <Typography
ref={headingRef}
tabIndex={-1}
tag="h1"
variant="heading-md"
className="outline-none"
>
{t('suspended.title')}
</Typography> </Typography>
)} <Typography color="secondary">
</ResultPanel> {suspension.reason
{layout === 'mobile' && ( ? t('suspended.reason', { reason: suspension.reason })
// Edge to edge under the auth column's 16px sides and bottom padding. : t('suspended.description')}
<PinnedFooter className="-mx-4 -mb-5">{actions}</PinnedFooter> </Typography>
)} </FlexBox>
</> <FlexBox
direction="flex-col"
className={layout === 'mobile' ? 'mt-auto w-full' : 'mt-2 w-full'}
>
<SupportEntry
trigger="button"
placement={supportPlacement}
size={size}
/>
</FlexBox>
</FlexBox>
); );
} }

View File

@ -4,6 +4,6 @@ export type LoginSuspendedStepProps = {
/** `lg` on mobile, `md` on desktop. */ /** `lg` on mobile, `md` on desktop. */
size: 'md' | 'lg'; size: 'md' | 'lg';
supportPlacement: SupportEntryProps['placement']; supportPlacement: SupportEntryProps['placement'];
/** Mobile pins both buttons to the bottom; desktop keeps them in the card. */ /** Mobile pins «تماس با پشتیبانی» to the bottom; desktop keeps it in the card. */
layout: 'mobile' | 'desktop'; layout: 'mobile' | 'desktop';
}; };

View File

@ -11,8 +11,7 @@ import type { RegisterDetailsStepProps } from './types';
/** /**
* Registration step 4, on the 15-minute token: account details for an investor, identity for a * Registration step 4, on the 15-minute token: account details for an investor, identity for a
* creator. Back never returns to the used code step: it asks whether to leave and resume later * creator. There is no back: the code is used. Without a token (after a reload) it waits in its
* (J02-3f). Without a token (after a reload) it waits in its
* skeleton while the page sends the person back to the number. * skeleton while the page sends the person back to the number.
*/ */
export function RegisterDetailsStep(props: RegisterDetailsStepProps) { export function RegisterDetailsStep(props: RegisterDetailsStepProps) {

View File

@ -9,17 +9,20 @@ import { Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useCreatorIdentityPart } from '../../../../../../../../../features/auth'; import { useCreatorIdentityPart } from '../../../../../../../../../features/auth';
import type { IdCardSide } from '../../../../../../../../../features/auth';
import { translateMessage } from '../../../../../../../../../shared/utils'; import { translateMessage } from '../../../../../../../../../shared/utils';
import { import { ID_CARD_IMAGE } from '../../../../../../../../../shared/validations';
ID_CARD_IMAGE,
ID_CARD_SIDES,
} from '../../../../../../../../../shared/validations';
import type { DetailsFormProps } from '../types'; import type { DetailsFormProps } from '../types';
import { DetailsFrame } from './DetailsFrame'; import { DetailsFrame } from './DetailsFrame';
import { NameFields } from './NameFields'; import { NameFields } from './NameFields';
import { TermsLine } from './TermsLine'; import { TermsLine } from './TermsLine';
import { UsernameField } from './UsernameField'; import { UsernameField } from './UsernameField';
const ID_CARD_SIDES = [
{ side: 'idCardFront', label: 'id-card-front' },
{ side: 'idCardBack', label: 'id-card-back' },
] as const satisfies readonly { side: IdCardSide; label: string }[];
const BYTES_PER_MB = 1024 * 1024; const BYTES_PER_MB = 1024 * 1024;
/** /**
@ -38,7 +41,6 @@ export function CreatorIdentityForm(props: DetailsFormProps) {
pickImage, pickImage,
progress, progress,
draft, draft,
leave,
} = useCreatorIdentityPart(props.partOptions); } = useCreatorIdentityPart(props.partOptions);
return ( return (
@ -48,7 +50,6 @@ export function CreatorIdentityForm(props: DetailsFormProps) {
description={t('register.identity.description')} description={t('register.identity.description')}
formError={formError} formError={formError}
draft={draft} draft={draft}
leave={leave}
onSubmit={() => void submit()} onSubmit={() => void submit()}
footer={ footer={
<> <>
@ -61,11 +62,7 @@ export function CreatorIdentityForm(props: DetailsFormProps) {
> >
{t('register.identity.submit')} {t('register.identity.submit')}
</Button> </Button>
<TermsLine <TermsLine before={t('register.identity.terms-before')} />
before={t('register.identity.terms-before')}
rules={props.rules}
placement={props.haltPlacement}
/>
</> </>
} }
> >

View File

@ -11,12 +11,10 @@ import { RegisterProgress } from '../../../../../../../organisms/register-progre
import type { DetailsFrameProps } from '../types'; import type { DetailsFrameProps } from '../types';
import { ExpiryHalt } from './ExpiryHalt'; import { ExpiryHalt } from './ExpiryHalt';
import { ExpiryWarning } from './ExpiryWarning'; import { ExpiryWarning } from './ExpiryWarning';
import { LeaveRegistrationDialog } from './LeaveRegistrationDialog';
/** /**
* What both account types' step 4 share: the token's warning and halt, the server-failure banner, * What both account types' step 4 share: the token's warning and halt, the server-failure banner,
* the step bar and heading, the form with its submit under the fields, support, and the dialog * the step bar and heading, the form with its submit under the fields, and support.
* that back and links open (J02-3f).
*/ */
export function DetailsFrame({ export function DetailsFrame({
page, page,
@ -25,7 +23,6 @@ export function DetailsFrame({
formError, formError,
footer, footer,
draft, draft,
leave,
onSubmit, onSubmit,
supportPlacement, supportPlacement,
haltPlacement, haltPlacement,
@ -72,12 +69,6 @@ export function DetailsFrame({
<FlexBox justifyContent="justify-center" className="mt-auto"> <FlexBox justifyContent="justify-center" className="mt-auto">
<SupportEntry trigger="link" placement={supportPlacement} /> <SupportEntry trigger="link" placement={supportPlacement} />
</FlexBox> </FlexBox>
<LeaveRegistrationDialog
placement={haltPlacement}
open={leave.isLeaveOpen && page.phase !== 'expired'}
onStay={leave.stay}
onLeave={leave.leave}
/>
{page.phase === 'expired' && ( {page.phase === 'expired' && (
<ExpiryHalt <ExpiryHalt
placement={haltPlacement} placement={haltPlacement}

View File

@ -13,7 +13,7 @@ import { UsernameField } from './UsernameField';
/** Step 4 for an investor: name, last name and username, then «ساخت حساب». */ /** Step 4 for an investor: name, last name and username, then «ساخت حساب». */
export function InvestorDetailsForm(props: DetailsFormProps) { export function InvestorDetailsForm(props: DetailsFormProps) {
const { t } = useTranslation('auth'); const { t } = useTranslation('auth');
const { form, submit, isSubmitting, formError, username, draft, leave } = const { form, submit, isSubmitting, formError, username, draft } =
useInvestorDetailsPart(props.partOptions); useInvestorDetailsPart(props.partOptions);
return ( return (
@ -23,7 +23,6 @@ export function InvestorDetailsForm(props: DetailsFormProps) {
description={t('register.details.description')} description={t('register.details.description')}
formError={formError} formError={formError}
draft={draft} draft={draft}
leave={leave}
onSubmit={() => void submit()} onSubmit={() => void submit()}
footer={ footer={
<> <>
@ -36,11 +35,7 @@ export function InvestorDetailsForm(props: DetailsFormProps) {
> >
{t('register.details.submit')} {t('register.details.submit')}
</Button> </Button>
<TermsLine <TermsLine before={t('register.details.terms-before')} />
before={t('register.details.terms-before')}
rules={props.rules}
placement={props.haltPlacement}
/>
</> </>
} }
> >

View File

@ -1,46 +0,0 @@
'use client';
import { Button } from '@lumina/island/atoms/button';
import { Modal } from '@lumina/island/molecules/modal';
import { Sheet } from '@lumina/island/molecules/sheet';
import { useTranslation } from 'react-i18next';
import type { LeaveRegistrationDialogProps } from '../types';
/**
* Back (or any link) during step 4 (J02-3f): «ثبت‌نام را نیمه‌کاره رها می‌کنید؟». The number is
* proven and what was typed is kept, so a later login with it resumes here. «ادامه ثبت‌نام» stays,
* «بعداً ادامه می‌دهم» leaves; Escape and the scrim stay too. A bottom sheet on mobile, a modal on
* desktop.
*/
export function LeaveRegistrationDialog({
placement,
open,
onStay,
onLeave,
}: LeaveRegistrationDialogProps) {
const { t } = useTranslation('auth');
const title = t('register.leave.title');
const body = t('register.leave.body');
const size = placement === 'sheet' ? 'lg' : 'md';
const buttons = (
<>
<Button variant="primary" size={size} block onClick={onStay}>
{t('register.leave.stay')}
</Button>
<Button variant="secondary" size={size} block onClick={onLeave}>
{t('register.leave.later')}
</Button>
</>
);
return placement === 'sheet' ? (
<Sheet open={open} title={title} onClose={onStay} footer={buttons}>
{body}
</Sheet>
) : (
<Modal open={open} title={title} onClose={onStay} actions={buttons}>
{body}
</Modal>
);
}

View File

@ -1,61 +0,0 @@
'use client';
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Modal } from '@lumina/island/molecules/modal';
import { Sheet } from '@lumina/island/molecules/sheet';
import { useTranslation } from 'react-i18next';
import type { RulesSheetProps } from '../types';
/**
* «قوانین لومینا» over the registration form (G-2s): the general rules, rendered on the server and
* passed in, with one «متوجه شدم» that closes it. A bottom sheet on mobile, the 640 modal on
* desktop; Escape and the scrim close it too.
*/
export function RulesSheet({
open,
placement,
onClose,
children,
}: RulesSheetProps) {
const { t } = useTranslation('auth');
const title = t('register.rules-title');
const close = (
<Button
variant="primary"
size={placement === 'sheet' ? 'lg' : 'md'}
block
onClick={onClose}
>
{t('register.rules-close')}
</Button>
);
if (placement === 'sheet') {
return (
<Sheet open={open} title={title} onClose={onClose} footer={close}>
{children}
</Sheet>
);
}
return (
<Modal open={open} size="wide" title={title} onClose={onClose}>
<FlexBox direction="flex-col" className="min-h-0 flex-1">
<FlexBox
direction="flex-col"
className="min-h-0 flex-1 overflow-auto p-6"
>
{children}
</FlexBox>
<FlexBox
tag="footer"
direction="flex-col"
className="flex-none border-t border-border-subtle px-6 py-4"
>
{close}
</FlexBox>
</FlexBox>
</Modal>
);
}

View File

@ -1,37 +1,19 @@
'use client';
import { LinkButton } from '@lumina/island/atoms/link-button';
import { Typography } from '@lumina/island/atoms/typography'; import { Typography } from '@lumina/island/atoms/typography';
import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { TermsLineProps } from '../types'; import type { TermsLineProps } from '../types';
import { RulesSheet } from './RulesSheet';
/** /**
* Accepting the rules by submitting, with no checkbox. «قوانین لومینا» opens the general rules in * Accepting the rules by submitting, with no checkbox. The rules page isn't designed yet, so the
* a sheet over the form (G-2s), so nothing typed is lost. * line names it without a link.
*/ */
export function TermsLine({ before, rules, placement }: TermsLineProps) { export function TermsLine({ before }: TermsLineProps) {
const { t } = useTranslation('auth'); const { t } = useTranslation('auth');
const [isOpen, setIsOpen] = useState(false);
return ( return (
<>
<Typography variant="body-sm" color="secondary" className="text-center"> <Typography variant="body-sm" color="secondary" className="text-center">
{before} {before}
<LinkButton aria-haspopup="dialog" onClick={() => setIsOpen(true)}>
{t('register.terms-link')} {t('register.terms-link')}
</LinkButton>
{t('register.terms-after')}
</Typography> </Typography>
<RulesSheet
open={isOpen}
placement={placement}
onClose={() => setIsOpen(false)}
>
{rules}
</RulesSheet>
</>
); );
} }

View File

@ -3,7 +3,6 @@ import type { Control, FieldValues, Path } from 'react-hook-form';
import type { import type {
RegisterDetailsPageModel, RegisterDetailsPageModel,
RegisterLeaveModel,
UseDetailsPartOptions, UseDetailsPartOptions,
UsernameAvailability, UsernameAvailability,
} from '../../../../../../../../features/auth'; } from '../../../../../../../../features/auth';
@ -13,13 +12,8 @@ export type RegisterDetailsStepProps = {
/** `lg` on mobile, `md` on desktop. */ /** `lg` on mobile, `md` on desktop. */
size: 'md' | 'lg'; size: 'md' | 'lg';
supportPlacement: SupportEntryProps['placement']; supportPlacement: SupportEntryProps['placement'];
/** /** The halt when the token runs out: a bottom sheet on mobile, a modal on desktop. */
* The halt when the token runs out, the leave dialog and the rules: a bottom sheet on mobile, a
* modal on desktop.
*/
haltPlacement: 'sheet' | 'modal'; haltPlacement: 'sheet' | 'modal';
/** «قوانین عمومی», rendered on the server, for the terms line's rules sheet (G-2s). */
rules: ReactNode;
}; };
/** What each account type's form gets from the step. */ /** What each account type's form gets from the step. */
@ -37,8 +31,6 @@ export type DetailsFrameProps = DetailsFormProps & {
footer: ReactNode; footer: ReactNode;
/** The values to keep for the halt's new code. */ /** The values to keep for the halt's new code. */
draft: () => Parameters<RegisterDetailsPageModel['reverify']>[0]; draft: () => Parameters<RegisterDetailsPageModel['reverify']>[0];
/** Back and links ask first (J02-3f). */
leave: RegisterLeaveModel;
onSubmit: () => void; onSubmit: () => void;
children: ReactNode; children: ReactNode;
}; };
@ -50,15 +42,6 @@ export type ExpiryWarningProps = {
onRenew?: () => void; onRenew?: () => void;
}; };
export type LeaveRegistrationDialogProps = {
placement: RegisterDetailsStepProps['haltPlacement'];
open: boolean;
/** «ادامه ثبت‌نام», Escape or the scrim. */
onStay: () => void;
/** «بعداً ادامه می‌دهم». */
onLeave: () => void;
};
export type ExpiryHaltProps = { export type ExpiryHaltProps = {
placement: RegisterDetailsStepProps['haltPlacement']; placement: RegisterDetailsStepProps['haltPlacement'];
isSending: boolean; isSending: boolean;
@ -68,17 +51,6 @@ export type ExpiryHaltProps = {
export type TermsLineProps = { export type TermsLineProps = {
/** «با ساخت حساب، » or «با ثبت اطلاعات، ». */ /** «با ساخت حساب، » or «با ثبت اطلاعات، ». */
before: string; before: string;
/** The general rules the link opens. */
rules: ReactNode;
placement: RegisterDetailsStepProps['haltPlacement'];
};
export type RulesSheetProps = {
open: boolean;
placement: RegisterDetailsStepProps['haltPlacement'];
onClose: () => void;
/** The rules' text. */
children: ReactNode;
}; };
export type UsernameFieldProps<T extends FieldValues> = { export type UsernameFieldProps<T extends FieldValues> = {

View File

@ -11,10 +11,10 @@ import {
useProfileBlock, useProfileBlock,
} from '../../../../../../../../features/profile'; } from '../../../../../../../../features/profile';
import { useIdentityBlock } from '../../../../../../../../features/verification'; import { useIdentityBlock } from '../../../../../../../../features/verification';
import { LeaveDialog } from '../../../../../../organisms/leave-dialog';
import { useLandOnIdentity } from '../hooks/use-land-on-identity'; import { useLandOnIdentity } from '../hooks/use-land-on-identity';
import type { EditContentProps } from '../types'; import type { EditContentProps } from '../types';
import { IdentityBlock } from './IdentityBlock'; import { IdentityBlock } from './IdentityBlock';
import { LeaveDialog } from './LeaveDialog';
import { ProfileBlock } from './ProfileBlock'; import { ProfileBlock } from './ProfileBlock';
import { ProfileSummary } from './ProfileSummary'; import { ProfileSummary } from './ProfileSummary';
@ -66,11 +66,7 @@ export function EditContent({
/> />
); );
const identityBlock = ( const identityBlock = (
<IdentityBlock <IdentityBlock model={identity} headingRef={identityHeading} />
model={identity}
headingRef={identityHeading}
layout={layout}
/>
); );
const profileBlock = ( const profileBlock = (
<ProfileBlock <ProfileBlock

View File

@ -14,11 +14,7 @@ import { useTranslation } from 'react-i18next';
import { IDENTITY_ANCHOR } from '../../../../../../../../features/verification'; import { IDENTITY_ANCHOR } from '../../../../../../../../features/verification';
import { translateMessage } from '../../../../../../../../shared/utils'; import { translateMessage } from '../../../../../../../../shared/utils';
import { import { ID_CARD_IMAGE } from '../../../../../../../../shared/validations';
ID_CARD_IMAGE,
ID_CARD_SIDES,
} from '../../../../../../../../shared/validations';
import { SupportEntry } from '../../../../../../organisms/support-entry';
import type { IdentityBlockProps } from '../types'; import type { IdentityBlockProps } from '../types';
import { BlockHeading } from './BlockHeading'; import { BlockHeading } from './BlockHeading';
@ -26,16 +22,11 @@ const BYTES_PER_MB = 1024 * 1024;
/** /**
* «اطلاعات هویتی» (J03-1): the username is never editable; the names and national ID (masked) are * «اطلاعات هویتی» (J03-1): the username is never editable; the names and national ID (masked) are
* locked while the review is pending or approved. Rejected (J03-1c), the reason and a way to * locked while the review is pending or approved. Rejected (J03-1c), the reason leads the block,
* support lead the block, the names, the full national ID and both card sides can be corrected * the names and the full national ID can be corrected with a new card image, and «ارسال مجدد
* (the field the admin named starts in its error state), and «ارسال مجدد اطلاعات هویتی» stays * اطلاعات هویتی» stays frozen until all four are valid (a press shows what is missing).
* frozen until all are valid (a press shows what is missing).
*/ */
export function IdentityBlock({ export function IdentityBlock({ model, headingRef }: IdentityBlockProps) {
model,
headingRef,
layout,
}: IdentityBlockProps) {
const { t } = useTranslation('auth'); const { t } = useTranslation('auth');
const titleId = useId(); const titleId = useId();
const { form } = model; const { form } = model;
@ -55,14 +46,9 @@ export function IdentityBlock({
{model.isEditable && ( {model.isEditable && (
<Banner tone="danger" title={t('profile-edit.identity.rejected-title')}> <Banner tone="danger" title={t('profile-edit.identity.rejected-title')}>
{model.rejectionReason && {model.rejectionReason &&
`${t('profile-edit.identity.rejected-reason', { t('profile-edit.identity.rejected-reason', {
reason: model.rejectionReason, reason: model.rejectionReason,
})} `} })}
{t('profile-edit.identity.rejected-guide')}{' '}
<SupportEntry
trigger="inline"
placement={layout === 'desktop' ? 'popover' : 'bottom'}
/>
</Banner> </Banner>
)} )}
{model.formError && <Banner tone="danger">{model.formError}</Banner>} {model.formError && <Banner tone="danger">{model.formError}</Banner>}
@ -126,10 +112,8 @@ export function IdentityBlock({
/> />
)} )}
/> />
{ID_CARD_SIDES.map(({ side, label }) => (
<Controller <Controller
key={side} name="idCardFront"
name={side}
control={form.control} control={form.control}
render={({ field, fieldState }) => ( render={({ field, fieldState }) => (
<FileField <FileField
@ -137,11 +121,11 @@ export function IdentityBlock({
ref={field.ref} ref={field.ref}
name={field.name} name={field.name}
file={field.value} file={field.value}
onChange={(file) => model.pickImage(side, file)} onChange={model.pickImage}
onBlur={field.onBlur} onBlur={field.onBlur}
accept={ID_CARD_IMAGE.types.join(',')} accept={ID_CARD_IMAGE.types.join(',')}
label={t(`register.fields.${label}`)} label={t('register.fields.id-card-front')}
hint={t(`register.fields.${label}-hint`)} hint={t('register.fields.id-card-front-hint')}
size={ size={
field.value && field.value &&
t('register.fields.file-size', { t('register.fields.file-size', {
@ -162,7 +146,6 @@ export function IdentityBlock({
/> />
)} )}
/> />
))}
<FlexBox direction="flex-col" gap="gap-2"> <FlexBox direction="flex-col" gap="gap-2">
<Button <Button
type="submit" type="submit"

View File

@ -1,18 +1,13 @@
'use client';
import { Button } from '@lumina/island/atoms/button'; import { Button } from '@lumina/island/atoms/button';
import { useOfflineFreeze } from '@lumina/island/hooks/use-online';
import { Modal } from '@lumina/island/molecules/modal'; import { Modal } from '@lumina/island/molecules/modal';
import { Sheet } from '@lumina/island/molecules/sheet'; import { Sheet } from '@lumina/island/molecules/sheet';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { LeaveDialogProps } from './types'; import type { LeaveDialogProps } from '../types';
/** /**
* Leaving a form with unsaved changes (J03-1g, J10-4n): «تغییرات ذخیره‌نشده دارید. آیا می‌خواهید * Leaving with unsaved changes (J03-1g): «ذخیره و خروج» saves the changed blocks first, «خروج بدون
* خارج شوید؟» with «ذخیره و خروج» (saves first, leaves once it went through), «خروج بدون ذخیره» * ذخیره» drops them, «ادامه ویرایش» stays. A bottom sheet on mobile, a modal on desktop; no ✕.
* (drops the changes) and «ادامه ویرایش» (stays). A bottom sheet on mobile, an alert modal on
* desktop; no ✕. Offline, «ذخیره و خروج» is frozen with the reason (0043).
*/ */
export function LeaveDialog({ export function LeaveDialog({
open, open,
@ -22,10 +17,9 @@ export function LeaveDialog({
onDiscard, onDiscard,
onStay, onStay,
}: LeaveDialogProps) { }: LeaveDialogProps) {
const { t } = useTranslation('common'); const { t } = useTranslation('auth');
const offline = useOfflineFreeze(t('network.frozen'));
const size = layout === 'mobile' ? 'lg' : undefined; const size = layout === 'mobile' ? 'lg' : undefined;
const title = t('leave.title'); const title = t('profile-edit.leave.title');
const buttons = ( const buttons = (
<> <>
<Button <Button
@ -34,9 +28,8 @@ export function LeaveDialog({
block block
isLoading={isSaving} isLoading={isSaving}
onClick={onSave} onClick={onSave}
{...offline}
> >
{t('leave.save')} {t('profile-edit.leave.save')}
</Button> </Button>
<Button <Button
variant="danger" variant="danger"
@ -45,7 +38,7 @@ export function LeaveDialog({
disabled={isSaving} disabled={isSaving}
onClick={onDiscard} onClick={onDiscard}
> >
{t('leave.discard')} {t('profile-edit.leave.discard')}
</Button> </Button>
<Button <Button
variant="secondary" variant="secondary"
@ -54,7 +47,7 @@ export function LeaveDialog({
disabled={isSaving} disabled={isSaving}
onClick={onStay} onClick={onStay}
> >
{t('leave.stay')} {t('profile-edit.leave.stay')}
</Button> </Button>
</> </>
); );

View File

@ -6,10 +6,7 @@ import { useTranslation } from 'react-i18next';
import type { ProfileSummaryProps } from '../types'; import type { ProfileSummaryProps } from '../types';
/** /** Who this is: the 72px photo, the name, @username and where the identity review stands. */
* Who this is: the 72px photo, the name, @username and where the identity review stands; while
* pending, how long the review takes (J03-1b).
*/
export function ProfileSummary({ export function ProfileSummary({
name, name,
username, username,
@ -17,7 +14,6 @@ export function ProfileSummary({
status, status,
}: ProfileSummaryProps) { }: ProfileSummaryProps) {
const { t } = useTranslation('common'); const { t } = useTranslation('common');
const { t: tAuth } = useTranslation('auth');
return ( return (
<FlexBox alignItems="items-center" gap="gap-4"> <FlexBox alignItems="items-center" gap="gap-4">
<Avatar name={username} src={avatarSrc} size="xl" /> <Avatar name={username} src={avatarSrc} size="xl" />
@ -45,11 +41,6 @@ export function ProfileSummary({
<StatusBadge status={`verification.${status}`}> <StatusBadge status={`verification.${status}`}>
{t(`status.verification.${status}`)} {t(`status.verification.${status}`)}
</StatusBadge> </StatusBadge>
{status === 'pending' && (
<Typography variant="caption" color="secondary">
{tAuth('profile-edit.pending-note')}
</Typography>
)}
</FlexBox> </FlexBox>
</FlexBox> </FlexBox>
); );

View File

@ -20,9 +20,8 @@ export type CreatorProfileEditSkeletonProps = {
label: string; label: string;
}; };
import type { LeaveTarget } from '../../../../../organisms/leave-dialog'; /** Where leaving goes once confirmed: a link that was followed, or back (no `href`). */
export type LeaveTarget = { href?: string };
export type { LeaveTarget };
export type EditContentProps = { export type EditContentProps = {
layout: CreatorProfileEditLayout; layout: CreatorProfileEditLayout;
@ -44,8 +43,6 @@ export type ProfileSummaryProps = {
export type IdentityBlockProps = { export type IdentityBlockProps = {
model: IdentityBlockModel; model: IdentityBlockModel;
/** Where the banner's support link opens its sheet: bottom on mobile, a popover on desktop. */
layout: CreatorProfileEditLayout;
/** The block's heading, which the rejected deep link focuses. */ /** The block's heading, which the rejected deep link focuses. */
headingRef: RefObject<HTMLHeadingElement | null>; headingRef: RefObject<HTMLHeadingElement | null>;
}; };
@ -68,3 +65,12 @@ export type SubSectionProps = {
hint: string; hint: string;
children: ReactNode; children: ReactNode;
}; };
export type LeaveDialogProps = {
open: boolean;
layout: CreatorProfileEditLayout;
isSaving: boolean;
onSave: () => void;
onDiscard: () => void;
onStay: () => void;
};

View File

@ -15,16 +15,11 @@ export function CheckoutSkeleton({
layout, layout,
creator, creator,
label, label,
delayed,
}: CheckoutSkeletonProps) { }: CheckoutSkeletonProps) {
const padding = layout === 'desktop' ? 'lg' : 'md'; const padding = layout === 'desktop' ? 'lg' : 'md';
return ( return (
<SkeletonRegion <SkeletonRegion label={label} className="flex flex-1 flex-col">
label={label}
delayed={delayed}
className="flex flex-1 flex-col"
>
<CheckoutFrame <CheckoutFrame
layout={layout} layout={layout}
creator={creator} creator={creator}

View File

@ -3,16 +3,15 @@ import { Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { translateMessage } from '../../../../../../../../shared/utils'; import { translateMessage } from '../../../../../../../../shared/utils';
import type { CheckoutCodeProps } from '../types'; import type { CheckoutPartProps } from '../types';
/** /**
* «کد دعوت», left to right, with its own «ثبت» (J06-2j–2o): «ثبت» or Enter checks the code and * «کد دعوت», left to right, with its own «ثبت» (J06-2j–2o): «ثبت» or Enter checks the code and
* never pays; leaving the field checks it quietly. Valid turns the field green and read-only with * never pays; leaving the field checks it quietly. Valid turns the field green and read-only with
* «تغییر»; invalid keeps the code in red; a check that couldn't run asks for «ثبت» again. A code * «تغییر»; invalid keeps the code in red; a check that couldn't run asks for «ثبت» again. A code
* from an invite link says so. The message only reassures or warns; «پرداخت» decides. «کد ندارم» * from an invite link says so. The message only reassures or warns; «پرداخت» decides.
* ends the message row while the code can change (J06-2t).
*/ */
export function CheckoutCode({ model, onNoCode }: CheckoutCodeProps) { export function CheckoutCode({ model }: Pick<CheckoutPartProps, 'model'>) {
const { t } = useTranslation(['payment', 'errors']); const { t } = useTranslation(['payment', 'errors']);
return ( return (
@ -34,7 +33,6 @@ export function CheckoutCode({ model, onNoCode }: CheckoutCodeProps) {
}} }}
onCheck={model.checkCode} onCheck={model.checkCode}
onEdit={model.editCode} onEdit={model.editCode}
onNoCode={onNoCode}
status={model.codeCheck} status={model.codeCheck}
source={model.codeSource} source={model.codeSource}
label={t('checkout.code.label')} label={t('checkout.code.label')}
@ -48,7 +46,6 @@ export function CheckoutCode({ model, onNoCode }: CheckoutCodeProps) {
validFromLink: t('checkout.code.from-link'), validFromLink: t('checkout.code.from-link'),
invalid: t('errors:checkout.code-invalid'), invalid: t('errors:checkout.code-invalid'),
error: t('checkout.code.check-failed'), error: t('checkout.code.check-failed'),
noCode: t('checkout.no-code.link'),
}} }}
/> />
)} )}

View File

@ -57,7 +57,7 @@ export function CheckoutFooter({ model }: Pick<CheckoutPartProps, 'model'>) {
</FlexBox> </FlexBox>
<Typography variant="caption" color="secondary" className="text-center"> <Typography variant="caption" color="secondary" className="text-center">
{t('checkout.terms-before')} {t('checkout.terms-before')}
<Link href={ROUTES.rules.subscription}>{t('checkout.terms-link')}</Link> <Link href={ROUTES.terms}>{t('checkout.terms-link')}</Link>
{t('checkout.terms-after')} {t('checkout.terms-after')}
</Typography> </Typography>
{canPay ? ( {canPay ? (

View File

@ -1,6 +1,5 @@
import { Typography } from '@lumina/island/atoms/typography'; import { Typography } from '@lumina/island/atoms/typography';
import { Banner } from '@lumina/island/molecules/banner'; import { Banner } from '@lumina/island/molecules/banner';
import { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useCheckoutPage } from '../../../../../../../../features/checkout'; import { useCheckoutPage } from '../../../../../../../../features/checkout';
@ -11,7 +10,6 @@ import { CheckoutFooter } from './CheckoutFooter';
import { CheckoutFrame } from './CheckoutFrame'; import { CheckoutFrame } from './CheckoutFrame';
import { CheckoutHalts } from './CheckoutHalts'; import { CheckoutHalts } from './CheckoutHalts';
import { CheckoutTiers } from './CheckoutTiers'; import { CheckoutTiers } from './CheckoutTiers';
import { NoCodeSheet } from './NoCodeSheet';
const SKELETON_LABELS = { const SKELETON_LABELS = {
pending: 'checkout.loading', pending: 'checkout.loading',
@ -23,19 +21,16 @@ const SKELETON_LABELS = {
* The signed-in investor's checkout: the screen loads in the browser behind the skeleton, which * The signed-in investor's checkout: the screen loads in the browser behind the skeleton, which
* also covers settling a payment left at the gateway and the way to the channel for an investor * also covers settling a payment left at the gateway and the way to the channel for an investor
* who can't pay here. An ended subscription reactivates: the note that the period starts today in * who can't pay here. An ended subscription reactivates: the note that the period starts today in
* place of the invite note and code (U11 ۳.۱). «کد ندارم» opens where to get a code (J06-2t). * place of the invite note and code (U11 ۳.۱).
*/ */
export function CheckoutForm({ export function CheckoutForm({
creatorId, creatorId,
channelHref, channelHref,
layout, layout,
creator, creator,
creatorName,
creatorLinks,
}: CheckoutFormProps) { }: CheckoutFormProps) {
const { t } = useTranslation('payment'); const { t } = useTranslation('payment');
const model = useCheckoutPage({ creatorId, channelHref }); const model = useCheckoutPage({ creatorId, channelHref });
const [isNoCodeOpen, setIsNoCodeOpen] = useState(false);
if (model.status !== 'ready') { if (model.status !== 'ready') {
return ( return (
@ -75,23 +70,13 @@ export function CheckoutForm({
{t('checkout.invite-note')} {t('checkout.invite-note')}
</Typography> </Typography>
<CheckoutTiers model={model} layout={layout} /> <CheckoutTiers model={model} layout={layout} />
<CheckoutCode <CheckoutCode model={model} />
model={model}
onNoCode={() => setIsNoCodeOpen(true)}
/>
</> </>
) )
} }
footer={<CheckoutFooter model={model} />} footer={<CheckoutFooter model={model} />}
/> />
<CheckoutHalts model={model} layout={layout} /> <CheckoutHalts model={model} layout={layout} />
<NoCodeSheet
open={isNoCodeOpen}
onClose={() => setIsNoCodeOpen(false)}
layout={layout}
creatorName={creatorName}
creatorLinks={creatorLinks}
/>
</> </>
); );
} }

View File

@ -127,7 +127,7 @@ export function CheckoutHalts({ model, layout }: CheckoutPartProps) {
layout={layout} layout={layout}
open={halt?.kind === 'waitlisted'} open={halt?.kind === 'waitlisted'}
icon={<StateArt icon="clock" tone="brand" size="compact" />} icon={<StateArt icon="clock" tone="brand" size="compact" />}
title={t('checkout.waitlist.already-title')} title={t('checkout.waitlist.title')}
buttons={ buttons={
<Button <Button
variant="primary" variant="primary"

View File

@ -1,134 +0,0 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { List, ListRow } from '@lumina/island/molecules/list-row';
import { Modal } from '@lumina/island/molecules/modal';
import { Sheet } from '@lumina/island/molecules/sheet';
import { Element } from '@lumina/island/primitives/element';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
displaySocialUrl,
fromSocialUrl,
} from '../../../../../../../../shared/utils';
import { SupportDialog } from '../../../../../../organisms/support-entry';
import type { NoCodeSheetProps } from '../types';
/**
* «کد ندارم» (J06-2t): the code comes from the creator, so the sheet lists their channel links,
* each opening in a new tab, and says an invite link fills the code in by itself. A creator
* without links leaves «پشتیبانی», which opens the support sheet over this one. A bottom sheet on
* mobile, a centred modal on desktop; «بستن», ✕, Escape and the scrim return to checkout.
*/
export function NoCodeSheet({
open,
onClose,
layout,
creatorName,
creatorLinks,
}: NoCodeSheetProps) {
const { t } = useTranslation(['payment', 'channel']);
const [isSupportOpen, setIsSupportOpen] = useState(false);
const isMobile = layout === 'mobile';
const hasLinks = creatorLinks.length > 0;
const body = (
<FlexBox direction="flex-col" gap="gap-3">
<Typography>
{t(
hasLinks ? 'checkout.no-code.body' : 'checkout.no-code.body-no-links',
{
name: creatorName,
},
)}
</Typography>
{hasLinks ? (
<List tone="soft" aria-label={t('checkout.no-code.links')}>
{creatorLinks.map(({ label, url }) => {
const { platform } = fromSocialUrl(label, url);
const address = (
<Element tag="bdi" dir="ltr">
{displaySocialUrl(url)}
</Element>
);
return (
<ListRow
key={url}
href={url}
external
icon={platform === 'telegram' ? 'telegram' : 'link'}
title={
platform === 'website'
? address
: platform === 'telegram'
? t('checkout.no-code.platforms.telegram')
: t(`channel:header.platforms.${platform}`)
}
subtitle={
<>
{address}
<Typography tag="span" className="sr-only">
{t('checkout.no-code.opens-new-tab')}
</Typography>
</>
}
/>
);
})}
</List>
) : (
<List tone="soft">
<ListRow
icon="headset"
title={t('checkout.no-code.support')}
chevron
onClick={() => setIsSupportOpen(true)}
/>
</List>
)}
<Typography variant="caption" color="secondary">
{t('checkout.no-code.link-hint')}
</Typography>
</FlexBox>
);
const close = (
<Button
variant="secondary"
size={isMobile ? 'lg' : undefined}
block
onClick={onClose}
>
{t('checkout.no-code.close')}
</Button>
);
return (
<>
{isMobile ? (
<Sheet
open={open}
title={t('checkout.no-code.title')}
onClose={onClose}
footer={close}
>
{body}
</Sheet>
) : (
<Modal
open={open}
title={t('checkout.no-code.title')}
onClose={onClose}
actions={close}
>
{body}
</Modal>
)}
<SupportDialog
placement={isMobile ? 'bottom' : 'modal'}
open={open && isSupportOpen}
onClose={() => setIsSupportOpen(false)}
/>
</>
);
}

View File

@ -1,7 +1,6 @@
import type { FormEvent, ReactNode } from 'react'; import type { FormEvent, ReactNode } from 'react';
import type { CheckoutPageModel } from '../../../../../../../features/checkout'; import type { CheckoutPageModel } from '../../../../../../../features/checkout';
import type { SocialLinkPayload } from '../../../../../../../features/profile';
export type CheckoutLayout = 'mobile' | 'desktop'; export type CheckoutLayout = 'mobile' | 'desktop';
@ -13,27 +12,10 @@ export type CheckoutPanelProps = {
layout: CheckoutLayout; layout: CheckoutLayout;
/** Who is being paid, rendered on the server: CheckoutCreator. */ /** Who is being paid, rendered on the server: CheckoutCreator. */
creator: ReactNode; creator: ReactNode;
/** The creator's display name, else their username, for «کد ندارم» (J06-2t). */
creatorName: string;
/** The creator's channel links, where «کد ندارم» sends the investor for a code. */
creatorLinks: SocialLinkPayload[];
}; };
export type CheckoutFormProps = CheckoutPanelProps; export type CheckoutFormProps = CheckoutPanelProps;
export type NoCodeSheetProps = Pick<
CheckoutPanelProps,
'layout' | 'creatorName' | 'creatorLinks'
> & {
open: boolean;
onClose: () => void;
};
export type CheckoutCodeProps = Pick<CheckoutPartProps, 'model'> & {
/** «کد ندارم». */
onNoCode: () => void;
};
export type CheckoutFrameProps = { export type CheckoutFrameProps = {
layout: CheckoutLayout; layout: CheckoutLayout;
creator: ReactNode; creator: ReactNode;
@ -55,8 +37,6 @@ export type CheckoutSkeletonProps = {
layout: CheckoutLayout; layout: CheckoutLayout;
creator: ReactNode; creator: ReactNode;
label: string; label: string;
/** Fades in after 300 ms, so a fast route never flashes it (`loading.tsx` only, G-3d). */
delayed?: boolean;
}; };
export type HaltDialogProps = { export type HaltDialogProps = {

View File

@ -0,0 +1,51 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Card } from '@lumina/island/molecules/card';
import { ResultPanel } from '@lumina/island/molecules/result-panel';
import { useTranslation } from 'react-i18next';
import { MobileTopBar } from '../../../../../navigation/components/mobile-top-bar';
import { LockedActions } from './components/LockedActions';
import { LOCKED_PANEL } from './constants';
import type { ComposerLockedProps } from './types';
/**
* A composer's address opened by a creator who may not publish (C4 ۲.۱–۲.۳, J08-1f…1j, J09-1e):
* what «انتشار» would explain in its sheet, as the page, with the one way forward and «بستن».
* Mobile: the pushed page's bar over the panel; desktop: the 640px card.
*/
export function ComposerLocked({
standing,
layout,
title,
onClose,
}: ComposerLockedProps) {
const { t } = useTranslation('common');
const { tone, icon } = LOCKED_PANEL[standing];
const panel = (
<ResultPanel
tone={tone}
icon={icon}
title={t(`publish.${standing}.title`)}
body={t(`publish.${standing}.reason`)}
actions={
<LockedActions standing={standing} layout={layout} onClose={onClose} />
}
/>
);
if (layout === 'mobile') {
return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={title} />
<FlexBox tag="main" direction="flex-col" className="flex-1 px-4 py-8">
{panel}
</FlexBox>
</FlexBox>
);
}
return (
<Card tag="section" padding="lg" className="w-full max-w-content">
{panel}
</Card>
);
}

View File

@ -0,0 +1,41 @@
import { Typography } from '@lumina/island/atoms/typography';
import { Modal } from '@lumina/island/molecules/modal';
import { useTranslation } from 'react-i18next';
import { useDialogRoute } from '../../../../../navigation/hooks/use-dialog-route';
import { ROUTES } from '../../../../../navigation/navigation';
import { LockedActions } from './components/LockedActions';
import type { ComposerLockedDialogProps } from './types';
/**
* A composer dialog's route opened by a creator who may not publish (J08-1f-D, J09-1e): the 420px
* question «انتشار» would have asked, title, reason and actions only, over the page. «بستن»,
* Escape and the scrim go back to that page.
*/
export function ComposerLockedDialog({
standing,
username,
}: ComposerLockedDialogProps) {
const { t } = useTranslation('common');
const route = useDialogRoute(ROUTES.channel(username));
return (
<Modal
open={route.open}
title={t(`publish.${standing}.title`)}
onClose={route.close}
onExited={route.onExited}
actions={
<LockedActions
standing={standing}
layout="desktop"
onClose={route.close}
/>
}
>
<Typography color="secondary">
{t(`publish.${standing}.reason`)}
</Typography>
</Modal>
);
}

View File

@ -1,27 +0,0 @@
'use client';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { LOCKED_PARAM } from '../../../../../navigation/constants';
import { ROUTES } from '../../../../../navigation/navigation';
import type { ComposerLockedRedirectProps } from './types';
/**
* A composer opened by a creator who may not publish (pending, rejected, suspended; J09-1e, 0060):
* the address is replaced by their own channel, where «انتشار» opens why at once
* (`?locked=post|prediction`). The composer's skeleton stays until the channel arrives.
*/
export function ComposerLockedRedirect({
username,
kind,
children,
}: ComposerLockedRedirectProps) {
const router = useRouter();
useEffect(() => {
router.replace(`${ROUTES.channel(username)}?${LOCKED_PARAM}=${kind}`);
}, [router, username, kind]);
return <>{children}</>;
}

View File

@ -0,0 +1,53 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { useTranslation } from 'react-i18next';
import { ROUTES } from '../../../../../../navigation/navigation';
import { SupportEntry } from '../../../../../organisms/support-entry';
import type { LockedActionsProps } from '../types';
/**
* Why-not's actions (C4 ۲.۱–۲.۳, J09-1e, as «انتشار» explains it): the identity review's status for
* a pending creator, its form to correct and send again for a rejected one, support for a
* suspended one; «بستن» under it.
*/
export function LockedActions({
standing,
layout,
onClose,
}: LockedActionsProps) {
const { t } = useTranslation('common');
const isMobile = layout === 'mobile';
const size = isMobile ? 'lg' : undefined;
return (
<>
{standing === 'suspended' ? (
// A desktop popover hangs from a positioned parent that also holds its trigger.
<FlexBox direction="flex-col" className="relative">
<SupportEntry
trigger="button"
placement={isMobile ? 'bottom' : 'popover'}
size={isMobile ? 'lg' : 'md'}
/>
</FlexBox>
) : (
<Button
variant="primary"
size={size}
block
href={
standing === 'rejected'
? `${ROUTES.account.profile}#identity`
: ROUTES.account.profile
}
>
{t(`publish.${standing}.action`)}
</Button>
)}
<Button variant="secondary" size={size} block onClick={onClose}>
{t('publish.close')}
</Button>
</>
);
}

View File

@ -0,0 +1,14 @@
import type { IconName } from '@lumina/island/atoms/icon';
import type { ResultPanelTone } from '@lumina/island/molecules/result-panel';
import type { BlockedStanding } from '../../../../../../features/post';
/** The blocked composer page's panel for each standing: its tone and icon (J08-1f…1j, J09-1e). */
export const LOCKED_PANEL: Record<
BlockedStanding,
{ tone: ResultPanelTone; icon: IconName }
> = {
pending: { tone: 'info', icon: 'clock' },
rejected: { tone: 'danger', icon: 'alert' },
suspended: { tone: 'danger', icon: 'lock' },
};

Some files were not shown because too many files have changed in this diff Show More