feat/pre-launch-4-overview #1

Merged
amiram_seify merged 5 commits from feat/pre-launch-4-overview into main 2026-11-02 17:24:48 +00:00
354 changed files with 7335 additions and 1735 deletions

View File

@ -1,14 +1,6 @@
// 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 { 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 type { Metadata } from 'next';
@ -37,12 +29,6 @@ export default function RegisterDetailsPage() {
size="md"
supportPlacement="popover"
haltPlacement="modal"
rules={
<GeneralRules
layout="sheet"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
}
/>
</GuestGuard>
</AuthTemplate>

View File

@ -13,7 +13,7 @@ export const metadata: Metadata = {
};
/**
* «پیش‌بینی جدید» on a direct load (J09-1-D): the 960px composer under the header, in the browser
* «سیگنال جدید» on a direct load (J09-1-D): the 960px composer under the header, in the browser
* only. From a page, the `@modal` slot opens it as a dialog over that page instead (0023).
*/
export default function ComposePredictionPage() {

View File

@ -1,6 +1,6 @@
// 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 '../../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation';
@ -8,7 +8,7 @@ import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rul
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../i18n';
import { i18n } from '../../../../i18n';
// Only the landing is indexed (0071); both tabs inherit this.
export const metadata: Metadata = {
@ -18,8 +18,8 @@ export const metadata: Metadata = {
};
/**
* «قوانین لومینا» 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.
* «قوانین و مقررات لومینا» 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.
*/

View File

@ -1,9 +1,9 @@
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { Card } from '@lumina/island/molecules/card';
import { i18n } from '../../../i18n';
import { i18n } from '../../../../i18n';
/** «قوانین عمومی» before it arrives, under the section's title and tabs: its panel of lines. */
/** «قوانین و مقررات» 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')}>

View File

@ -0,0 +1,23 @@
// 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 { Card } from '@lumina/island/molecules/card';
import { LegalDocumentView } from '@lumina/market/app/screens/organisms/legal-document';
import type { Metadata } from 'next';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/** «قوانین و مقررات», the first tab of «قوانین و مقررات لومینا» (G-2r); its text is read in the browser (0070). */
export default function RulesPage() {
return (
<Card padding="lg">
<LegalDocumentView documentKey="platform_rules" layout="desktop" />
</Card>
);
}

View File

@ -1,7 +1,7 @@
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. */
export default function Loading() {

View File

@ -0,0 +1,23 @@
// 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 { Card } from '@lumina/island/molecules/card';
import { SubscriptionTerms } from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms';
import type { Metadata } from 'next';
import { i18n } from '../../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('terms:meta-title'),
description: i18n.t('terms:meta-description'),
};
/** «شرایط اشتراک», the second tab of «قوانین و مقررات لومینا» (S5, G-2); its text is read in the browser (0070). */
export default function SubscriptionTermsPage() {
return (
<Card padding="lg">
<SubscriptionTerms layout="desktop" />
</Card>
);
}

View File

@ -0,0 +1,44 @@
// 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 type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:agreement.meta-title'),
robots: { index: false },
};
/** «توافق‌نامه تحلیلگر» on desktop: the 640 column under the header, with back beside the title. */
export default function AnalystAgreementLayout({
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('agreement.title')} />
{children}
</FlexBox>
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,8 @@
import { LegalDocumentSkeleton } from '@lumina/market/app/screens/organisms/legal-document';
import { i18n } from '../../../../i18n';
/** The agreement before it arrives, under the page's bar or title. */
export default function Loading() {
return <LegalDocumentSkeleton label={i18n.t('legal:document.loading')} />;
}

View File

@ -0,0 +1,22 @@
import { Card } from '@lumina/island/molecules/card';
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import { AnalystAgreement } from '@lumina/market/app/screens/(flow)/terms/analyst-agreement/organisms/analyst-agreement';
import { LegalDocumentSkeleton } from '@lumina/market/app/screens/organisms/legal-document';
import { i18n } from '../../../../i18n';
/** The agreement and the analyst's own record; both read in the browser (0070). Analysts only. */
export default function AnalystAgreementPage() {
return (
<AuthGuard
role="creator"
fallback={
<LegalDocumentSkeleton label={i18n.t('legal:document.loading')} />
}
>
<Card padding="lg">
<AnalystAgreement layout="desktop" />
</Card>
</AuthGuard>
);
}

View File

@ -1,29 +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 { Card } from '@lumina/island/molecules/card';
import {
GeneralRules,
generalRulesLabels,
} from '@lumina/market/app/screens/organisms/general-rules';
import type { Metadata } from 'next';
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,41 +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 { Card } from '@lumina/island/molecules/card';
import {
SubscriptionTerms,
subscriptionTermsLabels,
} from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms';
import { supportChatUrls } from '@lumina/market/app/screens/organisms/support-entry';
import { getEnv } from '@lumina/market/env';
import type { Metadata } from 'next';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('terms:meta-title'),
description: i18n.t('terms:meta-description'),
};
/**
* «شرایط اشتراک», the second tab of «قوانین لومینا» on desktop (S5 ۲.۱, G-2): the text in a panel
* of the section's 640 column, about 75 characters a line; the title and tabs come from the layout.
*/
export default function SubscriptionTermsPage() {
const labels = subscriptionTermsLabels(
i18n.getFixedT(null, 'terms'),
i18n.getFixedT(null, 'auth'),
getEnv().supportHours,
);
return (
<Card padding="lg">
<SubscriptionTerms
layout="desktop"
chats={supportChatUrls()}
labels={labels}
/>
</Card>
);
}

View File

@ -5,7 +5,7 @@ import {
} from '@lumina/market/app/screens/(flow)/compose/prediction/organisms/prediction-composer';
/**
* «پیش‌بینی جدید» opened from a main page (J09-1-D, 0023): the 960px composer dialog over that
* «سیگنال جدید» opened from a main page (J09-1-D, 0023): the 960px composer dialog over that
* page, the URL /compose/prediction; a direct load of that URL gets the full page instead. In the
* browser only: the dialog's skeleton until the viewer is known, then the composer for a creator
* who may publish, why not for one who may not, or the no-access state for anyone else.

View File

@ -8,7 +8,7 @@ import { i18n } from '../../../../i18n';
/**
* The creator's داشبورد on desktop (Creator Dashboard ۵.۱): the 640 column under the header, with
* the «داشبورد» heading, the three tabs «طرح‌های اشتراک» · «پیش‌بینی‌ها» · «مالی», then the tab. Each tab is its own
* the «داشبورد» heading, the three tabs «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own
* route with its own loading, so the heading and the tabs stay while one loads. Locked until
* registration step 5 is done (0016).
*/

View File

@ -2,7 +2,7 @@ import { PredictionsTabSkeleton } from '@lumina/market/app/screens/(main)/dashbo
import { i18n } from '../../../../../i18n';
/** پیش‌بینی‌ها before it arrives, block for block; the layout keeps the bar and the tabs. */
/** سیگنال‌ها before it arrives, block for block; the layout keeps the bar and the tabs. */
export default function Loading() {
return (
<PredictionsTabSkeleton label={i18n.t('predictions:tab.loading')} delayed />

View File

@ -13,7 +13,7 @@ export const metadata: Metadata = {
};
/**
* داشبورد › پیش‌بینی‌ها (J10-3): the creator's record, open and recently closed predictions, in the
* داشبورد › سیگنال‌ها (J10-3): the creator's record, open and recently closed predictions, in the
* browser only. Each block loads and fails on its own; the tabs stay.
*/
export default function PredictionsPage() {

View File

@ -4,7 +4,7 @@ import { PredictionListSkeleton } from '@lumina/market/app/screens/(main)/dashbo
import { i18n } from '../../../../../i18n';
/** «همه پیش‌بینی‌ها» before it arrives, under its real title. */
/** «همه سیگنال‌ها» before it arrives, under its real title. */
export default function Loading() {
return (
<FlexBox tag="main" justifyContent="justify-center" className="px-8 py-10">

View File

@ -17,8 +17,8 @@ export const metadata: Metadata = {
};
/**
* «همه پیش‌بینی‌ها» on desktop (J10-3f): the same list in the 640 column, «بازگشت» over its title
* back to the پیش‌بینی‌ها tab. The creator's own, in the browser only.
* «همه سیگنال‌ها» on desktop (J10-3f): the same list in the 640 column, «بازگشت» over its title
* back to the سیگنال‌ها tab. The creator's own, in the browser only.
*/
export default function PredictionListPage() {
const skeleton = (

View File

@ -12,7 +12,7 @@ import type { AppProvidersProps } from './types';
/** The app's root client component: runs the client bootstrap, then the platform's shell. */
export function AppProviders({ children }: AppProvidersProps) {
return (
<AppShell queryClient={getQueryClient()} i18n={i18n}>
<AppShell queryClient={getQueryClient()} i18n={i18n} layout="desktop">
{children}
</AppShell>
);

View File

@ -9,6 +9,7 @@ import {
AUTH_EVENTS,
endSuspendedSession,
isSessionSuspended,
noteAgreementRequired,
suspendedSessionOf,
} from '@lumina/market/features/auth';
@ -45,6 +46,7 @@ http.configure({
http.interceptors.response.use(undefined, (error) => {
const suspension = suspendedSessionOf(error);
if (suspension) endSuspendedSession(suspension);
noteAgreementRequired(error);
return error;
});
configureErrorHandler(ERROR_HANDLER_CONFIG);

View File

@ -1,14 +1,6 @@
// 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 { 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 type { Metadata } from 'next';
@ -45,12 +37,6 @@ export default function RegisterDetailsPage() {
size="lg"
supportPlacement="bottom"
haltPlacement="sheet"
rules={
<GeneralRules
layout="sheet"
labels={generalRulesLabels(i18n.getFixedT(null, 'rules'))}
/>
}
/>
</GuestGuard>
</AuthTemplate>

View File

@ -10,7 +10,7 @@ export const metadata: Metadata = {
robots: { index: false },
};
/** «پیش‌بینی جدید» (J09-1): the creator's own task flow, in the browser only, with no bottom nav. */
/** «سیگنال جدید» (J09-1): the creator's own task flow, in the browser only, with no bottom nav. */
export default function ComposePredictionPage() {
return (
<AuthGuard

View File

@ -1,6 +1,6 @@
// 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 '../../../../bootstrap/bootstrap.server';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { MobileTopBar } from '@lumina/market/app/navigation';
@ -8,7 +8,7 @@ import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rul
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../i18n';
import { i18n } from '../../../../i18n';
// Only the landing is indexed (0071); both tabs inherit this.
export const metadata: Metadata = {
@ -18,9 +18,9 @@ export const metadata: Metadata = {
};
/**
* «قوانین لومینا» 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
* «قوانین و مقررات لومینا» 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 }) {

View File

@ -1,8 +1,8 @@
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
import { i18n } from '../../../i18n';
import { i18n } from '../../../../i18n';
/** «قوانین عمومی» before it arrives, under the section's bar and tabs: a few sections' worth of lines. */
/** «قوانین و مقررات» 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')}>

View File

@ -0,0 +1,18 @@
// 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 { LegalDocumentView } from '@lumina/market/app/screens/organisms/legal-document';
import type { Metadata } from 'next';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:meta-title'),
description: i18n.t('rules:meta-description'),
};
/** «قوانین و مقررات», the first tab of «قوانین و مقررات لومینا» (G-2r); its text is read in the browser (0070). */
export default function RulesPage() {
return <LegalDocumentView documentKey="platform_rules" layout="mobile" />;
}

View File

@ -1,6 +1,6 @@
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. */
export default function Loading() {

View File

@ -0,0 +1,18 @@
// 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 { SubscriptionTerms } from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms';
import type { Metadata } from 'next';
import { i18n } from '../../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('terms:meta-title'),
description: i18n.t('terms:meta-description'),
};
/** «شرایط اشتراک», the second tab of «قوانین و مقررات لومینا» (S5, G-2); its text is read in the browser (0070). */
export default function SubscriptionTermsPage() {
return <SubscriptionTerms layout="mobile" />;
}

View File

@ -0,0 +1,37 @@
// 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 type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('rules:agreement.meta-title'),
robots: { index: false },
};
/** «توافق‌نامه تحلیلگر» on mobile: a task page pushed from حساب کاربری, with back and no bottom nav. */
export default function AnalystAgreementLayout({
children,
}: {
children: ReactNode;
}) {
const t = i18n.getFixedT(null, 'rules');
return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<MobileTopBar title={t('agreement.title')} />
<FlexBox
tag="main"
direction="flex-col"
className="flex-1 px-4 pt-4 pb-8"
>
{children}
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,8 @@
import { LegalDocumentSkeleton } from '@lumina/market/app/screens/organisms/legal-document';
import { i18n } from '../../../../i18n';
/** The agreement before it arrives, under the page's bar or title. */
export default function Loading() {
return <LegalDocumentSkeleton label={i18n.t('legal:document.loading')} />;
}

View File

@ -0,0 +1,19 @@
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
import { AnalystAgreement } from '@lumina/market/app/screens/(flow)/terms/analyst-agreement/organisms/analyst-agreement';
import { LegalDocumentSkeleton } from '@lumina/market/app/screens/organisms/legal-document';
import { i18n } from '../../../../i18n';
/** The agreement and the analyst's own record; both read in the browser (0070). Analysts only. */
export default function AnalystAgreementPage() {
return (
<AuthGuard
role="creator"
fallback={
<LegalDocumentSkeleton label={i18n.t('legal:document.loading')} />
}
>
<AnalystAgreement layout="mobile" />
</AuthGuard>
);
}

View File

@ -1,26 +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 {
GeneralRules,
generalRulesLabels,
} from '@lumina/market/app/screens/organisms/general-rules';
import type { Metadata } from 'next';
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

@ -1,39 +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 {
SubscriptionTerms,
subscriptionTermsLabels,
} from '@lumina/market/app/screens/(flow)/terms/subscription/organisms/subscription-terms';
import { supportChatUrls } from '@lumina/market/app/screens/organisms/support-entry';
import { getEnv } from '@lumina/market/env';
import type { Metadata } from 'next';
import { i18n } from '../../../../i18n';
export const metadata: Metadata = {
title: i18n.t('terms:meta-title'),
description: i18n.t('terms:meta-description'),
};
/**
* «شرایط اشتراک», the second tab of «قوانین لومینا» on mobile (S5 ۱.۱, G-2): the section's bar and
* tabs come from its layout; back returns to where the rules were opened (checkout, a suspended
* card, the support sheet).
*/
export default function SubscriptionTermsPage() {
const labels = subscriptionTermsLabels(
i18n.getFixedT(null, 'terms'),
i18n.getFixedT(null, 'auth'),
getEnv().supportHours,
);
return (
<SubscriptionTerms
layout="mobile"
chats={supportChatUrls()}
labels={labels}
/>
);
}

View File

@ -8,7 +8,7 @@ import { i18n } from '../../../../i18n';
/**
* The creator's داشبورد on mobile (Creator Dashboard ۱.۱, 0034): the tab bar «داشبورد», the three
* tabs «طرح‌های اشتراک» · «پیش‌بینی‌ها» · «مالی», then the tab. Each tab is its own route with its own loading, so the
* tabs «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی», then the tab. Each tab is its own route with its own loading, so the
* bar and the tabs stay while one loads. Locked until registration step 5 is done (0016).
*/
export default function CreatorDashboardLayout({

View File

@ -2,7 +2,7 @@ import { PredictionsTabSkeleton } from '@lumina/market/app/screens/(main)/dashbo
import { i18n } from '../../../../../i18n';
/** پیش‌بینی‌ها before it arrives, block for block; the layout keeps the bar and the tabs. */
/** سیگنال‌ها before it arrives, block for block; the layout keeps the bar and the tabs. */
export default function Loading() {
return (
<PredictionsTabSkeleton label={i18n.t('predictions:tab.loading')} delayed />

View File

@ -13,7 +13,7 @@ export const metadata: Metadata = {
};
/**
* داشبورد › پیش‌بینی‌ها (J10-3): the creator's record, open and recently closed predictions, in the
* داشبورد › سیگنال‌ها (J10-3): the creator's record, open and recently closed predictions, in the
* browser only. Each block loads and fails on its own; the tabs stay.
*/
export default function PredictionsPage() {

View File

@ -4,7 +4,7 @@ import { PredictionListSkeleton } from '@lumina/market/app/screens/(main)/dashbo
import { i18n } from '../../../../../i18n';
/** «همه پیش‌بینی‌ها» before it arrives, under its real bar. */
/** «همه سیگنال‌ها» before it arrives, under its real bar. */
export default function Loading() {
return (
<>

View File

@ -17,8 +17,8 @@ export const metadata: Metadata = {
};
/**
* «همه پیش‌بینی‌ها» on mobile (J10-3f, J10-3g): a page pushed from the پیش‌بینی‌ها tab, back ·
* «پیش‌بینی‌ها» · support, with the nav kept on داشبورد. The creator's own, in the browser only;
* «همه سیگنال‌ها» on mobile (J10-3f, J10-3g): a page pushed from the سیگنال‌ها tab, back ·
* «سیگنال‌ها» · support, with the nav kept on داشبورد. The creator's own, in the browser only;
* opened on its own, back goes to the tab.
*/
export default function PredictionListPage() {

View File

@ -12,7 +12,7 @@ import type { AppProvidersProps } from './types';
/** The app's root client component: runs the client bootstrap, then the platform's shell. */
export function AppProviders({ children }: AppProvidersProps) {
return (
<AppShell queryClient={getQueryClient()} i18n={i18n}>
<AppShell queryClient={getQueryClient()} i18n={i18n} layout="mobile">
{children}
</AppShell>
);

View File

@ -9,6 +9,7 @@ import {
AUTH_EVENTS,
endSuspendedSession,
isSessionSuspended,
noteAgreementRequired,
suspendedSessionOf,
} from '@lumina/market/features/auth';
@ -45,6 +46,7 @@ http.configure({
http.interceptors.response.use(undefined, (error) => {
const suspension = suspendedSessionOf(error);
if (suspension) endSuspendedSession(suspension);
noteAgreementRequired(error);
return error;
});
configureErrorHandler(ERROR_HANDLER_CONFIG);

View File

@ -2,6 +2,9 @@
"name": "@lumina/wall-street-plaza",
"version": "0.0.1",
"private": true,
"scripts": {
"test": "vitest run --config ../../vitest.config.ts"
},
"nx": {
"name": "wall-street-plaza",
"sourceRoot": "apps/wall-street-plaza/src",

View File

@ -19,7 +19,7 @@ import { QuoteHealth } from './components/QuoteHealth';
import { QuoteHealthSkeleton } from './components/QuoteHealthSkeleton';
/**
* پیش‌بینی‌ها (J11-8): the quote sources' health, refreshed every minute, then the queue tabs
* سیگنال‌ها (J11-8): the quote sources' health, refreshed every minute, then the queue tabs
* (نیاز به تأیید with its count) in the URL. Each part loads and fails on its own; a queue change
* remounts the rows behind the table skeleton. The detail opens beside the table and the dialogs
* over it.

View File

@ -28,7 +28,7 @@ import { OutcomeValue } from './OutcomeValue';
import { PredictionCardView } from './PredictionCardView';
/**
* «تأیید بستن پیش‌بینی» (J11-8b): the card, what the system detected at what price, from where and
* «تأیید بستن سیگنال» (J11-8b): the card, what the system detected at what price, from where and
* when, and the outcome it would record. «اصلاح قیمت» turns it into J11-8g: a corrected price from
* the same source with a reason (the analyst's correction notice carries it), the outcome following
* the typed price, and «لغو اصلاح» back.

View File

@ -20,7 +20,7 @@ import { useRetained } from '../use-retained';
import { DialogSubject } from './DialogSubject';
/**
* «پرچم‌گذاری پیش‌بینی» (J11-8e): one reason chip and an optional note («سایر» needs one). Flags
* «پرچم‌گذاری سیگنال» (J11-8e): one reason chip and an optional note («سایر» needs one). Flags
* are internal: they change nothing on the card, the track record or the outcome.
*/
export function FlagDialog({ actions }: ActionsProps) {

View File

@ -4,7 +4,7 @@ import type { PredictionPayload } from '@lumina/garden-roof/features/predictions
import { Button } from '@lumina/island/atoms/button';
import { useTranslation } from 'react-i18next';
/** The row's keyboard way into «جزئیات پیش‌بینی»; a pointer can click anywhere on the row. */
/** The row's keyboard way into «جزئیات سیگنال»; a pointer can click anywhere on the row. */
export function OpenRowButton({
prediction,
href,

View File

@ -42,9 +42,9 @@ function Change({ from, to }: { from: ReactNode; to: ReactNode | null }) {
}
/**
* «اصلاح نتیجه پیش‌بینی» (J11-8d): a closed prediction's new close price from the same source,
* «اصلاح نتیجه سیگنال» (J11-8d): a closed prediction's new close price from the same source,
* with what changes (price, outcome, ROI), a «دلیل», and what investors and the analyst's track
* record will show. On an open prediction it is «بستن پیش‌بینی با قیمت ادمین»: the close price and
* record will show. On an open prediction it is «بستن سیگنال با قیمت ادمین»: the close price and
* outcome it would record, closing now (a symbol with no quote is never proposed). Either way the
* analyst's correction notice carries the reason. The win-rate change shows when the track record
* is known (opened from the detail).

View File

@ -10,7 +10,7 @@ import type { PageModelProps } from '../types';
import { PredictionDetail } from './PredictionDetail';
/**
* «جزئیات پیش‌بینی» (J11-8c) beside the table, open while the URL has `?id=`. Its content loads
* «جزئیات سیگنال» (J11-8c) beside the table, open while the URL has `?id=`. Its content loads
* on its own: a failed read errors inside the panel and leaves the queue as it was.
*/
export function PredictionSheet({ model }: PageModelProps) {

View File

@ -37,10 +37,14 @@ export function predictionCardLabels(
toFinalTarget: t('card.to-final-target'),
toStop: t('card.to-stop'),
riskReward: t('card.risk-reward'),
riskRewardRange: (worst, best) =>
t('card.risk-reward-range', { worst, best }),
levels: {
stop: t('card.levels.stop'),
entry: t('card.levels.entry'),
base: t('card.levels.base'),
range: t('card.levels.range'),
entryRange: t('card.levels.entry-range'),
target,
finalTarget: t('card.levels.final-target'),
close: t('card.levels.close'),

View File

@ -14,7 +14,7 @@ export const metadata: Metadata = {
};
/**
* پیش‌بینی‌ها (J11-8): the title and the rule that nothing closes without ops on the server; the
* سیگنال‌ها (J11-8): the title and the rule that nothing closes without ops on the server; the
* queues in the browser once the admin is known (0062).
*/
export default function PredictionsPage() {

View File

@ -0,0 +1,17 @@
import { PageHeader } from '@lumina/island/molecules/page-header';
import { i18n } from '../../../i18n';
import { PriceFloorSkeleton } from './organisms/price-floor-card';
/** The card before it arrives: the title and subtitle over the skeleton. */
export default function Loading() {
return (
<>
<PageHeader
title={i18n.t('settings:page.title')}
subtitle={i18n.t('settings:page.subtitle')}
/>
<PriceFloorSkeleton label={i18n.t('settings:page.loading')} delayed />
</>
);
}

View File

@ -0,0 +1,10 @@
'use client';
import { usePriceFloorPage } from '@lumina/garden-roof';
import { PriceFloorForm } from './components/PriceFloorForm';
/** «کف قیمت اشتراک» (J11-11), its model read here so the form renders from props. */
export function PriceFloorCard() {
return <PriceFloorForm model={usePriceFloorPage()} />;
}

View File

@ -0,0 +1,44 @@
'use client';
import { ReasonDialog } from '@lumina/garden-roof/app/screens';
import { Banner } from '@lumina/island/molecules/banner';
import { number, price } from '@lumina/tools/format';
import { useTranslation } from 'react-i18next';
import type { PriceFloorPartProps } from '../types';
/**
* «تغییر کف قیمت به {x} تومان» (J11-11): the required reason, 10 characters at least, goes to «گزارش
* ممیزی», with the raise's warning repeated above it.
*/
export function ConfirmPriceFloorDialog({ model }: PriceFloorPartProps) {
const { t } = useTranslation('settings');
const affected =
model.preview.status === 'ready' ? model.preview.change : null;
return (
<ReasonDialog
open={model.isConfirming}
onClose={model.closeConfirm}
title={t('price-floor.confirm.title', {
amount: price(model.valueToman),
})}
placeholder={t('price-floor.confirm.placeholder')}
emptyReason={t('price-floor.confirm.empty')}
form={model.reasonForm}
onSubmit={model.confirm}
isSubmitting={model.isSaving}
confirmLabel={t('price-floor.confirm.submit')}
confirmVariant="primary"
>
{affected && affected.affectedTiers.length > 0 && (
<Banner tone="warning" icon="alert">
{t('price-floor.preview.warning', {
tiers: number(affected.affectedTiers.length),
analysts: number(affected.analystCount),
})}
</Banner>
)}
</ReasonDialog>
);
}

View File

@ -0,0 +1,176 @@
import type { PriceFloorPageModel } from '@lumina/garden-roof';
import { useReasonForm } from '@lumina/garden-roof/shared/utils';
import { render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, expect, it, vi } from 'vitest';
import '../../../../../../i18n/i18n.client';
import { PriceFloorForm } from './PriceFloorForm';
const change = {
monthlyMin: 250000,
analystCount: 1,
affectedTiers: [
{
tierId: 't1',
traderId: 'u1',
username: 'reza',
billingPeriod: 'monthly' as const,
labelFa: 'ماهانه',
finalMonthlyToman: 200000,
activeSubscribers: 4,
},
{
tierId: 't2',
traderId: 'u1',
username: null,
billingPeriod: 'yearly' as const,
labelFa: 'سالانه',
finalMonthlyToman: 210000,
activeSubscribers: 0,
},
],
};
function Harness(props: Partial<PriceFloorPageModel>) {
const reasonForm = useReasonForm();
const model: PriceFloorPageModel = {
currentToman: 199000,
changedAt: null,
text: '250٬000',
setText: vi.fn(),
error: null,
valueToman: 250000,
change: 'raise',
preview: { status: 'ready', change },
blockedReason: null,
isConfirming: false,
openConfirm: vi.fn(),
closeConfirm: vi.fn(),
reasonForm,
confirm: vi.fn(),
isSaving: false,
...props,
};
return <PriceFloorForm model={model} />;
}
describe('PriceFloorForm', () => {
it('shows the current value in the hint, and its last change once there is one', () => {
const { rerender } = render(<Harness />);
expect(screen.getByText(/هنوز تغییری ثبت نشده است/)).toBeTruthy();
rerender(<Harness changedAt="2026-10-23T08:00:00.000Z" />);
expect(screen.getByText(/آخرین تغییر:/)).toBeTruthy();
});
it('a raise warns with how many plans and analysts, and lists each', () => {
render(<Harness />);
expect(
screen.getByText('2 طرح از 1 تحلیلگر زیر کف جدید می‌مانند.'),
).toBeTruthy();
const table = screen.getByRole('table');
expect(within(table).getByText('@reza')).toBeTruthy();
expect(within(table).getByText('ماهانه')).toBeTruthy();
expect(within(table).getByText('200٬000')).toBeTruthy();
expect(within(table).getByText('4')).toBeTruthy();
expect(within(table).getByText('حساب نامشخص')).toBeTruthy();
});
it('a raise that takes nothing says so, with no table', () => {
render(
<Harness
preview={{
status: 'ready',
change: { monthlyMin: 250000, analystCount: 0, affectedTiers: [] },
}}
/>,
);
expect(screen.getByText('هیچ طرحی زیر کف جدید نمی‌ماند.')).toBeTruthy();
expect(screen.queryByRole('table')).toBeNull();
});
it('a lower floor says it changes nothing yet, with no preview', () => {
render(<Harness change="lower" preview={{ status: 'idle' }} />);
expect(screen.getByText(/چیزی تغییر نمی‌کند/)).toBeTruthy();
expect(screen.queryByRole('table')).toBeNull();
});
it('a failed preview offers to try again', async () => {
const retry = vi.fn();
render(<Harness preview={{ status: 'error', retry }} />);
await userEvent.click(screen.getByRole('button', { name: 'تلاش دوباره' }));
expect(retry).toHaveBeenCalled();
});
it('«ذخیره» waits and says why while blocked', async () => {
const openConfirm = vi.fn();
render(
<Harness
openConfirm={openConfirm}
blockedReason="settings:price-floor.blocked.preview"
/>,
);
const save = screen.getByText('ذخیره').closest('button')!;
expect(save.classList.contains('frozen')).toBe(true);
await userEvent.click(save);
expect(openConfirm).not.toHaveBeenCalled();
expect(
screen.getByText(
'پیش از ذخیره باید پیش‌نمایش طرح‌های زیر کف آماده باشد.',
),
).toBeTruthy();
});
it('«ذخیره» opens the confirmation', async () => {
const openConfirm = vi.fn();
render(<Harness openConfirm={openConfirm} />);
await userEvent.click(screen.getByRole('button', { name: 'ذخیره' }));
expect(openConfirm).toHaveBeenCalled();
});
});
describe('ConfirmPriceFloorDialog', () => {
const dialog = () => screen.getByRole('dialog', { hidden: true });
it('names the new floor and asks a reason before saving', async () => {
const confirm = vi.fn();
render(<Harness isConfirming confirm={confirm} />);
expect(
within(dialog()).getByText('تغییر کف قیمت به 250٬000 تومان'),
).toBeTruthy();
const submit = within(dialog())
.getByText('ذخیره و اطلاع‌رسانی')
.closest('button')!;
expect(submit.classList.contains('frozen')).toBe(true);
await userEvent.click(submit);
expect(confirm).not.toHaveBeenCalled();
});
it('refuses a reason under 10 characters', async () => {
const confirm = vi.fn();
render(<Harness isConfirming confirm={confirm} />);
await userEvent.type(
within(dialog()).getByRole('textbox', { hidden: true }),
'کوتاه',
);
await userEvent.click(
within(dialog()).getByText('ذخیره و اطلاع‌رسانی').closest('button')!,
);
await waitFor(() => expect(confirm).not.toHaveBeenCalled());
});
it('saves with the trimmed reason', async () => {
const confirm = vi.fn();
render(<Harness isConfirming confirm={confirm} />);
await userEvent.type(
within(dialog()).getByRole('textbox', { hidden: true }),
' افزایش کف قیمت پس از بازبینی. ',
);
await userEvent.click(
within(dialog()).getByText('ذخیره و اطلاع‌رسانی').closest('button')!,
);
await waitFor(() =>
expect(confirm).toHaveBeenCalledWith('افزایش کف قیمت پس از بازبینی.'),
);
});
});

View File

@ -0,0 +1,80 @@
'use client';
import { translateMessage } from '@lumina/garden-roof/shared/utils';
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { Banner } from '@lumina/island/molecules/banner';
import { Card } from '@lumina/island/molecules/card';
import { TextInput } from '@lumina/island/molecules/text-input';
import { date, price } from '@lumina/tools/format';
import { useId } from 'react';
import { useTranslation } from 'react-i18next';
import type { PriceFloorPartProps } from '../types';
import { ConfirmPriceFloorDialog } from './ConfirmPriceFloorDialog';
import { PriceFloorPreview } from './PriceFloorPreview';
/**
* The card (J11-11): «کف ماهانه» with the current value and its last change as the hint, then what
* the typed value does: a raise previews the tiers it takes off sale, a lower floor says it changes
* nothing yet. «ذخیره» opens the confirmation once that is known, and says why it waits until then.
*/
export function PriceFloorForm({ model }: PriceFloorPartProps) {
const { t } = useTranslation('settings');
const headingId = useId();
const current = price(model.currentToman);
return (
<>
<Card tag="section" aria-labelledby={headingId} padding="lg">
<FlexBox direction="flex-col" gap="gap-4">
<FlexBox direction="flex-col" gap="gap-1">
<Typography tag="h2" id={headingId} variant="heading-sm">
{t('price-floor.title')}
</Typography>
<Typography variant="body-sm" color="secondary">
{t('price-floor.description')}
</Typography>
</FlexBox>
<TextInput
label={t('price-floor.field')}
inputMode="numeric"
suffix={t('price-floor.currency')}
value={model.text}
onChange={(event) => model.setText(event.target.value)}
error={translateMessage(t, model.error ?? undefined)}
hint={
model.changedAt
? t('price-floor.hint', {
current,
date: date(model.changedAt, { time: false }),
})
: t('price-floor.hint-never', { current })
}
/>
{model.change === 'lower' && (
<Banner tone="info" icon="info">
{t('price-floor.lower-note')}
</Banner>
)}
<PriceFloorPreview preview={model.preview} />
<FlexBox>
<Button
variant="primary"
frozen={model.blockedReason !== null}
frozenReason={translateMessage(
t,
model.blockedReason ?? undefined,
)}
onClick={model.openConfirm}
>
{t('price-floor.save')}
</Button>
</FlexBox>
</FlexBox>
</Card>
<ConfirmPriceFloorDialog model={model} />
</>
);
}

View File

@ -0,0 +1,108 @@
'use client';
import type { PriceFloorPreview as PriceFloorPreviewModel } from '@lumina/garden-roof';
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Spinner } from '@lumina/island/atoms/spinner';
import { Typography } from '@lumina/island/atoms/typography';
import { Banner } from '@lumina/island/molecules/banner';
import { DataTable } from '@lumina/island/organisms/data-table';
import { Element } from '@lumina/island/primitives/element';
import { number, price } from '@lumina/tools/format';
import { useTranslation } from 'react-i18next';
/**
* What a raise takes off sale (J11-11): the warning with how many plans of how many analysts, and
* each plan's analyst, final monthly price and active subscribers. It scrolls sideways on a narrow
* column. Nothing while the floor isn't being raised.
*/
export function PriceFloorPreview({
preview,
}: {
preview: PriceFloorPreviewModel;
}) {
const { t } = useTranslation('settings');
if (preview.status === 'idle') return null;
if (preview.status === 'loading') {
return (
<FlexBox tag="output" alignItems="items-center" gap="gap-2">
<Spinner />
<Typography variant="body-sm" color="secondary">
{t('price-floor.preview.loading')}
</Typography>
</FlexBox>
);
}
if (preview.status === 'error') {
return (
<Banner
tone="danger"
action={
<Button variant="secondary" size="sm" onClick={preview.retry}>
{t('price-floor.preview.retry')}
</Button>
}
>
{t('price-floor.preview.error')}
</Banner>
);
}
const { affectedTiers, analystCount } = preview.change;
if (affectedTiers.length === 0) {
return (
<Banner tone="info" icon="check">
{t('price-floor.preview.none')}
</Banner>
);
}
return (
<FlexBox direction="flex-col" gap="gap-3">
<Banner tone="warning" icon="alert">
{t('price-floor.preview.warning', {
tiers: number(affectedTiers.length),
analysts: number(analystCount),
})}
</Banner>
<Element className="overflow-x-auto">
<DataTable label={t('price-floor.preview.table')}>
<DataTable.Head>
<DataTable.HeaderCell>
{t('price-floor.preview.columns.analyst')}
</DataTable.HeaderCell>
<DataTable.HeaderCell>
{t('price-floor.preview.columns.plan')}
</DataTable.HeaderCell>
<DataTable.HeaderCell>
{t('price-floor.preview.columns.price')}
</DataTable.HeaderCell>
<DataTable.HeaderCell>
{t('price-floor.preview.columns.subscribers')}
</DataTable.HeaderCell>
</DataTable.Head>
<DataTable.Body>
{affectedTiers.map((tier) => (
<DataTable.Row key={tier.tierId}>
<DataTable.Cell>
{tier.username ? (
<Element tag="bdi" dir="ltr">
@{tier.username}
</Element>
) : (
t('price-floor.preview.unknown')
)}
</DataTable.Cell>
<DataTable.Cell>{tier.labelFa}</DataTable.Cell>
<DataTable.Cell>{price(tier.finalMonthlyToman)}</DataTable.Cell>
<DataTable.Cell>
{number(tier.activeSubscribers)}
</DataTable.Cell>
</DataTable.Row>
))}
</DataTable.Body>
</DataTable>
</Element>
</FlexBox>
);
}

View File

@ -0,0 +1,11 @@
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
import type { PriceFloorSkeletonProps } from '../types';
/** The card before it arrives. */
export function PriceFloorSkeleton({
label,
delayed,
}: PriceFloorSkeletonProps) {
return <SkeletonPreset preset="form" label={label} delayed={delayed} />;
}

View File

@ -0,0 +1,3 @@
export { PriceFloorSkeleton } from './components/PriceFloorSkeleton';
export { PriceFloorCard } from './PriceFloorCard';
export type { PriceFloorPartProps, PriceFloorSkeletonProps } from './types';

View File

@ -0,0 +1,10 @@
import type { PriceFloorPageModel } from '@lumina/garden-roof';
export type PriceFloorPartProps = { model: PriceFloorPageModel };
export type PriceFloorSkeletonProps = {
/** Hidden status text. */
label: string;
/** Fades in after 300ms: loading.tsx only. */
delayed?: boolean;
};

View File

@ -0,0 +1,39 @@
import { PartBoundary } from '@lumina/garden-roof/app/error-boundaries';
import { AdminGuard } from '@lumina/garden-roof/app/guards';
import { PageHeader } from '@lumina/island/molecules/page-header';
import type { Metadata } from 'next';
import { Suspense } from 'react';
import { i18n } from '../../../i18n';
import { PriceFloorCard, PriceFloorSkeleton } from './organisms/price-floor-card';
export const metadata: Metadata = { title: i18n.t('settings:page.meta-title') };
/**
* تنظیمات (J11-11): the title on the server; «کف قیمت اشتراک» in the browser once the admin is known
* (0062).
*/
export default function SettingsPage() {
const skeleton = (
<PriceFloorSkeleton label={i18n.t('settings:page.loading')} />
);
return (
<>
<PageHeader
title={i18n.t('settings:page.title')}
subtitle={i18n.t('settings:page.subtitle')}
/>
<AdminGuard fallback={skeleton}>
<PartBoundary
name="settings"
description={i18n.t('settings:page.error')}
>
<Suspense fallback={skeleton}>
<PriceFloorCard />
</Suspense>
</PartBoundary>
</AdminGuard>
</>
);
}

View File

@ -6,13 +6,13 @@ bull (mobile) and bear (desktop) share one doc per route under `market/`, with b
## market
Only `/` is indexable (0071), and it is the only page whose content the server renders (0070). Every other page is `noindex`; all but the rules pages render their content in the browser.
Only `/` is indexable (0071), and it is the only page whose content the server renders (0070). Every other page is `noindex` and renders its content in the browser.
Layouts and error pages:
- root layout · [layout.md](market/layout.md) · — · — · browser: NetworkStatus, Toaster, ToastPlacementMarker (bear)
- `(main)` layout · [layout-main.md](market/layout-main.md) · — · — · browser: bear header nav, search field, publish menu, notification bell, notification panel, login button or account menu, `@modal` slot; bull BottomNav
- `(flow)/terms` layout · [layout-terms.md](market/layout-terms.md) · — · — · browser: MobileTopBar title (bull), DesktopHeader viewer parts (bear)
- `(flow)/terms/(tabs)` layout · [layout-terms.md](market/layout-terms.md) · — · — · browser: MobileTopBar title (bull), DesktopHeader viewer parts (bear)
- `(main)/dashboard/(creator)` layout · [layout-dashboard-creator.md](market/layout-dashboard-creator.md) · — · — · browser: OnboardingGuard redirect, notification bell and account avatar (bull)
- `(main)/dashboard/(investor)` layout · [layout-dashboard-investor.md](market/layout-dashboard-investor.md) · — · — · browser: notification bell and account avatar (bull)
- not-found and error · [not-found.md](market/not-found.md) · noindex · none · browser: not-found top bar, every group `error.tsx`, `global-error.tsx`
@ -20,8 +20,6 @@ Layouts and error pages:
Rendered on the server:
- `/` · [home.md](market/home.md) · index · FAQPage · browser: LandingRedirect
- `/terms` · [terms.md](market/terms.md) · noindex · none · browser: none
- `/terms/subscription` · [terms-subscription.md](market/terms-subscription.md) · noindex · none · browser: none
`(main)`:
@ -44,6 +42,9 @@ Rendered on the server:
`(flow)`:
- `/terms` · [terms.md](market/terms.md) · noindex · none · browser: LegalDocumentView
- `/terms/subscription` · [terms-subscription.md](market/terms-subscription.md) · noindex · none · browser: SubscriptionTerms
- `/terms/analyst-agreement` · [terms-analyst-agreement.md](market/terms-analyst-agreement.md) · noindex · none · browser: top-bar title, AnalystAgreement
- `/account/profile` · [account-profile.md](market/account-profile.md) · noindex · none · browser: AccountProfile (investor form or creator profile edit), LeaveDialog
- `/checkout/[username]` · [checkout-username.md](market/checkout-username.md) · noindex · none · browser: CheckoutCreator, CheckoutPanel, CheckoutForm (tiers, code, pay footer), CheckoutHalts, NoCodeSheet
- `/compose/post` · [compose-post.md](market/compose-post.md) · noindex · none · browser: PostComposer, ComposerForm, LeaveConfirm, PostComposerDialog (bear `@modal`)
@ -84,6 +85,7 @@ Every page renders in the browser behind `AdminGuard` or `GuestGuard` (0062).
- `/invite-codes/requests` · [invite-codes-requests.md](wall-street-plaza/invite-codes-requests.md) · noindex · none · browser: request rows, code dialogs
- `/payouts` · [payouts.md](wall-street-plaza/payouts.md) · noindex · none · browser: tabs, payout rows, payout detail sheet, create, mark-paid and cancel dialogs
- `/predictions` · [predictions.md](wall-street-plaza/predictions.md) · noindex · none · browser: quote health, queue tabs, queue rows, prediction sheet, prediction dialogs
- `/settings` · [settings.md](wall-street-plaza/settings.md) · noindex · none · browser: price floor card, raise preview, confirm dialog
- `/subscriptions` · [subscriptions.md](wall-street-plaza/subscriptions.md) · noindex · none · browser: filter chips, subscription rows, detail sheet, grant dialog
- `/verifications` · [verifications.md](wall-street-plaza/verifications.md) · noindex · none · browser: status tabs, search and sort, verification rows
- `/verifications/[id]` · [verifications-id.md](wall-street-plaza/verifications-id.md) · noindex · none · browser: queue nav, banner, facts, decisions, past submissions, ID image, audit log, decision dialogs

View File

@ -17,17 +17,17 @@
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| ------------------------------- | ------------- | ----------- | ------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | config | first flush | hydrate | no | a pushed page's bar: back and support |
| ↳ Title or login link (bull) | viewer | skeleton | hydrate | no | |
| DesktopPageTitle (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 |
| AccountOverview | viewer | skeleton | hydrate | no | `AuthGuard` with `AccountOverviewSkeleton`, in `PartBoundary name="account-overview"`; bear: `framed` |
| ↳ IdentityCard, CreatorFacts | viewer, query | skeleton | hydrate | no | creators also get the review badge, followers and subscribers: browser `useQuery`s that never throw and leave out what fails |
| ↳ PrivacyNote | config | skeleton | hydrate | no | investors only |
| ↳ Settings and help lists | viewer | skeleton | hydrate | no | `ListRow` links to `/account/profile`, `/dashboard/finance#…` (creators), `/account/notifications`, `/account/install` (not in the installed app), `/terms`; پشتیبانی opens `SupportDialog` |
| ↳ Sign-out button | — | skeleton | hydrate | no | `SignOutConfirm` asks first (0041) |
| ↳ SupportDialog, SignOutConfirm | — | none | hydrate | no | rendered with `open`; statically imported |
| Section | Data | HTML | JS | Index | Notes |
| ------------------------------- | ------------- | ----------- | ------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| MobileTopBar (bull) | config | first flush | hydrate | no | a pushed page's bar: back and support |
| ↳ Title or login link (bull) | viewer | skeleton | hydrate | no | |
| DesktopPageTitle (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 |
| AccountOverview | viewer | skeleton | hydrate | no | `AuthGuard` with `AccountOverviewSkeleton`, in `PartBoundary name="account-overview"`; bear: `framed` |
| ↳ IdentityCard, CreatorFacts | viewer, query | skeleton | hydrate | no | creators also get the review badge, followers and subscribers: browser `useQuery`s that never throw and leave out what fails |
| ↳ PrivacyNote | config | skeleton | hydrate | no | investors only |
| ↳ Settings and help lists | viewer | skeleton | hydrate | no | `ListRow` links to `/account/profile`, `/dashboard/finance#…` (creators), `/account/notifications`, `/account/install` (not in the installed app), `/terms`, `/terms/analyst-agreement` (creators, with version and date from `GET /me/legal-acceptances`); پشتیبانی opens `SupportDialog` |
| ↳ Sign-out button | — | skeleton | hydrate | no | `SignOutConfirm` asks first (0041) |
| ↳ SupportDialog, SignOutConfirm | — | none | hydrate | no | rendered with `open`; statically imported |
## Notes

View File

@ -26,6 +26,7 @@ In bull's document order.
| ↳ SupportDialog | config | none | hydrate | no | island `Dialog` mounts its content only while open |
| NetworkBar | — | none | hydrate | no | under the bar, only while offline or reconnecting |
| LoginStep | viewer | skeleton | hydrate | no | `GuestGuard` shows `SkeletonPreset preset="form"` until the viewer is known; guest: H1, phone form, register link, support; member: replaced to `?redirect=`, home, or step 5 when `needsProfile` |
| ↳ RulesCaption | config | none | hydrate | no | under the submit button; its link opens `LegalDocumentDialog`, which reads `GET /legal/platform_rules` only when opened; a sheet on bull, a modal on bear |
## Notes

View File

@ -17,21 +17,20 @@
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| -------------------------- | ------ | ----------- | ------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuthTopBar (bull) | config | first flush | none | no | back button and `auth:register.header` |
| ↳ BackButton (bull) | URL | first flush | hydrate | no | `<a href="/">`, keeping `?redirect=` |
| AuthTemplate header (bear) | config | first flush | none | no | brand `<a href="/">` |
| StepBack (bear) | URL | first flush | hydrate | no | «بازگشت» above the card to `/` |
| SupportEntry | — | first flush | hydrate | no | in the bar; the dialog mounts only when open |
| NetworkBar | — | none | hydrate | no | under the bar, only while offline or reconnecting |
| RegisterDetailsStep | viewer | skeleton | hydrate | no | `GuestGuard` fallback `SkeletonPreset preset="form" count={3}`; investor: `InvestorDetailsForm`; creator: `CreatorIdentityForm`, both in `DetailsFrame` |
| ↳ ExpiryWarning | clock | none | hydrate | no | two minutes before the token ends; `Countdown kind="otp"` and «تمدید زمان» |
| ↳ ExpiryHalt | viewer | none | hydrate | no | when the token ends; bull: sheet; bear: modal |
| ↳ LeaveRegistrationDialog | — | none | hydrate | no | back asks whether to leave and resume later (J02-3f) |
| ↳ RulesSheet | config | none | hydrate | no | «قوانین لومینا» in `TermsLine`; `GeneralRules` rendered on the server and passed as `rules`; bull: sheet; bear: modal; mounts when opened |
| Section | Data | HTML | JS | Index | Notes |
| -------------------------- | ------ | ----------- | ------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuthTopBar (bull) | config | first flush | none | no | back button and `auth:register.header` |
| ↳ BackButton (bull) | URL | first flush | hydrate | no | `<a href="/">`, keeping `?redirect=` |
| AuthTemplate header (bear) | config | first flush | none | no | brand `<a href="/">` |
| StepBack (bear) | URL | first flush | hydrate | no | «بازگشت» above the card to `/` |
| SupportEntry | — | first flush | hydrate | no | in the bar; the dialog mounts only when open |
| NetworkBar | — | none | hydrate | no | under the bar, only while offline or reconnecting |
| RegisterDetailsStep | viewer | skeleton | hydrate | no | `GuestGuard` fallback `SkeletonPreset preset="form" count={3}`; investor: `InvestorDetailsForm`; creator: `CreatorIdentityForm`, both in `DetailsFrame` |
| ↳ ExpiryWarning | clock | none | hydrate | no | two minutes before the token ends; `Countdown kind="otp"` and «تمدید زمان» |
| ↳ ExpiryHalt | viewer | none | hydrate | no | when the token ends; bull: sheet; bear: modal |
| ↳ LeaveRegistrationDialog | — | none | hydrate | no | back asks whether to leave and resume later (J02-3f) |
| ↳ AgreementBlock (creator) | query | none | hydrate | no | the first block for an analyst: `GET /legal/analyst_agreement`, «خواندن متن» opens `LegalDocumentDialog`, the checkbox unfreezes «ثبت و ادامه», and the version goes with the form |
## Notes
- Decision 0013: the step renders only in the browser on the 15-minute token, held in memory.
- `GeneralRules` is a Server Component passed into the client step, so its text is in the RSC payload of every response, though it reaches the DOM only when the sheet opens.

View File

@ -17,15 +17,16 @@
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| -------------------------- | ------ | ----------- | ------- | ----- | -------------------------------------------------------------------------------------------------------- |
| AuthTopBar (bull) | config | first flush | none | no | back button and `auth:register.header` |
| ↳ BackButton (bull) | URL | first flush | hydrate | no | `<a href>` to `/auth/register`, keeping `?redirect=` |
| AuthTemplate header (bear) | config | first flush | none | no | brand `<a href="/">` |
| StepBack (bear) | URL | first flush | hydrate | no | «بازگشت» above the card to `/auth/register` |
| SupportEntry | — | first flush | hydrate | no | in the bar; the dialog mounts only when open |
| NetworkBar | — | none | hydrate | no | under the bar, only while offline or reconnecting |
| RegisterPhoneStep | viewer | skeleton | hydrate | no | `GuestGuard` fallback `SkeletonPreset preset="form" count={1}`; guest: progress, H1, phone form, support |
| Section | Data | HTML | JS | Index | Notes |
| -------------------------- | ------ | ----------- | ------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuthTopBar (bull) | config | first flush | none | no | back button and `auth:register.header` |
| ↳ BackButton (bull) | URL | first flush | hydrate | no | `<a href>` to `/auth/register`, keeping `?redirect=` |
| AuthTemplate header (bear) | config | first flush | none | no | brand `<a href="/">` |
| StepBack (bear) | URL | first flush | hydrate | no | «بازگشت» above the card to `/auth/register` |
| SupportEntry | — | first flush | hydrate | no | in the bar; the dialog mounts only when open |
| NetworkBar | — | none | hydrate | no | under the bar, only while offline or reconnecting |
| RegisterPhoneStep | viewer | skeleton | hydrate | no | `GuestGuard` fallback `SkeletonPreset preset="form" count={1}`; guest: progress, H1, phone form, support |
| ↳ RulesCaption | config | none | hydrate | no | under the submit button; its link opens `LegalDocumentDialog`, which reads `GET /legal/platform_rules` only when opened; a sheet on bull, a modal on bear |
## Notes

View File

@ -17,16 +17,17 @@
In bull's document order. `compose/layout.tsx` is only `OnboardingGuard` (0016): it renders nothing, and sends a creator who hasn't finished step 5 to the creator profile.
| Section | Data | HTML | JS | Index | Notes |
| ------------------------------- | ------ | ----------- | ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DesktopHeader (bear) | viewer | first flush | hydrate | no | the page renders it itself; rows as in [layout-main.md](layout-main.md) |
| PredictionComposer | viewer | skeleton | hydrate | no | `AuthGuard role="creator"`, fallback `SkeletonPreset form`; `usePublishAccess`: pending keeps the skeleton, blocked sends the creator to their channel (J09-1e, 0060) |
| ↳ ComposerPage | viewer | skeleton | hydrate | no | bull: `MobileTopBar`, the «انصراف» row, the fields, the preview, and «انتشار پیش‌بینی» pinned; bear: a 960 card drawn as the dialog, with its `h1`, the fields beside the preview; published, it replaces itself with the creator's channel |
| ↳ SymbolPicker | query | none | hydrate | no | «انتخاب نماد»: bull: a sheet; bear: a modal; mounts on open, then searches symbols in the browser |
| ↳ ConfirmPublish, LeaveConfirm | — | none | hydrate | no | mount on publish and on leaving with something to lose |
| PredictionComposerDialog (bear) | viewer | none | interaction | no | the `@modal` intercept (J09-1-D, 0023), on a soft navigation from a main page: the 960 dialog over that page; fallback `PredictionComposerDialogSkeleton`; anyone but a creator gets no-access inside the dialog |
| Section | Data | HTML | JS | Index | Notes |
| ------------------------------- | ------ | ----------- | ----------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DesktopHeader (bear) | viewer | first flush | hydrate | no | the page renders it itself; rows as in [layout-main.md](layout-main.md) |
| PredictionComposer | viewer | skeleton | hydrate | no | `AuthGuard role="creator"`, fallback `SkeletonPreset form`; `usePublishAccess`: pending keeps the skeleton, blocked sends the creator to their channel (J09-1e, 0060) |
| ↳ ComposerPage | viewer | skeleton | hydrate | no | bull: `MobileTopBar`, the «انصراف» row, the fields, the preview, and «انتشار سیگنال» pinned; bear: a 960 card drawn as the dialog, with its `h1`, the fields beside the preview; published, it replaces itself with the creator's channel |
| ↳ SymbolPicker | query | none | hydrate | no | «انتخاب نماد»: bull: a sheet; bear: a modal; mounts on open, then searches symbols in the browser |
| ↳ ConfirmPublish, LeaveConfirm | — | none | hydrate | no | mount on publish and on leaving with something to lose |
| PredictionComposerDialog (bear) | viewer | none | interaction | no | the `@modal` intercept (J09-1-D, 0023), on a soft navigation from a main page: the 960 dialog over that page; fallback `PredictionComposerDialogSkeleton`; anyone but a creator gets no-access inside the dialog |
## Notes
- The analyst states the entry: «قیمت دقیق» (prefilled from the live quote, following it until edited) or «بازه», and a required stop-loss. Levels are checked against that entry in the browser and again by the API (`docs/plans/pre-launch-tasks.md`, Task 2). The confirm step sends what it showed, even if the quote has moved since.
- A hard load or refresh gets the full page; a soft navigation from a `(main)` page gets the dialog over it (see [compose-post.md](compose-post.md)).
- Debt: different H1 per app. bull has no `h1`; add a screen-reader `h1` to `ComposerPage`'s mobile branch (`platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerPage.tsx:57`).

View File

@ -28,3 +28,7 @@ In bull's document order. Everything sits in `AuthGuard role="creator"`, whose f
- bull: cards 12px apart; bear: 16px apart, desktop card layouts. Same sections in both apps.
- The cards' queries run only in the browser: `AuthGuard` returns its fallback on the server, so no `useSuspenseQuery` sends a request from the server.
## Price floor
A plan the price floor took off sale gets a «خارج از فروش» badge on its row, and a banner above the card, «طرح {tier} شما از فروش خارج شد», with «اصلاح قیمت» to `/dashboard/pricing`. Both read `offSale` from the pricing form, so they load with the card.

View File

@ -9,7 +9,7 @@
| loading.tsx | `dashboard/predictions/all/loading.tsx`: the real top bar (bull) or page title (bear) over `PredictionListSkeleton`, `delayed` |
| First flush | none |
| Canonical | none: `noindex` |
| H1 | bull: none, the bar's «همه پیش‌بینی‌ها» is a `<span>`; bear: «همه پیش‌بینی‌ها» in `DesktopPageTitle` |
| H1 | bull: none, the bar's «همه سیگنال‌ها» is a `<span>`; bear: «همه سیگنال‌ها» in `DesktopPageTitle` |
| JSON-LD | none |
| Scripts | none beyond the layout's |

View File

@ -17,15 +17,16 @@
In bull's document order. Everything sits in `AuthGuard role="creator"`, whose fallback is `PredictionsTabSkeleton`.
| Section | Data | HTML | JS | Index | Notes |
| --------------------------------------- | ------ | -------- | ----------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| PredictionsTab | viewer | skeleton | hydrate | no | `useQuery` for open and closed; before the first prediction, only the empty state with «پیش‌بینی جدید» to `/compose/prediction` (J10-3c) |
| ↳ TrackRecord | viewer | skeleton | hydrate | no | the record or its progress to public; own `PartBoundary` and `<Suspense>` |
| ↳ PredictionSection «باز» | viewer | skeleton | hydrate | no | every open prediction as `OwnPredictionCard`; not drawn when empty; loads and fails on its own |
| ↳↳ ClosePredictionSheet | viewer | none | interaction | no | `next/dynamic`, rendered on the first «بستن زودهنگام» tap; its price poll loads with it |
| ↳ PredictionSection «بسته‌شده‌های اخیر» | viewer | skeleton | hydrate | no | the two closed most recently; then «همه پیش‌بینی‌ها», an `<a href>` to `/dashboard/predictions/all` |
| Section | Data | HTML | JS | Index | Notes |
| --------------------------------------- | ------ | -------- | ----------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PredictionsTab | viewer | skeleton | hydrate | no | `useQuery` for open and closed; before the first prediction, only the empty state with «سیگنال جدید» to `/compose/prediction` (J10-3c) |
| ↳ SignalPerformance | viewer | skeleton | hydrate | no | «عملکرد سیگنال‌ها» from `GET /me/signal-stats`: four tiles, outcome split, risk to reward, progress to public; before the first nightly evaluation a message, never zeros; own `PartBoundary` and `<Suspense>` |
| ↳ PredictionSection «باز» | viewer | skeleton | hydrate | no | every open prediction as `OwnPredictionCard`; not drawn when empty; loads and fails on its own |
| ↳↳ ClosePredictionSheet | viewer | none | interaction | no | `next/dynamic`, rendered on the first «بستن زودهنگام» tap; its price poll loads with it |
| ↳ PredictionSection «بسته‌شده‌های اخیر» | viewer | skeleton | hydrate | no | the two closed most recently; then «همه سیگنال‌ها», an `<a href>` to `/dashboard/predictions/all` |
## Notes
- bull and bear differ only in `layout` (card and sheet placement). A card's tap opens its post.
- `/dashboard/predictions/all` is a separate page outside the `(creator)` group, under its own `OnboardingGuard` layout: [dashboard-predictions-all.md](dashboard-predictions-all.md).
- The tiles, progress and pending state are `dashboard/organisms/signal-stat-tiles`, `signal-progress` and `signal-stats-pending`, read through `useSignalStatsPart`, so «نمای کلی» can show the same numbers. Tips (`withTips`) appear only on this tab.

View File

@ -29,3 +29,8 @@ In bull's document order. `dashboard/pricing/layout.tsx` is only `OnboardingGuar
- bull: the form pads itself and pins save to the bottom; bear: the form in the 560 column.
- Debt: different H1 per app. bull has no `h1`; add a screen-reader `h1` to `PricingEditor`'s mobile branch (`platforms/market/src/app/screens/(flow)/dashboard/pricing/organisms/pricing-editor/PricingEditor.tsx`, the `MobileTopBar` return).
## Price floor
- The floor comes from `GET /subscriptions/pricing` (`floorTomanPerMonth`), on the final price after any discount; the browser compares exact totals as the API does.
- During the 7-day lock a tier the floor took off sale (`offSale`) stays editable and shows «خارج از فروش»; the other tiers stay read-only, and the save reads «ذخیره قیمت‌گذاری» instead of «ذخیره تخفیف».

View File

@ -32,4 +32,4 @@ In bull's document order.
## Notes
- bear: `@modal/feed/page.tsx` renders null, so a «پست جدید» dialog closes when a navigation lands on خانه (0023).
- Debt: no H1 in either app. Give the page an `sr-only` H1, as `GeneralRules` does.
- Debt: no H1 in either app. Give the page an `sr-only` H1, as `LegalDocumentView` does.

View File

@ -8,7 +8,7 @@
| MobileTopBar (bull) | config | first flush | hydrate | no | `isTab`: the brand and «داشبورد» centred, in a `<span>`; support entry; the connection bar under it (0040) |
| ↳ NotificationBell and account avatar (bull) | viewer | none | hydrate | no | member only; while the viewer is unknown, the guest's «ورود/ثبت‌نام» holds the end of the bar, invisible |
| «داشبورد» `<h1>` (bear) | config | first flush | none | no | at the top of the 640 column |
| DashboardTabs | config | first flush | hydrate | no | `role="creator"`: island `TabLinks`, an `<a href>` per tab «طرح‌های اشتراک» · «پیش‌بینی‌ها» · «مالی» (0034); the active tab comes from `usePathname`, so the server HTML already marks it |
| DashboardTabs | config | first flush | hydrate | no | `role="creator"`: island `TabLinks`, an `<a href>` per tab «طرح‌های اشتراک» · «سیگنال‌ها» · «مالی» (0034); the active tab comes from `usePathname`, so the server HTML already marks it |
Scripts: none beyond the root layout's.

View File

@ -8,7 +8,7 @@
| ↳ Brand link (bear) | viewer | first flush | hydrate | no | `useHomeHref`: `/feed` while the viewer is unknown (so in the server HTML), `/` for a guest, `homeRoute` for a member |
| ↳ Nav: خانه or کانال, داشبورد (bear) | viewer | none | hydrate | no | members only; `HeaderNavLink` is `next/link` |
| ↳ SearchField (bear) | viewer | none | hydrate | no | investors only, not on `/search`; Enter calls `router.push('/search?q=…')` |
| ↳ PublishMenu (bear) | viewer | none | hydrate | no | creators only; «پست جدید» and «پیش‌بینی جدید» open the `@modal` intercepts (0023) |
| ↳ PublishMenu (bear) | viewer | none | hydrate | no | creators only; «پست جدید» and «سیگنال جدید» open the `@modal` intercepts (0023) |
| ↳ SupportEntry (bear) | config | first flush | hydrate | no | the icon trigger; its `SupportDialog` popover renders only while open |
| ↳ NotificationBell (bear) | viewer | none | hydrate | no | members only; the unread count is a browser `useQuery` |
| ↳ NotificationPanel (bear) | query | none | interaction | no | the bell's side panel: `next/dynamic` with `ssr: false`, mounted on the bell's first click |

View File

@ -1,10 +1,10 @@
# Layout: terms
`apps/{bull,bear}/src/app/(flow)/terms/layout.tsx` · wraps `/terms` and `/terms/subscription` · it awaits no read: its text is server i18n (`rules`), so it adds nothing to the first byte
`apps/{bull,bear}/src/app/(flow)/terms/(tabs)/layout.tsx` · wraps `/terms` and `/terms/subscription` · it awaits no read: its bar and tabs are server i18n (`rules`), so it adds nothing to the first byte; each page reads its text in the browser
| Section | Data | HTML | JS | Index | Notes |
| ------------------------------------ | ------ | ----------- | ------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to where the rules were opened, and support, in the first flush; the title «قوانین لومینا» waits for the viewer |
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to where the rules were opened, and support, in the first flush; the title «قوانین و مقررات لومینا» waits for the viewer |
| DesktopHeader (bear) | viewer | skeleton | hydrate | no | brand `<a href>` and support in the first flush; nav, bell, account menu and login wait for the viewer ([layout-main.md](layout-main.md)) |
| DesktopPageTitle, with the H1 (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 `rules:title`; bull puts its H1 in each page instead |
| RulesTabs | config | first flush | hydrate | no | `TabLinks`: `<a href>` to `/terms` and `/terms/subscription`; `usePathname` marks the current tab |
@ -13,4 +13,4 @@ Scripts: none.
- (flow) adds `force-dynamic` and no UI. The layout's static `metadata` gives `rules:meta-title` and `rules:meta-description`; each page overrides them.
- bull: a white page with no bottom nav; bear: `DesktopHeader` over the 640px column, since (flow) has no header of its own.
- Debt: bear's H1 lives here, so `/terms/subscription` gets «قوانین لومینا» on bear and «شرایط اشتراک» on bull (`apps/bear/src/app/(flow)/terms/layout.tsx:40`). Pass each page's own title to `DesktopPageTitle`, or render the H1 in the page as bull does.
- Debt: bear's H1 lives here, so `/terms/subscription` gets «قوانین و مقررات لومینا» on bear and «شرایط اشتراک» on bull (`apps/bear/src/app/(flow)/terms/(tabs)/layout.tsx`). Pass each page's own title to `DesktopPageTitle`, or render the H1 in the page as bull does.

View File

@ -23,7 +23,7 @@ In bull's document order.
| ↳ Title or login link (bull) | viewer | skeleton | hydrate | no | |
| DesktopPageTitle (bear) | config | first flush | hydrate | no | «بازگشت» and the H1 |
| NotificationCentre | viewer, query | skeleton | hydrate | no | `AuthGuard`, then `<Suspense>` and `PartBoundary name="notification-centre"`; `useSuspenseQuery` of the inbox; opening clears the bell (0058); bear: `framed` |
| ↳ FilterChips | viewer | skeleton | hydrate | no | creators only: «همه · پیش‌بینی‌ها · مالی · حساب», filtered in place (0058) |
| ↳ FilterChips | viewer | skeleton | hydrate | no | creators only: «همه · سیگنال‌ها · مالی · حساب», filtered in place (0058) |
| ↳ NotificationItem list | query | skeleton | hydrate | no | each row leads to its target; a row stays unread until tapped |
## Notes

View File

@ -0,0 +1,28 @@
# Analyst agreement
`/terms/analyst-agreement` · `apps/{bull,bear}/src/app/(flow)/terms/analyst-agreement/page.tsx` · Type: account and data · Layout: its own, [layout.md](layout.md)
| Field | Value |
| ----------- | ------------------------------------------------------------------------ |
| Robots | `noindex` (the page's layout, 0071) |
| Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/analyst-agreement/loading.tsx` |
| First flush | the bar or header and the title `rules:agreement.title` |
| Canonical | none: `noindex` |
| H1 | bull: the document's title, screen-reader-only; bear: `DesktopPageTitle` |
| JSON-LD | none |
| Scripts | none |
## Sections
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| -------------------------------------- | ------------- | ----------- | ------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------- |
| MobileTopBar (bull) | config | first flush | hydrate | no | back, with «توافق‌نامه تحلیلگر» as the title; no bottom nav |
| DesktopHeader, DesktopPageTitle (bear) | config | first flush | hydrate | no | the 640 column under the header |
| AnalystAgreement | viewer, query | skeleton | hydrate | no | `AuthGuard role="creator"`; `GET /legal/analyst_agreement`, then «نسخه … · پذیرفته‌شده در …، ساعت …» from `GET /me/legal-acceptances` |
## Notes
- It sits outside the `(tabs)` route group, so it has neither the tabs nor their title.

View File

@ -1,26 +1,26 @@
# Subscription terms
`/terms/subscription` · `apps/{bull,bear}/src/app/(flow)/terms/subscription/page.tsx` · Type: static and policy · Layout: [layout-terms.md](layout-terms.md), [layout.md](layout.md)
`/terms/subscription` · `apps/{bull,bear}/src/app/(flow)/terms/(tabs)/subscription/page.tsx` · Type: account and data · Layout: [layout-terms.md](layout-terms.md), [layout.md](layout.md)
| Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/subscription/loading.tsx` (debt, Notes) |
| First flush | none: config, server i18n (`terms`, `auth`) and `getEnv().supportHours` |
| Canonical | none: `noindex` |
| H1 | bull: `terms:title` «شرایط اشتراک», screen-reader-only, in `SubscriptionTerms`; bear: `rules:title` «قوانین لومینا» from the layout (debt) |
| JSON-LD | none |
| Scripts | none |
| Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------------------ |
| Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/(tabs)/subscription/loading.tsx` |
| First flush | the layout's bar and tabs |
| Canonical | none: `noindex` |
| H1 | bull: the document's title, screen-reader-only, in `LegalDocumentView`; bear: `rules:title` from the layout (debt) |
| JSON-LD | none |
| Scripts | none |
## Sections
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| ------------------------- | ------ | ----------- | ---- | ----- | ---------------------------------------------------------------------------------------------- |
| SubscriptionTerms | config | first flush | none | no | one `<section>` per term with its heading; bear: in a `Card` |
| ↳ Support hours and chats | config | first flush | none | no | island `SupportSheet` rows: `<a href>` to the Bale and Telegram chats, inside the last section |
| Section | Data | HTML | JS | Index | Notes |
| ------------------------- | ------ | -------- | ------- | ----- | ------------------------------------------------------------------------------------- |
| SubscriptionTerms | query | skeleton | hydrate | no | `GET /legal/subscription_terms` through `LegalDocumentView`; bear: in a `Card` |
| ↳ Support hours and chats | config | skeleton | hydrate | no | island `SupportSheet` rows: `<a href>` to the Bale and Telegram chats, under the text |
## Notes

View File

@ -1,24 +1,27 @@
# General rules
# Rules and regulations
`/terms` · `apps/{bull,bear}/src/app/(flow)/terms/page.tsx` · Type: static and policy · Layout: [layout-terms.md](layout-terms.md), [layout.md](layout.md)
`/terms` · `apps/{bull,bear}/src/app/(flow)/terms/(tabs)/page.tsx` · Type: account and data · Layout: [layout-terms.md](layout-terms.md), [layout.md](layout.md)
| Field | Value |
| ----------- | ------------------------------------------------------------------------------------------------------ |
| Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/loading.tsx` (debt, Notes) |
| First flush | none: config and server i18n (`rules`) |
| Canonical | none: `noindex` |
| H1 | `rules:title`; bull: a screen-reader-only H1 in `GeneralRules`; bear: `DesktopPageTitle` in the layout |
| JSON-LD | none |
| Scripts | none |
| Field | Value |
| ----------- | --------------------------------------------------------------------------------------------------------- |
| Robots | `noindex` (`terms` layout `metadata`, 0071) |
| Status | `200` |
| loading.tsx | `apps/{bull,bear}/src/app/(flow)/terms/(tabs)/loading.tsx` |
| First flush | the layout's bar and tabs |
| Canonical | none: `noindex` |
| H1 | bull: the document's title, screen-reader-only, in `LegalDocumentView`; bear: `rules:title` in the layout |
| JSON-LD | none |
| Scripts | none |
## Sections
In bull's document order.
| Section | Data | HTML | JS | Index | Notes |
| ------------ | ------ | ----------- | ---- | ----- | ---------------------------------------------------------------------------------------- |
| GeneralRules | config | first flush | none | no | one `<section>` per rule with its heading, then the last-updated line; bear: in a `Card` |
| Section | Data | HTML | JS | Index | Notes |
| ----------------- | ----- | -------- | ------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| LegalDocumentView | query | skeleton | hydrate | no | `GET /legal/platform_rules` in the browser (0070), with `ErrorState` and a retry; «قوانین پلتفرم» and «حریم خصوصی», then the footer «نسخه … · آخرین به‌روزرسانی: …»; bear: in a `Card` |
## Notes
- The text lives in the database, so it changes without a deploy (`features/legal`). `parseLegalMarkdown` turns it into blocks; it never renders as HTML.
- A major `platform_rules` version sends every user the `rules_updated` notification, which opens this page.

View File

@ -0,0 +1,26 @@
# Settings
`/settings` · `apps/wall-street-plaza/src/app/(panel)/settings/page.tsx` · Type: account (back office) · Layout: [layout-panel.md](layout-panel.md)
| Field | Value |
| ----------- | -------------------------------------------------------- |
| Robots | `noindex` (root layout `metadata`, `src/configs/seo.ts`) |
| Status | `200` |
| loading.tsx | `(panel)/settings/loading.tsx` |
| First flush | none |
| Canonical | none |
| H1 | `settings:page.title` from i18n, in `PageHeader` |
| JSON-LD | none |
| Scripts | none |
## Sections
| Section | Data | HTML | JS | Index | Notes |
| -------------- | ------ | ----------- | ------- | ----- | ------------------------------------------------------------------------------------------------- |
| PageHeader | config | first flush | none | no | title and subtitle |
| PriceFloorCard | viewer | skeleton | hydrate | no | `AdminGuard`, `PartBoundary`, `Suspense`; `GET /admin/settings/price-floor` in the browser (0062) |
| Raise preview | viewer | none | hydrate | no | on a raise, a dry run `PUT` once the value stands still 400 ms; warning and table |
| Confirm dialog | viewer | none | hydrate | no | `ReasonDialog`, reason of 10 characters at least, audited as `settings.price_floor_changed` |
- A lower floor shows no preview, since nothing changes until analysts edit.
- «ذخیره» stays frozen, with its reason, on an invalid or unchanged value, or until a raise's preview is in.

View File

@ -0,0 +1,57 @@
# Pre-launch tasks: plan
Six tasks across this repo and the back end at `/home/msi/Documents/dreams/back`. Order: 6, 1, 2, 3, 5, 4.
## Where each thing lives
| Area | Front end | Back end |
|---|---|---|
| Buttons, tokens | `packages/island/src/atoms/button`, `styles/theme.css` | none |
| Auth, sign-up, KYC | `features/auth`, `screens/(auth)` | `apps/user-service`, `apps/gateway/src/auth.controller.ts` |
| Legal documents | `features/legal` (new), `/terms` | `apps/user-service` (`legal_documents`, `legal_acceptances`) |
| Signals (code name `prediction`) | `features/prediction`, `compose/prediction` | `apps/content-service/src/predictions` |
| Pricing, plans, subscriptions | `features/pricing`, `features/subscription` | `apps/subscription-service` |
| Payouts, ledger | `features/finance` | `apps/subscription-service/src/earnings.service.ts` |
| Notifications, SMS | `features/notification` | `apps/notification-service` |
| Admin | `apps/wall-street-plaza`, `platforms/garden-roof` | `apps/admin-api` |
## Migrations
The back end stores these in Mongo, which has no schema migrations, so each is a new collection, a field, or a one-time script:
- `user_service.legal_documents`, `legal_acceptances`: new, seeded at startup when empty.
- `content_service.posts`: `prediction.entryLow`, `entryHigh`, `entryMode`, `targetsHit`. Old rows stay as they are.
- `content_service.signal_stats`: new, one snapshot per analyst.
- `subscription_service.platform_settings`: new, holds `price_floor_monthly`.
- `subscription_service.subscription_tiers`: `off_sale_reason`.
- `scripts/flag-tiers-below-floor.js`: one-time, dry run by default, for running promotions under the new floor.
## Where the spec disagrees with the code
| Spec | Code | Resolution |
|---|---|---|
| One Next.js app for phone and desktop | `apps/bull` and `apps/bear`, sharing `platforms/market` (decision 0001) | Follow the code; UI goes in `platforms/market` |
| SQL tables, check constraints, migrations | Mongo through Mongoose; only payment-service uses Postgres | Collections; constraints become schema validators and service checks |
| `/api/...` routes | Gateway and admin-api serve `/v1/...` | `/v1/...`, same paths otherwise |
| Win rate over target, stop, expired | Closes store `win`, `loss`, `breakeven` and reasons `target`, `stop`, `horizon`, `early`, `admin` | User's answer: `early` and `admin` count by result at close |
| ROI splits the stake across targets | Only the final target closes a signal; earlier hits are not recorded | Record `targetsHit` from now on. Older closes: a `target` close hit every target, any other close is treated as having hit none, because no price history exists to replay |
| «باطل‌شده» | No such state exists | Counted as zero and excluded everywhere, until defined (TODO) |
| Entry stamped from the live quote | Server ignores a client entry today | Client entry accepted per spec; distance limit left as a TODO |
| `stop_loss` NOT NULL | Optional in the schema | Required on publish; old rows untouched |
| Component and API e2e tests | No front-end test runner; back end has Jest specs only, and its playbook says no e2e harness | Vitest and Testing Library added to the front end; back-end API tests run the Nest controllers through HTTP against mocked TCP clients |
| Branch per task | User asked for back-end commits on `main` | Back end: one commit per task, pushed to `main`. This repo: `feat/pre-launch-<n>-<slug>` branches, stacked in task order |
| `secondary` is purple outline | It is a neutral border on white | Same rule applied: no follow control uses it |
## Answers from the user (2026-11-02)
- `early` and `admin` closes count by result: profit is «هدف», loss is «حد ضرر», breakeven is «پایان مهلت».
- The placeholder agreement is minor, so nobody is blocked at deploy. The final text ships as major and then every analyst gets the modal.
- A tier below the floor also blocks renew and reactivate with 409 `tier_unavailable`.
- Running promotions under the new floor count as a raise: one-time script, dry run first, tiers go `below_floor`, analysts get the notice.
## Open questions, left as TODOs in code
- Maximum distance between a typed entry and the live quote.
- When a range-entry signal counts as entered.
- What makes a signal «باطل‌شده», and whether it counts in «کل سیگنال‌ها».
- Final legal text.

View File

@ -19,11 +19,15 @@
"@swc/core": "~1.15.5",
"@swc/helpers": "~0.5.18",
"@tailwindcss/postcss": "^4.3.3",
"@testing-library/dom": "^10.4.2",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.8",
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^9.8.0",
"jiti": "^2.7.0",
"jsdom": "^30.1.3",
"nx": "23.2.1",
"oxlint": "^1.75.0",
"postcss": "^8.5.28",
@ -32,7 +36,8 @@
"tailwindcss": "^4.3.3",
"tslib": "^2.8.1",
"typescript": "^6.0.3",
"typescript-eslint": "^8.58.0"
"typescript-eslint": "^8.58.0",
"vitest": "^5.0.5"
},
"dependencies": {
"@hookform/resolvers": "^5.9.1",

View File

@ -2,6 +2,9 @@
"name": "@lumina/island",
"version": "0.0.1",
"private": true,
"scripts": {
"test": "vitest run --config ../../vitest.config.ts"
},
"type": "module",
"sideEffects": [
"**/*.css"

View File

@ -0,0 +1,15 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { ActionLabel } from './ActionLabel';
describe('ActionLabel', () => {
it('is not a button and has no pointer', () => {
render(<ActionLabel>دنبال می‌کنید</ActionLabel>);
expect(screen.queryByRole('button')).toBeNull();
const label = screen.getByText('دنبال می‌کنید').parentElement!;
expect(label.tagName).toBe('SPAN');
expect(label.className).toContain('cursor-default');
expect(label.className).toContain('bg-action-quiet');
});
});

View File

@ -0,0 +1,30 @@
import { cn } from '../../tools/cn';
import { FlexBox } from '../flex-box';
import { Icon } from '../icon';
import { Typography } from '../typography';
import type { ActionLabelProps } from './types';
import { actionLabelVariants } from './variants';
/** A state in a button's shape where the action isn't offered: no button role, no pointer. */
export function ActionLabel({
variant,
icon,
className,
children,
}: ActionLabelProps) {
return (
<FlexBox
tag="span"
display="inline-flex"
alignItems="items-center"
justifyContent="justify-center"
gap="gap-2"
className={cn(actionLabelVariants({ variant }), className)}
>
{icon && <Icon name={icon} size={16} className="flex-none" />}
<Typography tag="span" color="inherit" variant="label">
{children}
</Typography>
</FlexBox>
);
}

View File

@ -0,0 +1,2 @@
export { ActionLabel } from './ActionLabel';
export type { ActionLabelProps } from './types';

View File

@ -0,0 +1,11 @@
import type { VariantProps } from 'class-variance-authority';
import type { ReactNode } from 'react';
import type { IconName } from '../icon';
import type { actionLabelVariants } from './variants';
export type ActionLabelProps = VariantProps<typeof actionLabelVariants> & {
icon?: IconName;
className?: string;
children: ReactNode;
};

View File

@ -0,0 +1,15 @@
import { cva } from 'class-variance-authority';
/** Drawn like a button of the same variant, with no hover, focus or pointer: nothing to press. */
export const actionLabelVariants = cva(
'min-h-control-sm cursor-default rounded-full border px-3 text-label leading-5 font-semibold whitespace-nowrap',
{
variants: {
variant: {
following:
'border-action-quiet-border bg-action-quiet text-action-quiet-text',
},
},
defaultVariants: { variant: 'following' },
},
);

View File

@ -0,0 +1,37 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { describe, expect, it, vi } from 'vitest';
import { Button } from './Button';
describe('Button follow variants', () => {
it('paints on-dark from its own tokens', () => {
render(<Button variant="on-dark">دنبال کردن</Button>);
const button = screen.getByRole('button', { name: 'دنبال کردن' });
expect(button.className).toContain('bg-action-dark');
expect(button.className).toContain('text-text-on-action');
expect(button.className).toContain('rounded-full');
});
it('paints following from its own tokens, with a border', () => {
render(<Button variant="following">دنبال می‌کنید</Button>);
const button = screen.getByRole('button', { name: 'دنبال می‌کنید' });
expect(button.className).toContain('bg-action-quiet');
expect(button.className).toContain('border-action-quiet-border');
expect(button.className).toContain('text-action-quiet-text');
});
it('keeps a frozen following button visible and explains it, without calling back', async () => {
const onClick = vi.fn();
render(
<Button variant="following" frozen frozenReason="دلیل" onClick={onClick}>
دنبال می‌کنید
</Button>,
);
const button = screen.getByText('دنبال می‌کنید').closest('button')!;
expect(button.classList.contains('frozen')).toBe(true);
await userEvent.click(button);
expect(onClick).not.toHaveBeenCalled();
expect(screen.getByText('دلیل')).toBeTruthy();
});
});

View File

@ -15,6 +15,10 @@ export const buttonVariants = cva(
'border-danger bg-surface text-danger-text actionable:hover:bg-danger-subtle',
'danger-solid':
'bg-danger-solid text-text-on-action actionable:hover:bg-danger-solid-hover actionable:active:bg-danger-solid-pressed',
'on-dark':
'bg-action-dark text-text-on-action actionable:hover:bg-action-dark-hover',
following:
'border-action-quiet-border bg-action-quiet text-action-quiet-text actionable:hover:bg-action-quiet-hover',
},
size: {
sm: 'min-h-control-sm min-w-control-sm px-3 text-label leading-5',

View File

@ -12,7 +12,7 @@ import { actionMenuVariants } from './variants';
/**
* A short list of destinations or actions anchored to its trigger, such as «انتشار» → «پست جدید»
* / «پیش‌بینی جدید», a post's share → «کپی لینک», or the desktop account menu with its identity
* / «سیگنال جدید», a post's share → «کپی لینک», or the desktop account menu with its identity
* `header`, links and a danger «خروج از حساب» after a separator. Put it in a positioned container
* that holds only the trigger and the menu, and give the trigger `aria-haspopup="menu"`. It takes focus when
* it opens; ↑ ↓ move, and the trigger keeps its own press. Escape or a choice closes it and puts

View File

@ -38,7 +38,7 @@ export type AnalystCardLabels = {
verified: string;
/** The market list's accessible name: «بازارهای تخصصی». */
markets: string;
/** The stat tiles: «نرخ موفقیت», «پیش‌بینی», «میانگین بازده». */
/** The stat tiles: «نرخ موفقیت», «سیگنال», «میانگین بازده». */
winRate: ReactNode;
predictions: ReactNode;
avgRoi: ReactNode;

View File

@ -69,7 +69,7 @@ export function OutcomeSplit({ counts, labels }: OutcomeSplitProps) {
>
{formatted[outcome]}
</Typography>,
labels.outcomes[outcome],
labels.splitOutcomes[outcome],
)}
</Typography>
</FlexBox>

View File

@ -22,8 +22,11 @@ export type CreatorStatsData = {
/** Closed outcomes in `trendOrder`. Only the last 10 are drawn. */
accuracyTrend: TrendOutcome[];
/** The all-time split. The bar shows only when `wins` and `losses` both arrive. */
/** «رسیده به هدف». */
wins?: number;
/** «خورده به حد ضرر». */
losses?: number;
/** «پایان مهلت». */
breakeven?: number;
};
@ -32,35 +35,37 @@ export type CreatorStatsData = {
* formatted (`1٬234`, `62٫9٪`), so the translation only places them.
*/
export type CreatorStatsLabels = {
/** «عملکرد پیش‌بینی‌ها». */
/** «عملکرد سیگنال‌ها». */
title: ReactNode;
/** «مشاهده کارنامه کامل». */
viewRecord: ReactNode;
/** «نرخ موفقیت». */
winRate: ReactNode;
/** Under the rate, once the split is known: `(count) => \`از ${count} پیش‌بینی بسته‌شده\``. */
/** Under the rate, once the split is known: `(count) => \`از ${count} سیگنال بسته‌شده\``. */
closedCount: (count: string) => ReactNode;
/** Each outcome in words, for the legend, the key, the tooltips and the curve's sentence: «موفق», «ناموفق», «سربه‌سر». */
/** A signal's return at close in words, for the key, the tooltips and the curve's sentence: «موفق», «ناموفق», «سربه‌سر». */
outcomes: Record<TrendOutcome, string>;
/** One legend entry, `count` already bold: `(count, outcome) => <>{count} {outcome}</>` → «۲۲ موفق». */
/** How signals ended in the split's legend: «رسیده به هدف» (`wins`), «خورده به حد ضرر» (`losses`), «پایان مهلت» (`breakeven`). */
splitOutcomes: Record<TrendOutcome, string>;
/** One legend entry, `count` already bold: `(count, outcome) => <>{count} {outcome}</>` → «۲۲ رسیده به هدف». */
splitLegend: (count: ReactNode, outcome: string) => ReactNode;
/** The split bar as one sentence: `({ win, breakeven, loss }) => \`${win} موفق، ${breakeven} سربه‌سر، ${loss} ناموفق\``. */
/** The split bar as one sentence: `({ win, breakeven, loss }) => \`${win} رسیده به هدف، ${breakeven} پایان مهلت، ${loss} خورده به حد ضرر\``. */
splitSentence: (counts: Record<TrendOutcome, string>) => string;
/** «بازدهی میانگین». */
avgRoi: ReactNode;
/** «کل پیش‌بینی‌ها». */
/** «کل سیگنال‌ها». */
total: ReactNode;
/** «پیش‌بینی‌های فعال». */
/** «سیگنال‌های فعال». */
active: ReactNode;
/** «روند دقت». */
trendTitle: ReactNode;
/** Beside the trend title: `(count) => \`${count} پیش‌بینی اخیر\``. */
/** Beside the trend title: `(count) => \`${count} سیگنال اخیر\``. */
trendWindow: (count: string) => ReactNode;
/** `(wins, total) => \`${wins} از ${total} موفق\`` → «۷ از ۱۰ موفق». */
tally: (wins: string, total: string) => ReactNode;
/**
* The curve's one image label, every outcome in order plus how to read it:
* `(count, outcomes) => \`منحنی نتیجه ${count} پیش‌بینی اخیر، از قدیمی‌ترین به جدیدترین: ${outcomes.join('، ')}. هر موفق یک پله بالا، هر ناموفق یک پله پایین.\``.
* `(count, outcomes) => \`منحنی نتیجه ${count} سیگنال اخیر، از قدیمی‌ترین به جدیدترین: ${outcomes.join('، ')}. هر موفق یک پله بالا، هر ناموفق یک پله پایین.\``.
*/
curveLabel: (count: string, outcomes: string[]) => string;
/** The newest point's tooltip: `(outcome) => \`${outcome} (جدیدترین)\``. */
@ -112,7 +117,7 @@ export type OutcomeSplitProps = {
counts: Record<TrendOutcome, number>;
labels: Pick<
CreatorStatsLabels,
'outcomes' | 'splitLegend' | 'splitSentence'
'splitOutcomes' | 'splitLegend' | 'splitSentence'
>;
};

View File

@ -37,11 +37,11 @@ export type PostCardOwner = {
onDelete?: () => void;
/** «مشاهده به عنوان کاربر», on premium posts only. */
onPreview?: () => void;
/** The embedded open prediction's «بستن پیش‌بینی». */
/** The embedded open prediction's «بستن سیگنال». */
onClosePrediction?: () => void;
/**
* The embedded open prediction's close waiting for ops (J09-5): PredictionCard's `pendingClose`
* detail, which freezes «بستن پیش‌بینی».
* detail, which freezes «بستن سیگنال».
*/
pendingClose?: ReactNode;
/** 15 minutes after publishing: the edit icon stays, frozen, and explains itself. */

View File

@ -0,0 +1,117 @@
import { render, screen, within } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { PredictionCard } from './PredictionCard';
import type { PredictionCardLabels, PredictionData } from './types';
const labels = {
status: { open: 'فعال', win: 'موفق', loss: 'ناموفق', breakeven: 'سربه‌سر' },
direction: { long: 'خرید', short: 'فروش' },
horizon: (horizon: string) => horizon,
timeLeft: { daysLeft: (n: string) => n, underDays: (n: string) => n },
roi: 'بازدهی',
closedPrice: (price: unknown) => price,
heldFor: (duration: string) => duration,
toTarget: 'تا هدف',
toFinalTarget: 'تا هدف نهایی',
toStop: 'تا حد ضرر',
riskReward: 'ریسک به ریوارد',
riskRewardRange: (worst: string, best: string) => `${worst} تا ${best}`,
levels: {
stop: 'حد ضرر',
entry: 'ورود',
base: 'مبنا',
range: 'بازه',
entryRange: 'ورود (بازه)',
target: () => 'هدف',
finalTarget: 'هدف نهایی',
close: 'بسته‌شدن',
horizon: 'افق',
},
ladder: {
level: 'سطح',
price: 'قیمت',
change: 'تغییر از ورود',
state: 'وضعیت',
reached: 'رسید',
missed: 'نرسید',
triggered: 'فعال شد',
notTriggered: 'فعال نشد',
},
rangeLabel: ({ entry }: { entry: string }) => `محدوده ${entry}`,
horizonElapsed: (duration: string) => duration,
horizonEnd: (end: string) => end,
horizonProgress: 'زمان',
seal: (at: unknown) => at,
immutable: 'غیرقابل ویرایش',
locked: { title: 't', description: 'd', hidden: 'h' },
} as unknown as PredictionCardLabels;
const exact: PredictionData = {
symbol: 'XAUUSD',
direction: 'long',
entryPrice: 100,
targetPrices: [120],
stopLoss: 90,
horizon: '1w',
status: 'open',
};
const range: PredictionData = {
...exact,
entryPrice: 68000,
entryLow: 67500,
entryHigh: 68500,
targetPrices: [70000],
stopLoss: 67000,
};
const card = (prediction: PredictionData, variant?: 'expanded') =>
render(
<PredictionCard
prediction={prediction}
variant={variant}
publishedAt="2026-01-01T00:00:00Z"
now="2026-01-02T00:00:00Z"
labels={labels}
/>,
);
const riskRewardText = () =>
screen.getByText('ریسک به ریوارد').parentElement!.textContent ?? '';
describe('PredictionCard entry', () => {
it('shows an exact entry with «مبنا» and one ratio', () => {
card(exact);
expect(screen.getByText('مبنا')).toBeTruthy();
expect(screen.queryByText('بازه')).toBeNull();
expect(riskRewardText()).not.toContain('تا ');
});
it('shows a range with both ends, «بازه» instead of «مبنا», and worst to best', () => {
card(range);
expect(screen.getByText('67٬500 – 68٬500')).toBeTruthy();
expect(screen.getByText('بازه')).toBeTruthy();
expect(screen.queryByText('مبنا')).toBeNull();
const text = riskRewardText();
expect(text.indexOf('1٫0')).toBeLessThan(text.indexOf('5٫0'));
expect(text).toContain(' تا ');
});
it('names the range in the bar, measured from its middle', () => {
card(range);
expect(
screen.getByRole('img', { name: 'محدوده 67٬500 – 68٬500' }),
).toBeTruthy();
});
it('calls the ladder row «ورود (بازه)» on an expanded card', () => {
card(range, 'expanded');
const row = screen.getByText('ورود (بازه)').closest('tr')!;
expect(within(row).getByText('67٬500 – 68٬500')).toBeTruthy();
expect(within(row).getByText('بازه')).toBeTruthy();
});
it('keeps «ورود» and «مبنا» in an exact ladder row', () => {
card(exact, 'expanded');
const row = screen.getByText('مبنا').closest('tr')!;
expect(within(row).getByText('ورود')).toBeTruthy();
});
});

View File

@ -37,7 +37,12 @@ export function OpenKpis({ prediction, math, labels }: PredictionPartProps) {
)}
{riskReward != null && (
<Kpi label={labels.riskReward} color="primary">
{ratio(1, riskReward)}
{riskReward.worst === riskReward.best
? ratio(1, riskReward.worst)
: labels.riskRewardRange(
ratio(1, riskReward.worst),
ratio(1, riskReward.best),
)}
</Kpi>
)}
</GridBox>

View File

@ -6,7 +6,7 @@ import { Element } from '../../../primitives/element';
import { cn } from '../../../tools/cn';
import { CLOSE_SORT_NUDGE, EMPTY_VALUE, TREND_COLORS } from '../constants';
import type { LadderRow, PredictionPartProps } from '../types';
import { trendOf } from '../utils';
import { entryText, isRangeEntry, trendOf } from '../utils';
import { ladderCellVariants, ladderHeadVariants } from '../variants';
import { LevelGlyph } from './LevelGlyph';
@ -24,6 +24,7 @@ export function PredictionLadder({
const { closed, closeFav, risk, hits, targetsFav, stopHit } = math;
const { levels, ladder } = labels;
const many = targetPrices.length > 1;
const isRange = isRangeEntry(prediction);
const rows: LadderRow[] = targetPrices.map((target, index) => ({
key: `t${index}`,
@ -44,9 +45,10 @@ export function PredictionLadder({
order: 0,
change: null,
glyph: <LevelGlyph kind="entry" />,
label: levels.entry,
label: isRange ? levels.entryRange : levels.entry,
price: entryPrice,
state: levels.base,
priceText: isRange ? entryText(prediction) : undefined,
state: isRange ? levels.range : levels.base,
});
if (stopLoss != null && risk != null) {
rows.push({
@ -145,7 +147,7 @@ export function PredictionLadder({
variant="body-sm"
className={cn(cell, 'text-end font-bold')}
>
{price(row.price)}
{row.priceText ?? price(row.price)}
</Typography>
<Typography
tag="td"

View File

@ -4,12 +4,15 @@ import { GridBox } from '../../../atoms/grid-box';
import { Typography } from '../../../atoms/typography';
import { TREND_COLORS } from '../constants';
import type { PredictionPartProps } from '../types';
import { hasLongPrice, trendOf } from '../utils';
import { entryText, hasLongPrice, isRangeEntry, trendOf } from '../utils';
import { levelsVariants } from '../variants';
import { LevelGlyph } from './LevelGlyph';
import { LevelTile } from './LevelTile';
/** Compact: the exact prices on sunken tiles, stop loss → entry → targets, each with its % from entry. */
/**
* Compact: the exact prices on sunken tiles, stop loss → entry → targets, each with its % from entry.
* A range entry shows both ends, marked «بازه» instead of «مبنا», on wider tiles.
*/
export function PredictionLevels({
prediction,
math,
@ -17,8 +20,9 @@ export function PredictionLevels({
}: PredictionPartProps) {
const { entryPrice, targetPrices, stopLoss } = prediction;
const many = targetPrices.length > 1;
const isRange = isRangeEntry(prediction);
const value = (level: number, change: number | null) => (
const value = (level: string, change: number | null) => (
<>
<Typography
tag="span"
@ -26,11 +30,11 @@ export function PredictionLevels({
variant="body-sm"
className="truncate text-end font-bold"
>
{price(level)}
{level}
</Typography>
{change == null ? (
<Typography tag="span" variant="micro" color="tertiary">
{labels.levels.base}
{isRange ? labels.levels.range : labels.levels.base}
</Typography>
) : (
<Typography
@ -52,6 +56,7 @@ export function PredictionLevels({
gap="gap-2"
className={levelsVariants({
wide: hasLongPrice([entryPrice, stopLoss, ...targetPrices]),
range: isRange,
})}
>
{stopLoss != null && (
@ -59,14 +64,14 @@ export function PredictionLevels({
glyph={<LevelGlyph kind="stop" />}
label={labels.levels.stop}
>
{value(stopLoss, math.risk)}
{value(price(stopLoss), math.risk)}
</LevelTile>
)}
<LevelTile
glyph={<LevelGlyph kind="entry" />}
label={labels.levels.entry}
>
{value(entryPrice, null)}
{value(entryText(prediction), null)}
</LevelTile>
{targetPrices.map((target, index) => (
<LevelTile
@ -80,7 +85,7 @@ export function PredictionLevels({
}
label={labels.levels.target(many ? number(index + 1) : undefined)}
>
{value(target, math.targetsFav[index])}
{value(price(target), math.targetsFav[index])}
</LevelTile>
))}
</GridBox>

View File

@ -6,7 +6,7 @@ import { Typography } from '../../../atoms/typography';
import { Element } from '../../../primitives/element';
import { OUTCOME_TRENDS } from '../constants';
import type { PredictionRangeProps } from '../types';
import { atPosition, bandBetween, trendOf } from '../utils';
import { atPosition, bandBetween, entryText, trendOf } from '../utils';
import { markerVariants, rangeBandVariants, rangeVariants } from '../variants';
import { ClosePin } from './ClosePin';
@ -14,7 +14,7 @@ import { ClosePin } from './ClosePin';
* Where the prediction stands between its stop loss (inline start, the right in RTL) and its final
* target (inline end): the risk and reward zones, entry, numbered targets that fill once reached,
* and on a closed card a fill from entry with a pin at the close. Without a stop loss the bar
* starts at entry.
* starts at entry. A range entry is drawn at its middle.
*/
export function PredictionRange({
prediction,
@ -22,8 +22,7 @@ export function PredictionRange({
labels,
expanded,
}: PredictionRangeProps) {
const { entryPrice, targetPrices, stopLoss, closedPrice, outcome } =
prediction;
const { targetPrices, stopLoss, closedPrice, outcome } = prediction;
const { position, risk, reward, closed, closeFav, targetsFav, hits } = math;
const hasStop = risk != null;
const entry = position(0);
@ -38,7 +37,7 @@ export function PredictionRange({
const label = labels.rangeLabel({
stop: hasStop ? price(stopLoss) : undefined,
entry: price(entryPrice),
entry: entryText(prediction),
targets: targetPrices.map(price),
close: closed ? price(closedPrice) : undefined,
});

View File

@ -1,4 +1,5 @@
export { PredictionCard } from './PredictionCard';
export { entryText, isRangeEntry } from './utils';
export type {
PredictionCardLabels,
PredictionCardProps,

View File

@ -28,7 +28,11 @@ export type PredictionData = {
/** The market's label from the translations: «کریپتو», «طلا», «بورس». */
market?: ReactNode;
direction: PredictionDirection;
/** The exact entry, or the middle of a range: every distance and return reads this. */
entryPrice: number;
/** A range entry: both, low below high. */
entryLow?: number | null;
entryHigh?: number | null;
/** One or more, nearest first; designed for up to three. The last one is the final target. */
targetPrices: number[];
/** Optional: without it there is no stop marker, risk zone, level or «تا حد ضرر». */
@ -90,6 +94,8 @@ export type PredictionCardLabels = {
toStop: ReactNode;
/** «ریسک به ریوارد», against the first target. */
riskReward: ReactNode;
/** A range entry's lower and higher ratio, already formatted: «۱ : ۱٫۴ تا ۱ : ۳٫۰». */
riskRewardRange: (worst: string, best: string) => ReactNode;
/** The names of the price levels, in the levels grid, the ladder and the range axis. */
levels: {
/** «حد ضرر». */
@ -98,6 +104,10 @@ export type PredictionCardLabels = {
entry: ReactNode;
/** Entry's reference mark in place of a % change: «مبنا». */
base: ReactNode;
/** The same mark on a range entry: «بازه». */
range: ReactNode;
/** The ladder's row for a range entry: «ورود (بازه)». */
entryRange: ReactNode;
/** A target, numbered only when there are several: `(n) => (n ? <>هدف {n}</> : 'هدف')`. */
target: (n?: string) => ReactNode;
/** «هدف نهایی», the range axis's end when there are several targets. */
@ -122,7 +132,7 @@ export type PredictionCardLabels = {
notTriggered: ReactNode;
};
/**
* The range bar's `aria-label`: «محدوده پیش‌بینی: حد ضرر ۹۵٬۰۰۰، ورود ۱۰۰٬۰۰۰، هدف ۱ ۱۱۰٬۰۰۰،
* The range bar's `aria-label`: «محدوده سیگنال: حد ضرر ۹۵٬۰۰۰، ورود ۱۰۰٬۰۰۰، هدف ۱ ۱۱۰٬۰۰۰،
* بسته‌شدن ۱۰۸٬۰۰۰».
*/
rangeLabel: (values: PredictionRangeValues) => string;
@ -141,7 +151,7 @@ export type PredictionCardLabels = {
/** The owner's pending-close row title, in bold: «در انتظار تأیید بسته‌شدن» (J09-5). */
pendingClose?: ReactNode;
/**
* Why «بستن زودهنگام» is frozen while a close waits for ops: «این پیش‌بینی به‌زودی به‌صورت خودکار
* Why «بستن زودهنگام» is frozen while a close waits for ops: «این سیگنال به‌زودی به‌صورت خودکار
* بسته می‌شود.» (J10-3f).
*/
closeFrozen?: ReactNode;
@ -171,7 +181,7 @@ export type PredictionCardLabels = {
};
/** A premium card for a viewer without access. */
locked: {
/** «پیش‌بینی پریمیوم». */
/** «سیگنال پریمیوم». */
title: ReactNode;
/** «دارایی، جهت، ورود، اهداف و حد ضرر پنهان است.» */
description: ReactNode;
@ -235,6 +245,8 @@ export type PredictionCardProps = PredictionCardOwnProps &
}
);
export type RiskReward = { worst: number; best: number };
/** Every number the card shows, computed once from the prediction. */
export type PredictionMath = {
targetsFav: number[];
@ -242,8 +254,8 @@ export type PredictionMath = {
risk: number | null;
/** The final target's favourable %. */
reward: number | null;
/** x in «۱ : x», against the first target. */
riskReward: number | null;
/** Rewards per unit of risk to the first target: one answer for an exact entry, or a range's two ends. */
riskReward: RiskReward | null;
/** Closed with a close price: the range draws a fill and a pin. */
closed: boolean;
closeFav: number | null;
@ -358,6 +370,8 @@ export type LadderRow = {
glyph: ReactNode;
label: ReactNode;
price: number;
/** In place of `price`: a range entry's two ends. */
priceText?: string;
state: ReactNode;
/** A target the close reached. */
hit?: boolean;

View File

@ -0,0 +1,81 @@
import { describe, expect, it } from 'vitest';
import type { PredictionData } from './types';
import { entryText, isRangeEntry, predictionMath, riskRewardOf } from './utils';
const exact: PredictionData = {
symbol: 'XAUUSD',
direction: 'long',
entryPrice: 100,
targetPrices: [120],
stopLoss: 90,
horizon: '1w',
};
const range: PredictionData = {
...exact,
entryPrice: 68000,
entryLow: 67500,
entryHigh: 68500,
targetPrices: [70000],
stopLoss: 67000,
};
describe('riskRewardOf', () => {
it('has one answer for an exact entry', () => {
expect(riskRewardOf(exact)).toEqual({ worst: 2, best: 2 });
});
it('works a long range out at both ends, the lower ratio first', () => {
// From the top: 1500 of reward for 1500 of risk. From the bottom: 2500 for 500.
expect(riskRewardOf(range)).toEqual({ worst: 1, best: 5 });
});
it('mirrors for a short', () => {
const short: PredictionData = {
...exact,
direction: 'short',
entryPrice: 100,
entryLow: 98,
entryHigh: 102,
targetPrices: [90],
stopLoss: 110,
};
expect(riskRewardOf(short)).toEqual({ worst: 8 / 12, best: 12 / 8 });
});
it('reads the first target, not the final one', () => {
expect(riskRewardOf({ ...exact, targetPrices: [110, 200] })).toEqual({
worst: 1,
best: 1,
});
});
it.each([
['no stop', { stopLoss: null }],
['no target', { targetPrices: [] }],
['a stop on the wrong side', { stopLoss: 105 }],
['a stop on the entry', { stopLoss: 100 }],
['a target on the wrong side', { targetPrices: [95] }],
])('is null with %s', (_name, over) => {
expect(riskRewardOf({ ...exact, ...over })).toBeNull();
});
});
describe('the entry', () => {
it('knows a range only when both ends are there', () => {
expect(isRangeEntry(range)).toBe(true);
expect(isRangeEntry(exact)).toBe(false);
expect(isRangeEntry({ entryLow: 1, entryHigh: null })).toBe(false);
});
it('writes both ends of a range, low first', () => {
expect(entryText(range)).toBe('67٬500 – 68٬500');
expect(entryText(exact)).toBe('100');
});
it('measures every distance from the middle of a range', () => {
const math = predictionMath(range);
expect(math.targetsFav[0]).toBeCloseTo((2000 / 68000) * 100);
expect(math.risk).toBeCloseTo((-1000 / 68000) * 100);
});
});

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