feat(market): landing page, featured analysts, home moves to /feed

- Landing screens for `/`: header, hero, trust strip, markets tabs,
  featured analysts carousel, track record, steps, plans, for analysts,
  FAQ, closing call to action and footer, composed by LandingTemplate
  with labels built from the server's translations.
- Featured analysts read (`/creators/featured`) with a cache and
  `loadLandingPage`: 404 and 403 hide the section, other failures hide
  it at build time and throw at a revalidation.
- `ROUTES.home` is now `/feed` and `ROUTES.landing` is `/`; `homeRoute`
  and `useHomeHref` decide where a viewer belongs, used by the brands,
  back, HomeGuard and LandingRedirect.
- Registration step 1 pre-selects the account type from `?role=` once,
  then drops it from the address.
- The `landing` namespace is server-only (SERVER_RESOURCES).
- Landing metadata and FAQPage JSON-LD helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-10-07 23:02:58 +04:00
parent 2be04f9d1d
commit ba673f4a28
100 changed files with 3151 additions and 44 deletions

View File

@ -0,0 +1,26 @@
'use client';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { useViewerStatus } from '../../../stores/auth';
import { useHomeHref } from '../../navigation/hooks/use-home-href';
/**
* The landing is for guests and is prerendered the same for everyone (0026), so the server can't
* send a signed-in person on. Once the browser knows them, they go to their home in place: خانه, a
* creator's own channel, or registration step 5 (0027). A guest, or an expired session, stays.
* Renders nothing; the landing shows meanwhile, because hiding it would cost every guest its
* first paint.
*/
export function LandingRedirect() {
const status = useViewerStatus();
const homeHref = useHomeHref();
const router = useRouter();
useEffect(() => {
if (status === 'member') router.replace(homeHref);
}, [status, homeHref, router]);
return null;
}

View File

@ -0,0 +1 @@
export { LandingRedirect } from './LandingRedirect';

View File

@ -13,6 +13,7 @@ import { useTranslation } from 'react-i18next';
import { useCurrentAccount, useViewerStatus } from '../../../../stores/auth';
import { SupportEntry } from '../../../screens/organisms/support-entry';
import { activeTab } from '../../active-tab';
import { useHomeHref } from '../../hooks/use-home-href';
import { loginRoute, ROUTES } from '../../navigation';
import { PublishMenu } from '../publish-menu';
import { HeaderNavLink } from './components/HeaderNavLink';
@ -31,6 +32,7 @@ export function DesktopHeader() {
const pathname = usePathname();
const isCreator = account?.role === 'creator';
const active = activeTab(pathname, isCreator ? account.username : null);
const homeHref = useHomeHref();
return (
<FlexBox
@ -41,8 +43,9 @@ export function DesktopHeader() {
>
<Typography
tag={NextLink}
// A creator's home tab is their channel; going there directly leaves no `/` to bounce off.
href={isCreator ? ROUTES.channel(account.username) : ROUTES.home}
// Straight to the viewer's home (a creator's is their channel, a guest's the landing), so
// there is no خانه to bounce off.
href={homeHref}
aria-label={t('nav.brand-home')}
variant="heading-sm"
color="brand"

View File

@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
import { useCurrentAccount, useViewerStatus } from '../../../../stores/auth';
import { SupportEntry } from '../../../screens/organisms/support-entry';
import { useHomeHref } from '../../hooks/use-home-href';
import { useIsOwnPreview } from '../../hooks/use-is-own-preview';
import { loginRoute, ROUTES } from '../../navigation';
import { BackButton } from './components/BackButton';
@ -25,7 +26,8 @@ import type { MobileTopBarProps } from './types';
* when it has one («داشبورد»; خانه has none), support and the member's account (Main A, U8 ۴.۱).
* Who is looking is known only in the browser, so the server and the first browser render show a
* tab's bar with its brand and name and a placeholder where the account goes, and a pushed page's
* bar without its start. A creator's brand goes to their own channel, their home tab.
* bar without its start. A creator's brand goes to their own channel, their home tab, and a
* guest's to the landing.
*/
export function MobileTopBar({
title,
@ -39,6 +41,7 @@ export function MobileTopBar({
const account = useCurrentAccount();
const pathname = usePathname();
const isPreview = useIsOwnPreview();
const homeHref = useHomeHref();
// While the viewer is unknown, account is null, so only a tab's main screen gets the tab bar.
const isTabBar = isTab || (account != null && account.id === tabOwnerId);
@ -58,11 +61,7 @@ export function MobileTopBar({
<Brand
label={t('nav.brand')}
homeLabel={t('nav.brand-home')}
href={
account?.role === 'creator'
? ROUTES.channel(account.username)
: ROUTES.home
}
href={homeHref}
/>
)}
{status !== 'guest' && isTab && title && (

View File

@ -3,7 +3,7 @@
import { Button } from '@lumina/island/atoms/button';
import { useRouter } from 'next/navigation';
import { ROUTES } from '../../../navigation';
import { useHomeHref } from '../../../hooks/use-home-href';
import type { BackButtonProps } from '../types';
/**
@ -12,6 +12,7 @@ import type { BackButtonProps } from '../types';
*/
export function BackButton({ label, onBack }: BackButtonProps) {
const router = useRouter();
const homeHref = useHomeHref();
return (
<Button
variant="ghost"
@ -20,7 +21,7 @@ export function BackButton({ label, onBack }: BackButtonProps) {
onClick={() => {
if (onBack) onBack();
else if (window.history.length > 1) router.back();
else router.push(ROUTES.home);
else router.push(homeHref);
}}
/>
);

View File

@ -7,6 +7,9 @@ export const CHANNEL_ROUTE_PREFIX = '/channels/';
/** `?preview=visitor|subscriber`: the creator's preview of their own post as others see it (C5 §6). */
export const PREVIEW_PARAM = 'preview';
/** Registration's query parameter that pre-selects the account type: `investor` or `creator`. */
export const ROLE_PARAM = 'role';
/** Login's query parameter naming the channel a guest wants to subscribe to. */
export const SUBSCRIBE_PARAM = 'subscribe';

View File

@ -2,10 +2,10 @@ import { useSearchParams } from 'next/navigation';
import { useMemo } from 'react';
import * as v from 'valibot';
import type { SignedInViewer } from '../../../features/auth';
import { usernameSchema } from '../../../shared/validations';
import { SUBSCRIBE_PARAM } from '../constants';
import { ROUTES, withReturnPath } from '../navigation';
import type { SignedInViewer, UserRole } from '../../../features/auth';
import { ACCOUNT_TYPES, usernameSchema } from '../../../shared/validations';
import { ROLE_PARAM, SUBSCRIBE_PARAM } from '../constants';
import { homeRoute, ROUTES, withReturnPath } from '../navigation';
import { safeReturnPath } from '../return-path';
import type { AuthRoutes } from '../types';
@ -24,6 +24,12 @@ function toSubscribeUsername(
: null;
}
/** `?role=` when it names an account type (the landing's «ثبت‌نام» links), else `null`. */
function toChosenRole(role: string | null): UserRole | null {
const parsed = v.safeParse(v.picklist(ACCOUNT_TYPES), role);
return parsed.success ? parsed.output : null;
}
/**
* Every login and registration step's path, each keeping `?redirect=`, and where a person lands
* once signed in. Browser only: the auth pages render their steps in the browser.
@ -32,6 +38,7 @@ export function useAuthRoutes(): AuthRoutes {
const params = useSearchParams();
const redirect = params.get('redirect');
const subscribe = params.get(SUBSCRIBE_PARAM);
const role = params.get(ROLE_PARAM);
return useMemo(() => {
const step = (path: string) => withReturnPath(path, redirect);
@ -50,12 +57,13 @@ export function useAuthRoutes(): AuthRoutes {
creator: step(ROUTES.onboarding.creatorProfile),
creatorDone: step(ROUTES.onboarding.creatorProfileDone),
},
landing: ({ role, username, needsProfile }: SignedInViewer) => {
if (needsProfile) return step(ROUTES.onboarding.creatorProfile);
landing: (viewer: SignedInViewer) => {
if (viewer.needsProfile) return step(ROUTES.onboarding.creatorProfile);
if (redirect) return safeReturnPath(redirect);
return role === 'creator' ? ROUTES.channel(username) : ROUTES.home;
return homeRoute(viewer);
},
subscribeTo: toSubscribeUsername(subscribe, redirect),
chosenRole: toChosenRole(role),
};
}, [redirect, subscribe]);
}, [redirect, subscribe, role]);
}

View File

@ -0,0 +1,24 @@
import {
useCurrentAccount,
useNeedsProfile,
useViewerStatus,
} from '../../../stores/auth';
import { homeRoute, ROUTES } from '../navigation';
/**
* Where «home» is for the viewer: the landing for a guest, and `homeRoute` for a member (step 5,
* a creator's own channel, or خانه). While the viewer is still unknown, خانه, which sends each one
* on. The brand links and back with no history share it.
*/
export function useHomeHref(): string {
const status = useViewerStatus();
const account = useCurrentAccount();
const needsProfile = useNeedsProfile();
if (status === 'guest') return ROUTES.landing;
if (!account) return ROUTES.home;
return homeRoute({
role: account.role,
username: account.username,
needsProfile,
});
}

View File

@ -2,10 +2,13 @@ export { BottomNav } from './components/bottom-nav';
export { DesktopHeader } from './components/desktop-header';
export { MobileTopBar } from './components/mobile-top-bar';
export type { MobileTopBarProps } from './components/mobile-top-bar';
export { CHANNEL_PREFIX, PREVIEW_PARAM } from './constants';
export { CHANNEL_PREFIX, PREVIEW_PARAM, ROLE_PARAM } from './constants';
export { useAuthRoutes } from './hooks/use-auth-routes';
export { useHomeHref } from './hooks/use-home-href';
export {
homeRoute,
loginRoute,
registerRoute,
ROUTES,
subscribeLoginRoute,
withReturnPath,

View File

@ -1,11 +1,15 @@
import { CHANNEL_PREFIX, SUBSCRIBE_PARAM } from './constants';
import type { SignedInViewer, UserRole } from '../../features/auth';
import { CHANNEL_PREFIX, ROLE_PARAM, SUBSCRIBE_PARAM } from './constants';
const channel = (username: string) =>
`${CHANNEL_PREFIX}${encodeURIComponent(username)}`;
/** Every route path in bull and bear, which share one URL tree. Build links only from here. */
export const ROUTES = {
home: '/',
/** The guest landing; a signed-in person is sent on to their home in the browser. */
landing: '/',
/** خانه, the investor's feed of the creators they follow. */
home: '/feed',
login: '/auth/login',
loginVerify: '/auth/login/verify',
/** After a valid code for a suspended account: no session, only support. */
@ -58,6 +62,26 @@ export function subscribeLoginRoute(username: string): string {
return `${loginRoute(channel(username))}&${SUBSCRIBE_PARAM}=${encodeURIComponent(username)}`;
}
/** Registration step 1, with the account type already chosen when `role` is given (the landing). */
export function registerRoute(role?: UserRole): string {
return role
? `${ROUTES.register.type}?${ROLE_PARAM}=${role}`
: ROUTES.register.type;
}
/**
* Where a signed-in person belongs: registration step 5 for a creator who left it, a creator's own
* channel (their home tab), and خانه for an investor.
*/
export function homeRoute({
role,
username,
needsProfile,
}: SignedInViewer): string {
if (needsProfile) return ROUTES.onboarding.creatorProfile;
return role === 'creator' ? channel(username) : ROUTES.home;
}
/**
* An auth step's path that keeps `?redirect=`, so every step of login and registration returns
* to the page that asked for it.

View File

@ -1,4 +1,4 @@
import type { SignedInViewer } from '../../features/auth';
import type { SignedInViewer, UserRole } from '../../features/auth';
/** The auth steps' paths with `?redirect=` kept, and where a signed-in person lands. */
export type AuthRoutes = {
@ -16,6 +16,8 @@ export type AuthRoutes = {
landing: (viewer: SignedInViewer) => string;
/** The channel's username when a guest came to log in from «اشتراک», else `null`. */
subscribeTo: string | null;
/** The account type `?role=` pre-selects on registration step 1, else `null`. */
chosenRole: UserRole | null;
};
/** The bottom nav's and the desktop header's tabs; a page belongs to the one it was pushed from. */

View File

@ -24,8 +24,9 @@ const ACCOUNT_TYPES = [
] as const satisfies readonly { value: UserRole; icon: string }[];
/**
* Registration step 1: two cards, one line each on what the account is for, nothing
* pre-selected. The account type can't change later, so the note says so before the choice.
* Registration step 1: two cards, one line each on what the account is for, nothing pre-selected
* unless the link chose a type (`?role=`). The account type can't change later, so the note says
* so before the choice.
*/
export function RegisterTypeStep({
size,
@ -34,7 +35,9 @@ export function RegisterTypeStep({
const { t } = useTranslation('auth');
const routes = useAuthRoutes();
const { form, submit } = useRegisterTypePage({
typeHref: routes.register.type,
phoneHref: routes.register.phone,
initialRole: routes.chosenRole,
});
const role = useWatch({ control: form.control, name: 'role' });

View File

@ -0,0 +1,57 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { Element } from '@lumina/island/primitives/element';
import { AnalystCard } from './components/AnalystCard';
import { AnalystCarousel } from './components/AnalystCarousel';
import type { FeaturedAnalystsProps } from './types';
/**
* تحلیلگران: the analysts Lumina features, live, in the admin's order: no ranking and no «برترین».
* A swipe row on the phone, two then three cards with arrows from 720px, and a note under it on
* who chooses them and that past results promise nothing.
*/
export function FeaturedAnalysts({
titleId,
creators,
labels,
}: FeaturedAnalystsProps) {
return (
<FlexBox direction="flex-col" gap="gap-4">
<AnalystCarousel
heading={
<SectionHeading
titleId={titleId}
kicker={labels.kicker}
title={labels.title}
lead={labels.lead}
/>
}
listLabel={labels.list}
previousLabel={labels.previous}
nextLabel={labels.next}
>
{creators.map((creator) => (
<FlexBox
key={creator.username}
tag="li"
className="w-4/5 max-w-80 flex-none snap-start tablet:w-[calc((100%-1rem)/2)] tablet:max-w-none desktop:w-[calc((100%-2rem)/3)]"
>
<AnalystCard creator={creator} labels={labels.card} />
</FlexBox>
))}
</AnalystCarousel>
<FlexBox alignItems="items-start" gap="gap-2">
<Element
tag="span"
aria-hidden
className="mt-2 size-2 flex-none rounded-full bg-success"
/>
<Typography variant="caption" color="secondary">
{labels.note}
</Typography>
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,146 @@
import { Avatar } from '@lumina/island/atoms/avatar';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Tag } from '@lumina/island/atoms/tag';
import { Typography } from '@lumina/island/atoms/typography';
import { Card } from '@lumina/island/molecules/card';
import { Element } from '@lumina/island/primitives/element';
import { number, percent, signedPercent } from '@lumina/tools/format';
import NextLink from 'next/link';
import { ROUTES } from '../../../../../navigation/navigation';
import type { AnalystCardProps } from '../types';
/**
* One featured analyst, linking to their public channel: avatar, name with the verified mark,
* @username, market tags, a two-line bio and three outcome tiles. Never follower or subscriber
* counts, or prices. Page-only: a second screen that needs it moves it into island first.
*/
export function AnalystCard({ creator, labels }: AnalystCardProps) {
const name = creator.displayName ?? `@${creator.username}`;
const roi = creator.stats.avgRoiPercent;
const stats = [
{
key: 'win-rate',
label: labels.winRate,
value: percent(creator.stats.winRate),
},
{
key: 'predictions',
label: labels.predictions,
value: number(creator.stats.totalPredictions),
},
{
key: 'avg-roi',
label: labels.avgRoi,
value: signedPercent(roi),
color: roi > 0 ? 'success' : roi < 0 ? 'danger' : 'primary',
},
] as const;
return (
<Card
tag={NextLink}
href={ROUTES.channel(creator.username)}
aria-label={labels.open(name)}
interactive
padding="none"
className="flex-1 no-underline"
>
<FlexBox direction="flex-col" gap="gap-3" className="h-full p-5">
<FlexBox alignItems="items-center" gap="gap-3">
<Avatar name={creator.username} src={creator.avatarUrl} size="lg" />
<FlexBox direction="flex-col" className="min-w-0">
<FlexBox alignItems="items-center" gap="gap-1">
<Typography
tag="span"
variant="heading-sm"
className="truncate font-bold"
>
{name}
</Typography>
{creator.verified && (
<Icon
name="check-circle"
size={16}
label={labels.verified}
className="flex-none text-action-primary"
/>
)}
</FlexBox>
{creator.displayName && (
<Typography
tag="span"
variant="caption"
color="secondary"
className="self-start"
>
<Element tag="bdi" dir="ltr">
@{creator.username}
</Element>
</Typography>
)}
</FlexBox>
</FlexBox>
{creator.markets.length > 0 && (
<FlexBox
tag="ul"
aria-label={labels.markets}
wrap="flex-wrap"
className="gap-1.5"
>
{creator.markets.map((market) => (
<Element tag="li" key={market}>
<Tag>{labels.marketNames[market]}</Tag>
</Element>
))}
</FlexBox>
)}
<Typography
variant="body-sm"
color="secondary"
className="line-clamp-2 min-h-12"
>
{creator.bio}
</Typography>
<GridBox tag="dl" cols="grid-cols-3" gap="gap-2">
{stats.map((stat) => (
<FlexBox
key={stat.key}
direction="flex-col-reverse"
className="gap-0.5 rounded-md bg-surface-sunken p-2.5"
>
<Typography tag="dt" variant="micro" color="secondary">
{stat.label}
</Typography>
<Typography
tag="dd"
variant="heading-sm"
color={'color' in stat ? stat.color : 'primary'}
className="m-0 font-bold"
>
{stat.value}
</Typography>
</FlexBox>
))}
</GridBox>
<FlexBox
alignItems="items-center"
gap="gap-1"
className="mt-auto text-action-primary"
>
<Typography
tag="span"
variant="label"
color="inherit"
className="font-bold"
>
{labels.view}
</Typography>
<Icon name="chevron-left" size={16} />
</FlexBox>
</FlexBox>
</Card>
);
}

View File

@ -0,0 +1,73 @@
'use client';
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { useRef } from 'react';
import type { AnalystCarouselProps } from '../types';
/**
* A scroll-snap row of cards that swipes on the phone, where the next card peeks. From 720px two
* arrows beside the heading move it by about a screen; «بعدی» goes the way the page reads.
*/
export function AnalystCarousel({
heading,
listLabel,
previousLabel,
nextLabel,
children,
}: AnalystCarouselProps) {
const trackRef = useRef<HTMLUListElement>(null);
const slide = (direction: 1 | -1) => {
const track = trackRef.current;
if (!track) return;
const rtl = getComputedStyle(track).direction === 'rtl';
const reduce = window.matchMedia(
'(prefers-reduced-motion: reduce)',
).matches;
track.scrollBy({
left: direction * (rtl ? -1 : 1) * track.clientWidth * 0.9,
behavior: reduce ? 'auto' : 'smooth',
});
};
return (
<FlexBox direction="flex-col" gap="gap-6">
<FlexBox
alignItems="items-end"
justifyContent="justify-between"
gap="gap-4"
>
{heading}
<FlexBox
alignItems="items-center"
gap="gap-2"
className="hidden flex-none tablet:flex"
>
<Button
variant="secondary"
icon="chevron-right"
label={previousLabel}
onClick={() => slide(-1)}
/>
<Button
variant="secondary"
icon="chevron-left"
label={nextLabel}
onClick={() => slide(1)}
/>
</FlexBox>
</FlexBox>
<FlexBox
ref={trackRef}
tag="ul"
aria-label={listLabel}
gap="gap-3"
className="-mx-4 snap-x snap-mandatory scroll-px-4 overflow-x-auto px-4 pt-1 pb-2 [scrollbar-width:none] tablet:-mx-8 tablet:scroll-px-8 tablet:gap-4 tablet:px-8 desktop:mx-0 desktop:scroll-px-0 desktop:px-0"
>
{children}
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,2 @@
export { FeaturedAnalysts } from './FeaturedAnalysts';
export type { FeaturedAnalystsLabels, FeaturedAnalystsProps } from './types';

View File

@ -0,0 +1,53 @@
import type { ReactNode } from 'react';
import type { FeaturedCreatorPayload } from '../../../../../features/channel';
import type { Market } from '../../../../../shared/constants';
export type FeaturedAnalystsLabels = {
kicker: string;
title: string;
lead: string;
/** The card list's accessible name: «تحلیلگران». */
list: string;
/** The arrows' accessible names: «تحلیلگران قبلی», «تحلیلگران بعدی». */
previous: string;
next: string;
/** Who chooses them, and that past results promise nothing. */
note: string;
card: {
/** The card link's accessible name: `(name) => «کانال سارا مرادی»`. */
open: (name: string) => string;
/** The verified mark's accessible name: «تأییدشده». */
verified: string;
/** The market list's accessible name: «بازارهای تخصصی». */
markets: string;
marketNames: Record<Market, string>;
winRate: string;
predictions: string;
avgRoi: string;
/** «مشاهده کانال». */
view: string;
};
};
export type FeaturedAnalystsProps = {
titleId: string;
/** Three or more, in the admin's order; the template hides the section otherwise. */
creators: FeaturedCreatorPayload[];
labels: FeaturedAnalystsLabels;
};
export type AnalystCardProps = {
creator: FeaturedCreatorPayload;
labels: FeaturedAnalystsLabels['card'];
};
export type AnalystCarouselProps = {
/** The section heading, beside the arrows. */
heading: ReactNode;
listLabel: string;
previousLabel: string;
nextLabel: string;
/** The cards, each in its `li`. */
children: ReactNode;
};

View File

@ -0,0 +1,50 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import NextLink from 'next/link';
import type { LandingClosingProps } from './types';
/** The closing call to action on a dark band: the title, one line, registration again and login. */
export function LandingClosing({
titleId,
registerHref,
loginHref,
labels,
}: LandingClosingProps) {
return (
<FlexBox
direction="flex-col"
alignItems="items-center"
gap="gap-3"
className="rounded-xl bg-surface-inverse px-5 py-9 text-center tablet:px-10 tablet:py-14"
>
<Typography tag="h2" id={titleId} variant="section" color="inverse">
{labels.title}
</Typography>
<Typography color="inverse" className="max-w-130 opacity-80">
{labels.lead}
</Typography>
<FlexBox
direction="flex-col"
className="mt-2 w-full max-w-90 tablet:w-auto tablet:max-w-none tablet:flex-row"
>
<Button variant="primary" size="lg" href={registerHref}>
{labels.register}
</Button>
</FlexBox>
<Typography color="inverse">
{labels.hasAccount}{' '}
<Typography
tag={NextLink}
href={loginHref}
variant="inherit"
color="inverse"
className="rounded-xs font-bold underline underline-offset-4 focus-visible:focus-ring-inverse"
>
{labels.login}
</Typography>
</Typography>
</FlexBox>
);
}

View File

@ -0,0 +1,2 @@
export { LandingClosing } from './LandingClosing';
export type { LandingClosingLabels, LandingClosingProps } from './types';

View File

@ -0,0 +1,16 @@
export type LandingClosingLabels = {
title: string;
lead: string;
/** «ثبت‌نام رایگان», the hero's action again. */
register: string;
/** «حساب کاربری دارید؟» before «ورود». */
hasAccount: string;
login: string;
};
export type LandingClosingProps = {
titleId: string;
registerHref: string;
loginHref: string;
labels: LandingClosingLabels;
};

View File

@ -0,0 +1,68 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Typography } from '@lumina/island/atoms/typography';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { Element } from '@lumina/island/primitives/element';
import { SupportEntry } from '../../../organisms/support-entry';
import { FAQ_ITEMS } from './constants';
import type { LandingFaqProps } from './types';
/**
* سؤالات متداول: native details and summary, so every answer is in the HTML and opens with no
* JavaScript; the first is open. Support is under the list.
*/
export function LandingFaq({
titleId,
supportPlacement,
labels,
}: LandingFaqProps) {
return (
<FlexBox direction="flex-col" className="gap-7 desktop:gap-10">
<SectionHeading titleId={titleId} align="center" title={labels.title} />
<FlexBox
direction="flex-col"
gap="gap-2"
className="mx-auto w-full max-w-190"
>
{FAQ_ITEMS.map((key, index) => (
<Element
key={key}
tag="details"
open={index === 0}
className="group rounded-lg border border-border-subtle bg-surface"
>
<FlexBox
tag="summary"
alignItems="items-center"
gap="gap-3"
className="min-h-14 cursor-pointer list-none rounded-lg px-4 py-3.5 focus-visible:focus-ring [&::-webkit-details-marker]:hidden"
>
<Typography tag="span" variant="body-md" className="font-bold">
{labels.items[key].question}
</Typography>
<Icon
name="chevron-down"
className="ms-auto flex-none text-text-secondary transition-transform duration-200 ease-standard group-open:rotate-180"
/>
</FlexBox>
<Typography color="secondary" className="px-4 pb-4 text-pretty">
{labels.items[key].answer}
</Typography>
</Element>
))}
</FlexBox>
<FlexBox
alignItems="items-center"
justifyContent="justify-center"
wrap="flex-wrap"
gap="gap-1"
>
<Typography tag="span" color="secondary">
{labels.more}
</Typography>
<SupportEntry trigger="link" placement={supportPlacement} />
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,14 @@
/** The FAQ's questions in order; the first is open. The FAQPage JSON-LD uses the same list. */
export const FAQ_ITEMS = [
'follow-cost',
'outcome',
'delete-loss',
'hidden-record',
'payment',
'expiry',
'suspension',
'advice',
'become-analyst',
] as const;
export type FaqItemKey = (typeof FAQ_ITEMS)[number];

View File

@ -0,0 +1,9 @@
import { FAQ_ITEMS } from './constants';
import type { LandingFaqLabels } from './types';
/** The questions in the page's order, for the FAQPage structured data: the same list it shows. */
export function faqEntries(
labels: LandingFaqLabels,
): { question: string; answer: string }[] {
return FAQ_ITEMS.map((key) => labels.items[key]);
}

View File

@ -0,0 +1,3 @@
export { faqEntries } from './faq-entries';
export { LandingFaq } from './LandingFaq';
export type { LandingFaqLabels, LandingFaqProps } from './types';

View File

@ -0,0 +1,15 @@
import type { FaqItemKey } from './constants';
export type LandingFaqLabels = {
title: string;
items: Record<FaqItemKey, { question: string; answer: string }>;
/** Before the support link: «پاسخ سؤالتان را پیدا نکردید؟». */
more: string;
};
export type LandingFaqProps = {
titleId: string;
/** How support opens: a bottom sheet on mobile, a popover on desktop. */
supportPlacement: 'bottom' | 'popover';
labels: LandingFaqLabels;
};

View File

@ -0,0 +1,125 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Typography } from '@lumina/island/atoms/typography';
import { Element } from '@lumina/island/primitives/element';
import { supportChatUrls } from '../../../organisms/support-entry';
import { FooterLink } from './components/FooterLink';
import type { LandingFooterProps } from './types';
/**
* The footer: the brand line, the section links, terms and the support chats (the support sheet's
* handles), the disclaimer and the copyright. The e-Namad seal joins the columns once it exists;
* until then nothing stands in for it.
*/
export function LandingFooter({
topId,
sections,
termsHref,
siteHost,
labels,
}: LandingFooterProps) {
const chats = supportChatUrls();
return (
<Element
tag="footer"
className="border-t border-border-subtle bg-bg-page py-8"
>
<FlexBox
direction="flex-col"
gap="gap-6"
className="mx-auto max-w-page px-4 tablet:px-8"
>
<GridBox
cols="grid-cols-2"
xGap="gap-x-4"
yGap="gap-y-6"
className="tablet:grid-cols-[2fr_1fr_1fr]"
>
<FlexBox
direction="flex-col"
className="col-span-2 gap-1.5 tablet:col-span-1"
>
<Typography
tag="a"
href={`#${topId}`}
aria-label={labels.brandHome}
variant="heading-md"
color="brand"
className="self-start rounded-xs no-underline focus-visible:focus-ring"
>
{labels.brand}
</Typography>
<Typography variant="body-sm" color="secondary">
{labels.tagline}
</Typography>
</FlexBox>
<FlexBox
tag="nav"
aria-label={labels.product}
direction="flex-col"
className="gap-0.5"
>
<Typography
variant="caption"
color="secondary"
className="mb-1 font-bold"
>
{labels.product}
</Typography>
{sections.map((section) => (
<FooterLink key={section.id} href={`#${section.id}`}>
{section.label}
</FooterLink>
))}
</FlexBox>
<FlexBox
tag="nav"
aria-label={labels.support}
direction="flex-col"
className="gap-0.5"
>
<Typography
variant="caption"
color="secondary"
className="mb-1 font-bold"
>
{labels.support}
</Typography>
<FooterLink href={termsHref}>{labels.terms}</FooterLink>
<FooterLink
href={chats.bale}
icon="bale"
opensNewTab={labels.opensNewTab}
>
{labels.bale}
</FooterLink>
<FooterLink
href={chats.telegram}
icon="telegram"
opensNewTab={labels.opensNewTab}
>
{labels.telegram}
</FooterLink>
</FlexBox>
</GridBox>
<FlexBox
direction="flex-col"
className="gap-1.5 border-t border-border-subtle pt-5"
>
<Typography variant="caption" color="secondary">
{labels.disclaimer}
</Typography>
<Typography variant="caption" color="secondary">
{labels.copyright}
{' · '}
<Element tag="bdi" dir="ltr">
{siteHost}
</Element>
</Typography>
</FlexBox>
</FlexBox>
</Element>
);
}

View File

@ -0,0 +1,61 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Typography } from '@lumina/island/atoms/typography';
import NextLink from 'next/link';
import type { FooterLinkProps } from '../types';
const LINK_CLASSES =
'min-h-touch-target self-start rounded-xs text-text-primary no-underline transition-colors duration-120 ease-standard hover:text-action-primary focus-visible:focus-ring';
/**
* A footer link with a 44px hit area: a route through NextLink, a section anchor or an outside
* chat, which opens in a new tab and says so to screen readers.
*/
export function FooterLink({
href,
icon,
opensNewTab,
children,
}: FooterLinkProps) {
const content = (
<>
{icon && <Icon name={icon} />}
<Typography tag="span" variant="body-md" color="inherit">
{children}
</Typography>
{opensNewTab && (
<Typography tag="span" className="sr-only">
{opensNewTab}
</Typography>
)}
</>
);
if (href.startsWith('/')) {
return (
<FlexBox
tag={NextLink}
href={href}
alignItems="items-center"
gap="gap-2"
className={LINK_CLASSES}
>
{content}
</FlexBox>
);
}
return (
<FlexBox
tag="a"
href={href}
target={opensNewTab ? '_blank' : undefined}
rel={opensNewTab ? 'noopener noreferrer' : undefined}
alignItems="items-center"
gap="gap-2"
className={LINK_CLASSES}
>
{content}
</FlexBox>
);
}

View File

@ -0,0 +1,2 @@
export { LandingFooter } from './LandingFooter';
export type { LandingFooterLabels, LandingFooterProps } from './types';

View File

@ -0,0 +1,39 @@
import type { IconName } from '@lumina/island/atoms/icon';
import type { ReactNode } from 'react';
import type { LandingSectionLink } from '../landing-header';
export type LandingFooterLabels = {
brand: string;
brandHome: string;
tagline: string;
/** The columns' headings and accessible names: «لومینا», «پشتیبانی». */
product: string;
support: string;
terms: string;
bale: string;
telegram: string;
/** After each external link, for screen readers. */
opensNewTab: string;
disclaimer: string;
copyright: string;
};
export type LandingFooterProps = {
topId: string;
/** The product column's section links. */
sections: LandingSectionLink[];
termsHref: string;
/** The site's address without the scheme: «lumina.ir». */
siteHost: string;
labels: LandingFooterLabels;
};
export type FooterLinkProps = {
/** A route (`/terms/…`), a section anchor (`#faq`) or an outside address. */
href: string;
icon?: IconName;
/** An outside link: it opens in a new tab, and this is read after its name. */
opensNewTab?: string;
children: ReactNode;
};

View File

@ -0,0 +1,90 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Typography } from '@lumina/island/atoms/typography';
import { SampleFrame } from '@lumina/island/molecules/sample-frame';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { ChannelSample } from './components/ChannelSample';
import { ANALYST_FEATURES } from './constants';
import type { LandingForAnalystsProps } from './types';
/**
* برای تحلیلگران, on a tinted panel: four things a creator gets, the apply action and its approval
* note, and from 720px a sample channel with the prices its analyst set.
*/
export function LandingForAnalysts({
titleId,
applyHref,
labels,
}: LandingForAnalystsProps) {
return (
<GridBox
cols="grid-cols-1"
alignItems="items-start"
className="gap-7 rounded-xl border border-action-primary-muted bg-action-primary-subtle px-5 py-7 tablet:p-10 desktop:grid-cols-2 desktop:items-center desktop:gap-14 desktop:p-14"
>
<FlexBox direction="flex-col" gap="gap-5">
<SectionHeading
titleId={titleId}
kicker={labels.kicker}
kickerIcon="analyst"
title={labels.title}
lead={labels.lead}
/>
<GridBox
tag="ul"
cols="grid-cols-1"
gap="gap-4"
className="mt-1 mb-1 tablet:grid-cols-2 tablet:gap-x-6 tablet:gap-y-5 desktop:grid-cols-1 desktop:gap-4"
>
{ANALYST_FEATURES.map(({ key, icon }) => (
<FlexBox key={key} tag="li" alignItems="items-start" gap="gap-3">
<GridBox
justifyItems="justify-items-center"
alignItems="items-center"
className="size-touch-target flex-none rounded-md bg-surface text-action-primary"
>
<Icon name={icon} size={24} />
</GridBox>
<FlexBox direction="flex-col" className="gap-0.5">
<Typography tag="h3" variant="body-md" className="font-bold">
{labels.features[key].title}
</Typography>
<Typography variant="body-sm" color="secondary">
{labels.features[key].description}
</Typography>
</FlexBox>
</FlexBox>
))}
</GridBox>
<FlexBox
direction="flex-col"
gap="gap-2"
className="tablet:flex-row tablet:items-center tablet:gap-4"
>
<Button
variant="primary"
size="lg"
href={applyHref}
className="flex-none"
>
{labels.apply}
</Button>
<Typography variant="caption" color="secondary">
{labels.applyNote}
</Typography>
</FlexBox>
</FlexBox>
<SampleFrame
tag={labels.sample}
caption={labels.caption}
tone="surface"
className="hidden tablet:flex"
>
<ChannelSample labels={labels.channel} />
</SampleFrame>
</GridBox>
);
}

View File

@ -0,0 +1,75 @@
import { Amount } from '@lumina/island/atoms/amount';
import { Avatar } from '@lumina/island/atoms/avatar';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Tag } from '@lumina/island/atoms/tag';
import { Typography } from '@lumina/island/atoms/typography';
import { Card } from '@lumina/island/molecules/card';
import { Element } from '@lumina/island/primitives/element';
import { SAMPLE_CHANNEL } from '../constants';
import type { ChannelSampleProps } from '../types';
/** A made-up channel card with the prices its analyst set, for the «نمونه» frame. */
export function ChannelSample({ labels }: ChannelSampleProps) {
return (
<Card padding="lg">
<FlexBox direction="flex-col" className="gap-3.5">
<FlexBox alignItems="items-center" gap="gap-3">
<Avatar name={SAMPLE_CHANNEL.username} size="lg" />
<FlexBox direction="flex-col" className="min-w-0">
<FlexBox alignItems="items-center" gap="gap-1">
<Typography tag="span" variant="heading-sm" className="font-bold">
{labels.name}
</Typography>
<Icon
name="check-circle"
size={16}
label={labels.verified}
className="text-action-primary"
/>
</FlexBox>
<Typography
tag="span"
variant="caption"
color="secondary"
className="self-start"
>
<Element tag="bdi" dir="ltr">
@{SAMPLE_CHANNEL.username}
</Element>
</Typography>
</FlexBox>
</FlexBox>
<Typography color="secondary">{labels.bio}</Typography>
<FlexBox wrap="flex-wrap" className="gap-1.5">
{SAMPLE_CHANNEL.markets.map((market) => (
<Tag key={market}>{labels.marketNames[market]}</Tag>
))}
</FlexBox>
<FlexBox
direction="flex-col"
className="border-t border-border-subtle pt-1"
>
<Typography variant="heading-sm" className="pt-2 pb-0.5">
{labels.prices}
</Typography>
{SAMPLE_CHANNEL.prices.map(({ period, toman }) => (
<FlexBox
key={period}
alignItems="items-baseline"
justifyContent="justify-between"
gap="gap-3"
className="border-b border-border-subtle py-2 last:border-b-0"
>
<Typography tag="span" color="secondary">
{labels.periods[period]}
</Typography>
<Amount value={toman} currency={labels.currency} />
</FlexBox>
))}
</FlexBox>
</FlexBox>
</Card>
);
}

View File

@ -0,0 +1,29 @@
import type { IconName } from '@lumina/island/atoms/icon';
import type { BillingPeriod, Market } from '../../../../../shared/constants';
/** What a creator gets from Lumina. */
export const ANALYST_FEATURES = [
{ key: 'profile', icon: 'user' },
{ key: 'income', icon: 'wallet' },
{ key: 'record', icon: 'trend-up' },
{ key: 'dashboard', icon: 'dashboard' },
] as const satisfies readonly { key: string; icon: IconName }[];
export type AnalystFeatureKey = (typeof ANALYST_FEATURES)[number]['key'];
/** A made-up channel with the prices its analyst set, in Toman; the name and bio are in the labels. */
export const SAMPLE_CHANNEL = {
username: 'sara_gold',
markets: ['gold', 'forex'],
prices: [
{ period: 'monthly', toman: 400000 },
{ period: 'quarterly', toman: 1080000 },
{ period: 'semi_annual', toman: 1920000 },
{ period: 'yearly', toman: 3360000 },
],
} as const satisfies {
username: string;
markets: readonly Market[];
prices: readonly { period: BillingPeriod; toman: number }[];
};

View File

@ -0,0 +1,5 @@
export { LandingForAnalysts } from './LandingForAnalysts';
export type {
LandingForAnalystsLabels,
LandingForAnalystsProps,
} from './types';

View File

@ -0,0 +1,39 @@
import type { BillingPeriod, Market } from '../../../../../shared/constants';
import type { AnalystFeatureKey } from './constants';
export type LandingForAnalystsLabels = {
kicker: string;
title: string;
lead: string;
features: Record<AnalystFeatureKey, { title: string; description: string }>;
/** «درخواست عضویت تحلیلگر». */
apply: string;
/** Approval comes after identity checks. */
applyNote: string;
/** «نمونه». */
sample: string;
caption: string;
channel: {
name: string;
bio: string;
/** «قیمت طرح‌ها». */
prices: string;
/** «تومان». */
currency: string;
/** The verified mark's accessible name. */
verified: string;
marketNames: Record<Market, string>;
periods: Record<BillingPeriod, string>;
};
};
export type LandingForAnalystsProps = {
titleId: string;
/** Registration with the creator account type chosen. */
applyHref: string;
labels: LandingForAnalystsLabels;
};
export type ChannelSampleProps = {
labels: LandingForAnalystsLabels['channel'];
};

View File

@ -0,0 +1,96 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { Element } from '@lumina/island/primitives/element';
import { SupportEntry } from '../../../organisms/support-entry';
import type { LandingHeaderProps } from './types';
/**
* The landing's logged-out bar, sticky: the brand, support and «ورود/ثبت‌نام» (the top-bar rule).
* Login is a text button on the phone and a secondary Button from 720px, because the hero holds
* the page's one primary. On desktop the section links follow the brand.
*/
export function LandingHeader({
layout,
topId,
sections,
loginHref,
labels,
}: LandingHeaderProps) {
const isDesktop = layout === 'desktop';
return (
<Element
tag="header"
className="sticky top-0 z-sticky border-b border-border-subtle bg-surface"
>
<FlexBox
alignItems="items-center"
gap="gap-1"
className="mx-auto h-14 max-w-page ps-4 pe-2 tablet:h-16 tablet:ps-8 tablet:pe-6"
>
<Typography
tag="a"
href={`#${topId}`}
aria-label={labels.brandHome}
variant="heading-md"
color="brand"
className="rounded-xs no-underline focus-visible:focus-ring"
>
{labels.brand}
</Typography>
{isDesktop && (
<FlexBox
tag="nav"
aria-label={labels.sections}
alignItems="items-center"
className="ms-8 gap-0.5"
>
{sections.map((section) => (
<FlexBox
key={section.id}
tag="a"
href={`#${section.id}`}
alignItems="items-center"
className="h-10 rounded-full px-3.5 text-text-secondary no-underline transition-colors duration-120 ease-standard hover:bg-surface-hover hover:text-text-primary focus-visible:focus-ring"
>
<Typography
tag="span"
variant="body-md"
color="inherit"
className="font-semibold"
>
{section.label}
</Typography>
</FlexBox>
))}
</FlexBox>
)}
<FlexBox alignItems="items-center" gap="gap-1" className="ms-auto">
<SupportEntry
trigger="icon"
placement={isDesktop ? 'popover' : 'bottom'}
/>
{!isDesktop && (
<Button
variant="ghost"
size="sm"
href={loginHref}
className="tablet:hidden"
>
{labels.login}
</Button>
)}
<Button
variant="secondary"
href={loginHref}
className={isDesktop ? undefined : 'hidden tablet:inline-flex'}
>
{labels.login}
</Button>
</FlexBox>
</FlexBox>
</Element>
);
}

View File

@ -0,0 +1,6 @@
export { LandingHeader } from './LandingHeader';
export type {
LandingHeaderLabels,
LandingHeaderProps,
LandingSectionLink,
} from './types';

View File

@ -0,0 +1,27 @@
export type LandingHeaderLabels = {
/** «لومینا». */
brand: string;
/** The brand link's accessible name: «صفحه اصلی لومینا». */
brandHome: string;
/** The section links' accessible name: «بخش‌های صفحه». */
sections: string;
/** «ورود/ثبت‌نام». */
login: string;
};
export type LandingSectionLink = {
/** The section's id, linked as `#id`. */
id: string;
label: string;
};
export type LandingHeaderProps = {
/** mobile: support opens a bottom sheet. desktop: the section links, and support as a popover. */
layout: 'mobile' | 'desktop';
/** The page's top, for the brand. */
topId: string;
/** The section links, desktop only. */
sections: LandingSectionLink[];
loginHref: string;
labels: LandingHeaderLabels;
};

View File

@ -0,0 +1,133 @@
import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Typography } from '@lumina/island/atoms/typography';
import Image from 'next/image';
import { HERO_IMAGE } from './constants';
import type { LandingHeroProps } from './types';
/**
* The hero: kicker, the page's only h1, the lead, two actions and a note, beside the product
* picture. On the phone and tablet the picture comes first with the kicker and h1 written on it in
* white over a black gradient, and the copy follows under its caption; from 1024px the picture
* sits beside the copy and the title is back in ink. Layout only: the h1 stays first in the DOM.
* The picture is the page's LCP, so it loads eagerly at high priority.
*/
export function LandingHero({
titleId,
registerHref,
howHref,
labels,
}: LandingHeroProps) {
return (
<GridBox
cols="grid-cols-1"
gap="gap-4"
alignItems="items-center"
className="desktop:grid-cols-2 desktop:gap-16"
>
{/* Phone and tablet: its children join the grid, so the title can sit on the picture. */}
<FlexBox
direction="flex-col"
className="contents desktop:flex desktop:gap-4"
>
<FlexBox
direction="flex-col"
gap="gap-2"
className="z-1 col-start-1 row-start-1 self-end p-5 tablet:px-8 tablet:py-7 desktop:z-auto desktop:p-0"
>
<FlexBox
alignItems="items-center"
gap="gap-1"
className="text-text-inverse/90 desktop:text-action-primary-text"
>
<Icon name="shield-check" size={16} />
<Typography
tag="span"
variant="caption"
color="inherit"
className="font-bold"
>
{labels.kicker}
</Typography>
</FlexBox>
<Typography
tag="h1"
id={titleId}
variant="hero"
color="inverse"
className="desktop:text-text-primary"
>
{labels.title}
</Typography>
</FlexBox>
<Typography
variant="body-lg"
color="secondary"
className="row-start-3 text-pretty desktop:max-w-140"
>
{labels.lead}
</Typography>
<FlexBox
direction="flex-col"
gap="gap-2"
className="row-start-4 mt-1 tablet:flex-row tablet:flex-wrap"
>
<Button variant="primary" size="lg" href={registerHref}>
{labels.register}
</Button>
<Button variant="secondary" size="lg" href={howHref}>
{labels.how}
</Button>
</FlexBox>
<FlexBox
tag="p"
alignItems="items-center"
gap="gap-2"
className="row-start-5"
>
<Icon
name="check"
size={16}
className="flex-none text-action-primary"
/>
<Typography tag="span" variant="caption" color="secondary">
{labels.note}
</Typography>
</FlexBox>
</FlexBox>
<FlexBox
tag="figure"
direction="flex-col"
className="contents desktop:flex desktop:gap-2"
>
<FlexBox
justifyContent="justify-center"
alignItems="items-end"
className="relative col-start-1 row-start-1 overflow-hidden rounded-xl bg-action-primary-subtle px-3 pt-5 after:pointer-events-none after:absolute after:inset-0 after:bg-linear-to-t after:from-image-shade/86 after:via-image-shade/62 after:via-36% after:to-transparent after:to-70% desktop:px-6 desktop:pt-7 desktop:after:hidden"
>
<Image
src={HERO_IMAGE.src}
width={HERO_IMAGE.width}
height={HERO_IMAGE.height}
sizes={HERO_IMAGE.sizes}
alt={labels.imageAlt}
loading="eager"
fetchPriority="high"
className="block h-auto w-full max-w-90 tablet:max-w-105 desktop:max-w-130"
/>
</FlexBox>
<Typography
tag="figcaption"
variant="caption"
color="secondary"
className="row-start-2"
>
{labels.imageCaption}
</Typography>
</FlexBox>
</GridBox>
);
}

View File

@ -0,0 +1,12 @@
/**
* The hero picture, exported at 2× from the design's `Landing--hero-image` artboard (a real channel
* in a tilted phone with a floating prediction). Each app serves it from `public/images/`; when the
* screens it shows change, export it again and replace both copies.
*/
export const HERO_IMAGE = {
src: '/images/lumina-hero.webp',
width: 560,
height: 620,
/** Its rendered width: 360px on the phone, 420 from 720px, 520 on desktop. */
sizes: '(min-width: 1024px) 520px, (min-width: 720px) 420px, 360px',
} as const;

View File

@ -0,0 +1,2 @@
export { LandingHero } from './LandingHero';
export type { LandingHeroLabels, LandingHeroProps } from './types';

View File

@ -0,0 +1,21 @@
export type LandingHeroLabels = {
kicker: string;
/** The page's only h1. */
title: string;
lead: string;
/** «ثبت‌نام رایگان», the page's one primary action. */
register: string;
/** «چطور کار می‌کند», down to its section. */
how: string;
note: string;
imageAlt: string;
imageCaption: string;
};
export type LandingHeroProps = {
/** The h1's id, for the section's `aria-labelledby`. */
titleId: string;
registerHref: string;
howHref: string;
labels: LandingHeroLabels;
};

View File

@ -0,0 +1,93 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Typography } from '@lumina/island/atoms/typography';
import { SampleFrame } from '@lumina/island/molecules/sample-frame';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { PredictionCard } from '@lumina/island/organisms/prediction-card';
import { Element } from '@lumina/island/primitives/element';
import { MarketTabs } from './components/MarketTabs';
import { LANDING_MARKETS, MARKET_SAMPLES } from './constants';
import type { LandingMarketsProps } from './types';
/**
* بازارها: tabs for the four markets (the design system's market labels). Each panel has the
* market's name, one line, three example symbols and a fixed sample prediction of that market.
*/
export function LandingMarkets({
titleId,
sampleNow,
labels,
}: LandingMarketsProps) {
const tabs = LANDING_MARKETS.map((market) => {
const panel = labels.panels[market];
const sample = MARKET_SAMPLES[market];
return {
id: `market-${market}`,
label: labels.marketNames[market],
panel: (
<GridBox
cols="grid-cols-1"
gap="gap-5"
alignItems="items-start"
className="desktop:grid-cols-2 desktop:items-center desktop:gap-8"
>
<FlexBox direction="flex-col" className="gap-2.5 desktop:pe-6">
<Typography
tag="h3"
variant="heading-md"
className="desktop:text-heading-lg"
>
{labels.marketNames[market]}
</Typography>
<Typography color="secondary" className="desktop:text-body-lg">
{panel.description}
</Typography>
<FlexBox
tag="ul"
aria-label={labels.symbols}
wrap="flex-wrap"
className="mt-1 gap-1.5"
>
{panel.symbols.map((symbol) => (
<Typography
key={symbol}
tag="li"
variant="caption"
className="rounded-sm bg-surface-sunken px-2.5 font-semibold"
>
<Element tag="bdi">{symbol}</Element>
</Typography>
))}
</FlexBox>
</FlexBox>
<SampleFrame tag={labels.sample} caption={panel.caption}>
<PredictionCard
prediction={{
...sample.prediction,
targetPrices: [...sample.prediction.targetPrices],
market: labels.marketNames[market],
}}
publishedAt={sample.publishedAt}
now={sampleNow}
labels={labels.prediction}
/>
</SampleFrame>
</GridBox>
),
};
});
return (
<FlexBox direction="flex-col" className="gap-7 desktop:gap-10">
<SectionHeading
titleId={titleId}
align="center"
kicker={labels.kicker}
title={labels.title}
lead={labels.lead}
/>
<MarketTabs label={labels.tabs} tabs={tabs} />
</FlexBox>
);
}

View File

@ -0,0 +1,99 @@
'use client';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { Element } from '@lumina/island/primitives/element';
import { cn } from '@lumina/island/tools/cn';
import { useRef, useState } from 'react';
import type { KeyboardEvent } from 'react';
import type { MarketTabsProps } from '../types';
/** Arrow keys follow the reading direction: in RTL, ArrowLeft moves to the next tab. */
function stepFor(key: string, rtl: boolean): number {
if (key === 'ArrowLeft') return rtl ? 1 : -1;
if (key === 'ArrowRight') return rtl ? -1 : 1;
return 0;
}
/**
* ARIA tabs over one panel each, the first selected. Every panel is in the server HTML; only the
* selected one shows. Arrow keys, Home and End move between tabs and select them. On the phone the
* tab row scrolls sideways when it doesn't fit.
*/
export function MarketTabs({ label, tabs }: MarketTabsProps) {
const [selected, setSelected] = useState(0);
const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
const select = (index: number) => {
setSelected(index);
tabRefs.current[index]?.focus();
};
const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {
const last = tabs.length - 1;
if (event.key === 'Home') select(0);
else if (event.key === 'End') select(last);
else {
const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';
const step = stepFor(event.key, rtl);
if (step === 0) return;
select((selected + step + tabs.length) % tabs.length);
}
event.preventDefault();
};
return (
<FlexBox direction="flex-col" gap="gap-5">
<FlexBox
role="tablist"
aria-label={label}
gap="gap-2"
onKeyDown={onKeyDown}
className="-mx-4 overflow-x-auto px-4 pt-0.5 pb-1 [scrollbar-width:none] tablet:mx-0 tablet:justify-center tablet:px-0"
>
{tabs.map((tab, index) => {
const isSelected = index === selected;
return (
<Typography
key={tab.id}
ref={(node: HTMLButtonElement | null) => {
tabRefs.current[index] = node;
}}
tag="button"
type="button"
role="tab"
id={`${tab.id}-tab`}
aria-selected={isSelected}
aria-controls={`${tab.id}-panel`}
tabIndex={isSelected ? 0 : -1}
onClick={() => setSelected(index)}
variant="label"
color="inherit"
className={cn(
'h-11 flex-none cursor-pointer rounded-full border px-4 whitespace-nowrap transition-colors duration-120 ease-standard focus-visible:focus-ring',
isSelected
? 'border-action-primary bg-action-primary text-text-on-action'
: 'border-border-default bg-surface text-text-primary hover:bg-surface-hover',
)}
>
{tab.label}
</Typography>
);
})}
</FlexBox>
{tabs.map((tab, index) => (
<Element
key={tab.id}
tag="div"
role="tabpanel"
id={`${tab.id}-panel`}
aria-labelledby={`${tab.id}-tab`}
hidden={index !== selected}
>
{tab.panel}
</Element>
))}
</FlexBox>
);
}

View File

@ -0,0 +1,74 @@
import type { PredictionData } from '@lumina/island/organisms/prediction-card';
/** The four markets the landing shows, in tab order; gold is selected first. */
export const LANDING_MARKETS = ['gold', 'forex', 'crypto', 'equities'] as const;
export type LandingMarket = (typeof LANDING_MARKETS)[number];
/**
* One fixed sample prediction per market (a win, a breakeven, an open one, a win), never live
* prices or results. The market label comes from the translations.
*/
export const MARKET_SAMPLES = {
gold: {
publishedAt: '2026-09-14T06:30:00Z',
prediction: {
symbol: 'XAUUSD',
direction: 'long',
entryPrice: 2310,
targetPrices: [2400, 2450],
stopLoss: 2280,
horizon: '2w',
status: 'closed',
outcome: 'win',
closedPrice: 2402,
closedAt: '2026-09-27T09:00:00Z',
},
},
forex: {
publishedAt: '2026-09-21T09:00:00Z',
prediction: {
symbol: 'EURUSD',
direction: 'short',
entryPrice: 1.092,
targetPrices: [1.08],
stopLoss: 1.098,
horizon: '1w',
status: 'closed',
outcome: 'breakeven',
closedPrice: 1.092,
closedAt: '2026-09-26T12:00:00Z',
},
},
crypto: {
publishedAt: '2026-09-28T10:15:00Z',
prediction: {
symbol: 'BTCUSDT',
direction: 'short',
entryPrice: 68000,
targetPrices: [61000],
stopLoss: 70500,
horizon: '45d',
status: 'open',
expiresAt: '2026-11-12T10:15:00Z',
},
},
equities: {
publishedAt: '2026-08-24T08:30:00Z',
prediction: {
symbol: 'فولاد',
direction: 'long',
entryPrice: 1250,
targetPrices: [1400],
stopLoss: 1180,
horizon: '30d',
status: 'closed',
outcome: 'win',
closedPrice: 1405,
closedAt: '2026-09-18T09:00:00Z',
},
},
} as const satisfies Record<
LandingMarket,
{ publishedAt: string; prediction: Omit<PredictionData, 'market'> }
>;

View File

@ -0,0 +1,2 @@
export { LandingMarkets } from './LandingMarkets';
export type { LandingMarketsLabels, LandingMarketsProps } from './types';

View File

@ -0,0 +1,42 @@
import type { PredictionCardLabels } from '@lumina/island/organisms/prediction-card';
import type { ReactNode } from 'react';
import type { LandingMarket } from './constants';
export type LandingMarketsLabels = {
kicker: string;
title: string;
lead: string;
/** The tab list's accessible name: «بازارها». */
tabs: string;
/** Each symbol list's accessible name: «نمونه‌ی نمادها». */
symbols: string;
/** «نمونه», over each sample. */
sample: string;
/** Each market's name, from the shared market labels: «طلا و سکه». */
marketNames: Record<LandingMarket, string>;
panels: Record<
LandingMarket,
{ description: string; symbols: string[]; caption: string }
>;
prediction: PredictionCardLabels;
};
export type LandingMarketsProps = {
titleId: string;
/** What the samples' times count from, fixed so they never age. */
sampleNow: string;
labels: LandingMarketsLabels;
};
export type MarketTab = {
id: string;
label: string;
panel: ReactNode;
};
export type MarketTabsProps = {
/** The tab list's accessible name. */
label: string;
tabs: MarketTab[];
};

View File

@ -0,0 +1,60 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { FactCard } from '@lumina/island/molecules/fact-card';
import { SampleFrame } from '@lumina/island/molecules/sample-frame';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { PostCard } from '@lumina/island/organisms/post-card';
import { PLAN_FACTS, SAMPLE_POST } from './constants';
import type { LandingPlansProps } from './types';
/**
* اشتراک: free follow against premium, four facts on how a subscription works, and a locked premium
* post as a guest sees it before subscribing.
*/
export function LandingPlans({
titleId,
sampleNow,
labels,
}: LandingPlansProps) {
return (
<GridBox
cols="grid-cols-1"
alignItems="items-start"
className="gap-7 desktop:grid-cols-2 desktop:items-center desktop:gap-16"
>
<FlexBox direction="flex-col" className="gap-7 desktop:gap-10">
<SectionHeading
titleId={titleId}
kicker={labels.kicker}
title={labels.title}
lead={labels.lead}
/>
<FlexBox tag="ul" direction="flex-col" className="gap-2.5">
{PLAN_FACTS.map(({ key, icon }) => (
<FactCard
key={key}
tag="li"
icon={icon}
title={labels.facts[key].title}
description={labels.facts[key].description}
/>
))}
</FlexBox>
</FlexBox>
<SampleFrame tag={labels.sample} caption={labels.caption}>
<PostCard
author={SAMPLE_POST.author}
publishedAt={SAMPLE_POST.publishedAt}
now={sampleNow}
locked
viewer="guest"
captionPreview={labels.samplePreview}
mediaCount={SAMPLE_POST.mediaCount}
labels={labels.post}
predictionLabels={labels.prediction}
/>
</SampleFrame>
</GridBox>
);
}

View File

@ -0,0 +1,18 @@
import type { IconName } from '@lumina/island/atoms/icon';
/** How a subscription works, each a product rule; change the copy when a rule changes. */
export const PLAN_FACTS = [
{ key: 'periods', icon: 'calendar' },
{ key: 'access', icon: 'wallet' },
{ key: 'reminder', icon: 'bell' },
{ key: 'renewal', icon: 'receipt' },
] as const satisfies readonly { key: string; icon: IconName }[];
export type PlanFactKey = (typeof PLAN_FACTS)[number]['key'];
/** A locked premium post as a guest sees it: its teaser comes from the labels. */
export const SAMPLE_POST = {
author: { username: 'sara_gold', verified: true },
publishedAt: '2026-10-01T18:40:00Z',
mediaCount: 2,
} as const;

View File

@ -0,0 +1,2 @@
export { LandingPlans } from './LandingPlans';
export type { LandingPlansLabels, LandingPlansProps } from './types';

View File

@ -0,0 +1,25 @@
import type { PostCardLabels } from '@lumina/island/organisms/post-card';
import type { PredictionCardLabels } from '@lumina/island/organisms/prediction-card';
import type { PlanFactKey } from './constants';
export type LandingPlansLabels = {
kicker: string;
title: string;
lead: string;
facts: Record<PlanFactKey, { title: string; description: string }>;
/** «نمونه». */
sample: string;
/** The sample post's teaser. */
samplePreview: string;
caption: string;
post: PostCardLabels;
prediction: PredictionCardLabels;
};
export type LandingPlansProps = {
titleId: string;
/** What the samples' times count from, fixed so they never age. */
sampleNow: string;
labels: LandingPlansLabels;
};

View File

@ -0,0 +1,87 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Typography } from '@lumina/island/atoms/typography';
import { FactCard } from '@lumina/island/molecules/fact-card';
import { SampleFrame } from '@lumina/island/molecules/sample-frame';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { CreatorStats } from '@lumina/island/organisms/creator-stats';
import { PredictionCard } from '@lumina/island/organisms/prediction-card';
import { Element } from '@lumina/island/primitives/element';
import { RECORD_FACTS, SAMPLE_LOSS, SAMPLE_STATS } from './constants';
import type { LandingRecordProps } from './types';
/**
* کارنامه: four facts on how a track record is kept, beside a sample record, and from 720px a
* losing prediction under it, because losses stay in the record.
*/
export function LandingRecord({
titleId,
sampleNow,
labels,
}: LandingRecordProps) {
return (
<GridBox
cols="grid-cols-1"
alignItems="items-start"
className="gap-7 desktop:grid-cols-2 desktop:items-center desktop:gap-16"
>
<FlexBox direction="flex-col" className="gap-7 desktop:gap-10">
<SectionHeading
titleId={titleId}
kicker={labels.kicker}
title={labels.title}
lead={labels.lead}
/>
<FlexBox tag="ul" direction="flex-col" className="gap-2.5">
{RECORD_FACTS.map(({ key, icon }) => (
<FactCard
key={key}
tag="li"
icon={icon}
title={labels.facts[key].title}
description={labels.facts[key].description}
/>
))}
</FlexBox>
</FlexBox>
<SampleFrame
tag={labels.sample}
caption={
<>
<Typography
tag="span"
variant="inherit"
color="inherit"
className="tablet:hidden"
>
{labels.caption}
</Typography>
<Typography
tag="span"
variant="inherit"
color="inherit"
className="hidden tablet:inline"
>
{labels.captionWide}
</Typography>
</>
}
>
<CreatorStats stats={SAMPLE_STATS} labels={labels.stats} />
<Element tag="div" className="hidden tablet:block">
<PredictionCard
prediction={{
...SAMPLE_LOSS.prediction,
targetPrices: [...SAMPLE_LOSS.prediction.targetPrices],
market: labels.lossMarket,
}}
publishedAt={SAMPLE_LOSS.publishedAt}
now={sampleNow}
labels={labels.prediction}
/>
</Element>
</SampleFrame>
</GridBox>
);
}

View File

@ -0,0 +1,56 @@
import type { IconName } from '@lumina/island/atoms/icon';
import type { CreatorStatsData } from '@lumina/island/organisms/creator-stats';
import type { PredictionData } from '@lumina/island/organisms/prediction-card';
/** The facts behind a track record, each a product rule; change the copy when a rule changes. */
export const RECORD_FACTS = [
{ key: 'immutable', icon: 'lock' },
{ key: 'outcome', icon: 'target' },
{ key: 'public', icon: 'eye' },
{ key: 'threshold', icon: 'calendar' },
] as const satisfies readonly { key: string; icon: IconName }[];
export type RecordFactKey = (typeof RECORD_FACTS)[number]['key'];
/** A made-up track record. */
export const SAMPLE_STATS: CreatorStatsData = {
totalPredictions: 42,
activePredictions: 7,
wins: 22,
losses: 12,
breakeven: 1,
winRate: 62.86,
avgRoiPercent: 8.7,
accuracyTrend: [
'win',
'loss',
'win',
'win',
'breakeven',
'win',
'loss',
'win',
'win',
'win',
],
};
/** A losing prediction, from 720px: losses stay in the record. Its market comes from the labels. */
export const SAMPLE_LOSS = {
publishedAt: '2026-08-30T07:00:00Z',
prediction: {
symbol: 'TEDPIX',
direction: 'long',
entryPrice: 2150000,
targetPrices: [2300000, 2400000],
stopLoss: 2080000,
horizon: '30d',
status: 'closed',
outcome: 'loss',
closedPrice: 2078000,
closedAt: '2026-09-20T10:00:00Z',
},
} as const satisfies {
publishedAt: string;
prediction: Omit<PredictionData, 'market'>;
};

View File

@ -0,0 +1,2 @@
export { LandingRecord } from './LandingRecord';
export type { LandingRecordLabels, LandingRecordProps } from './types';

View File

@ -0,0 +1,27 @@
import type { CreatorStatsLabels } from '@lumina/island/organisms/creator-stats';
import type { PredictionCardLabels } from '@lumina/island/organisms/prediction-card';
import type { RecordFactKey } from './constants';
export type LandingRecordLabels = {
kicker: string;
title: string;
lead: string;
facts: Record<RecordFactKey, { title: string; description: string }>;
/** «نمونه». */
sample: string;
/** The phone's caption (the record only) and the wider one (the record and a loss). */
caption: string;
captionWide: string;
/** The losing sample's market: «بورس». */
lossMarket: string;
stats: CreatorStatsLabels;
prediction: PredictionCardLabels;
};
export type LandingRecordProps = {
titleId: string;
/** What the samples' times count from, fixed so they never age. */
sampleNow: string;
labels: LandingRecordLabels;
};

View File

@ -0,0 +1,67 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Typography } from '@lumina/island/atoms/typography';
import { SectionHeading } from '@lumina/island/molecules/section-heading';
import { number } from '@lumina/tools/format';
import { LANDING_STEPS } from './constants';
import type { LandingStepsProps } from './types';
/**
* چطور کار می‌کند: an investor's three steps (register, judge analysts and follow free, subscribe),
* a numbered list read in order; the drawn numbers are decoration.
*/
export function LandingSteps({ titleId, labels }: LandingStepsProps) {
return (
<FlexBox direction="flex-col" className="gap-7 desktop:gap-10">
<SectionHeading
titleId={titleId}
kicker={labels.kicker}
title={labels.title}
/>
<GridBox
tag="ol"
cols="grid-cols-1"
gap="gap-5"
className="desktop:grid-cols-3 desktop:gap-8"
>
{LANDING_STEPS.map((key, index) => (
<FlexBox
key={key}
tag="li"
alignItems="items-start"
className="gap-3.5 desktop:flex-col desktop:gap-3"
>
<GridBox
aria-hidden
justifyItems="justify-items-center"
alignItems="items-center"
className="size-10 flex-none rounded-full bg-action-primary"
>
<Typography
tag="span"
variant="heading-sm"
color="on-action"
className="font-bold"
>
{number(index + 1)}
</Typography>
</GridBox>
<FlexBox
direction="flex-col"
gap="gap-1"
className="pt-1.5 desktop:pt-0"
>
<Typography tag="h3" variant="heading-sm" className="font-bold">
{labels.steps[key].title}
</Typography>
<Typography color="secondary">
{labels.steps[key].description}
</Typography>
</FlexBox>
</FlexBox>
))}
</GridBox>
</FlexBox>
);
}

View File

@ -0,0 +1,4 @@
/** An investor's three steps, in order. */
export const LANDING_STEPS = ['register', 'judge', 'subscribe'] as const;
export type LandingStepKey = (typeof LANDING_STEPS)[number];

View File

@ -0,0 +1,2 @@
export { LandingSteps } from './LandingSteps';
export type { LandingStepsLabels, LandingStepsProps } from './types';

View File

@ -0,0 +1,12 @@
import type { LandingStepKey } from './constants';
export type LandingStepsLabels = {
kicker: string;
title: string;
steps: Record<LandingStepKey, { title: string; description: string }>;
};
export type LandingStepsProps = {
titleId: string;
labels: LandingStepsLabels;
};

View File

@ -0,0 +1,52 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { GridBox } from '@lumina/island/atoms/grid-box';
import { Icon } from '@lumina/island/atoms/icon';
import { Typography } from '@lumina/island/atoms/typography';
import { Element } from '@lumina/island/primitives/element';
import { TRUST_ITEMS } from './constants';
import type { LandingTrustProps } from './types';
/** Four product facts under the hero, each with its icon: 2 × 2 on the phone, one row from 720px. */
export function LandingTrust({ labels }: LandingTrustProps) {
return (
<Element
tag="section"
aria-label={labels.label}
className="border-y border-border-subtle bg-surface"
>
<GridBox
tag="ul"
cols="grid-cols-2"
xGap="gap-x-3"
yGap="gap-y-4"
className="mx-auto max-w-page px-4 py-5 tablet:grid-cols-4 tablet:px-8 tablet:py-6"
>
{TRUST_ITEMS.map(({ key, icon }) => (
<FlexBox
key={key}
tag="li"
alignItems="items-center"
className="gap-2.5"
>
<GridBox
justifyItems="justify-items-center"
alignItems="items-center"
className="size-10 flex-none rounded-full bg-action-primary-subtle text-action-primary"
>
<Icon name={icon} />
</GridBox>
<FlexBox direction="flex-col" className="min-w-0">
<Typography tag="span" variant="label" className="font-bold">
{labels.items[key].title}
</Typography>
<Typography tag="span" variant="caption" color="secondary">
{labels.items[key].description}
</Typography>
</FlexBox>
</FlexBox>
))}
</GridBox>
</Element>
);
}

View File

@ -0,0 +1,11 @@
import type { IconName } from '@lumina/island/atoms/icon';
/** Product facts, never user, subscriber or volume counts. */
export const TRUST_ITEMS = [
{ key: 'verified', icon: 'shield-check' },
{ key: 'immutable', icon: 'lock' },
{ key: 'gateway', icon: 'wallet' },
{ key: 'support', icon: 'headset' },
] as const satisfies readonly { key: string; icon: IconName }[];
export type TrustItemKey = (typeof TRUST_ITEMS)[number]['key'];

View File

@ -0,0 +1,2 @@
export { LandingTrust } from './LandingTrust';
export type { LandingTrustLabels, LandingTrustProps } from './types';

View File

@ -0,0 +1,9 @@
import type { TrustItemKey } from './constants';
export type LandingTrustLabels = {
/** The strip's accessible name: «چرا به لومینا اعتماد کنید». */
label: string;
items: Record<TrustItemKey, { title: string; description: string }>;
};
export type LandingTrustProps = { labels: LandingTrustLabels };

View File

@ -0,0 +1,182 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Element } from '@lumina/island/primitives/element';
import {
loginRoute,
registerRoute,
ROUTES,
} from '../../../../navigation/navigation';
import { FeaturedAnalysts } from '../../organisms/featured-analysts';
import { LandingClosing } from '../../organisms/landing-closing';
import { LandingFaq } from '../../organisms/landing-faq';
import { LandingFooter } from '../../organisms/landing-footer';
import { LandingForAnalysts } from '../../organisms/landing-for-analysts';
import { LandingHeader } from '../../organisms/landing-header';
import { LandingHero } from '../../organisms/landing-hero';
import { LandingMarkets } from '../../organisms/landing-markets';
import { LandingPlans } from '../../organisms/landing-plans';
import { LandingRecord } from '../../organisms/landing-record';
import { LandingSteps } from '../../organisms/landing-steps';
import { LandingTrust } from '../../organisms/landing-trust';
import { LandingSection } from './components/LandingSection';
import { LANDING_SECTION_IDS as IDS, SAMPLE_NOW } from './constants';
import { titleIdOf } from './title-id';
import type { LandingTemplateProps } from './types';
/** The markets band is grey; the bands after it alternate. */
function groundAt(index: number): 'page' | 'surface' {
return index % 2 === 0 ? 'page' : 'surface';
}
/**
* The landing at `/`, one page for both apps: the logged-out header, the hero, the trust strip,
* then markets, analysts, track record, how it works, plans, for analysts and the FAQ, the closing
* call to action and the footer. The grounds alternate grey and white from the markets on, and the
* closing band shares the FAQ's. It is the same for every visitor and holds no session, so the
* apps prerender it (0026). Without three featured analysts their section and its header link are
* left out.
*/
export function LandingTemplate({
layout,
featured,
siteHost,
labels,
}: LandingTemplateProps) {
const hasFeatured = featured.length > 0;
const loginHref = loginRoute();
const registerHref = registerRoute('investor');
const headerSections = [
{ id: IDS.markets, label: labels.links.markets },
...(hasFeatured
? [{ id: IDS.featured, label: labels.links.featured }]
: []),
{ id: IDS.how, label: labels.links.how },
{ id: IDS.faq, label: labels.links.faq },
{ id: IDS.analysts, label: labels.links.analysts },
];
// From the markets on, the bands alternate grey and white whatever is left out.
const bands = [
{
id: IDS.markets,
content: (
<LandingMarkets
titleId={titleIdOf(IDS.markets)}
sampleNow={SAMPLE_NOW}
labels={labels.markets}
/>
),
},
...(hasFeatured
? [
{
id: IDS.featured,
content: (
<FeaturedAnalysts
titleId={titleIdOf(IDS.featured)}
creators={featured}
labels={labels.featured}
/>
),
},
]
: []),
{
id: IDS.record,
content: (
<LandingRecord
titleId={titleIdOf(IDS.record)}
sampleNow={SAMPLE_NOW}
labels={labels.record}
/>
),
},
{
id: IDS.how,
content: (
<LandingSteps titleId={titleIdOf(IDS.how)} labels={labels.how} />
),
},
{
id: IDS.plans,
content: (
<LandingPlans
titleId={titleIdOf(IDS.plans)}
sampleNow={SAMPLE_NOW}
labels={labels.plans}
/>
),
},
{
id: IDS.analysts,
content: (
<LandingForAnalysts
titleId={titleIdOf(IDS.analysts)}
applyHref={registerRoute('creator')}
labels={labels.analysts}
/>
),
},
{
id: IDS.faq,
content: (
<LandingFaq
titleId={titleIdOf(IDS.faq)}
supportPlacement={layout === 'desktop' ? 'popover' : 'bottom'}
labels={labels.faq}
/>
),
},
];
const footerSections = [
{ id: IDS.how, label: labels.links.how },
{ id: IDS.analysts, label: labels.links.forAnalysts },
{ id: IDS.faq, label: labels.links.faq },
];
return (
<FlexBox direction="flex-col" className="min-h-dvh bg-surface">
<LandingHeader
layout={layout}
topId={IDS.top}
sections={headerSections}
loginHref={loginHref}
labels={labels.header}
/>
<Element tag="main" className="flex-1">
<LandingSection id={IDS.top} spacing="hero">
<LandingHero
titleId={titleIdOf(IDS.top)}
registerHref={registerHref}
howHref={`#${IDS.how}`}
labels={labels.hero}
/>
</LandingSection>
<LandingTrust labels={labels.trust} />
{bands.map((band, index) => (
<LandingSection key={band.id} id={band.id} ground={groundAt(index)}>
{band.content}
</LandingSection>
))}
<LandingSection
id={IDS.join}
ground={groundAt(bands.length - 1)}
spacing="closing"
>
<LandingClosing
titleId={titleIdOf(IDS.join)}
registerHref={registerHref}
loginHref={loginHref}
labels={labels.closing}
/>
</LandingSection>
</Element>
<LandingFooter
topId={IDS.top}
sections={footerSections}
termsHref={ROUTES.terms}
siteHost={siteHost}
labels={labels.footer}
/>
</FlexBox>
);
}

View File

@ -0,0 +1,26 @@
import { Element } from '@lumina/island/primitives/element';
import type { LandingSectionProps } from '../types';
import { landingSectionVariants } from './variants';
import { titleIdOf } from '../title-id';
/** One band of the landing: its anchor, its ground, and the content column up to 1184px. */
export function LandingSection({
id,
ground,
spacing,
children,
}: LandingSectionProps) {
return (
<Element
tag="section"
id={id}
aria-labelledby={titleIdOf(id)}
className={landingSectionVariants({ ground, spacing })}
>
<Element tag="div" className="mx-auto w-full max-w-page px-4 tablet:px-8">
{children}
</Element>
</Element>
);
}

View File

@ -0,0 +1,18 @@
import { cva } from 'class-variance-authority';
/** Section links land under the sticky header: 64px, 72 on desktop. */
export const landingSectionVariants = cva('scroll-mt-16 desktop:scroll-mt-18', {
variants: {
ground: {
surface: 'bg-surface',
page: 'bg-bg-page',
},
spacing: {
hero: 'pt-7 pb-8 desktop:py-14',
section: 'py-10 tablet:py-18 desktop:py-24',
/** Right after a section on the same ground: no gap above. */
closing: 'pb-10 tablet:pb-18 desktop:pb-24',
},
},
defaultVariants: { ground: 'surface', spacing: 'section' },
});

View File

@ -0,0 +1,18 @@
/** Each section's id, its anchor (`/#faq`) and the base of its title's id. */
export const LANDING_SECTION_IDS = {
top: 'top',
markets: 'markets',
featured: 'featured',
record: 'record',
how: 'how',
plans: 'plans',
analysts: 'analysts',
faq: 'faq',
join: 'join',
} as const;
export type LandingSectionId =
(typeof LANDING_SECTION_IDS)[keyof typeof LANDING_SECTION_IDS];
/** What every sample's time left and relative time count from, so the samples never age. */
export const SAMPLE_NOW = '2026-10-02T08:00:00Z';

View File

@ -0,0 +1,4 @@
export { LANDING_SECTION_IDS } from './constants';
export { landingLabels } from './labels';
export { LandingTemplate } from './LandingTemplate';
export type { LandingLabels, LandingTemplateProps } from './types';

View File

@ -0,0 +1,162 @@
import type { TFunction } from 'i18next';
import { BILLING_PERIODS, MARKETS } from '../../../../../shared/constants';
import type { BillingPeriod, Market } from '../../../../../shared/constants';
import {
creatorStatsLabels,
postCardLabels,
predictionCardLabels,
} from '../../../../../shared/labels';
import type { ContentT } from '../../../../../shared/labels';
import type { LandingLabels } from './types';
/**
* Every text on the landing, from the server's translations (0020). Lists of facts, steps and
* questions come from the translations as they are, keyed like the organisms' constants.
*/
export function landingLabels(
t: TFunction<'landing'>,
tCommon: TFunction<'common'>,
tContent: ContentT,
): LandingLabels {
const marketNames = Object.fromEntries(
MARKETS.map((market) => [market, tCommon(`markets.${market}`)]),
) as Record<Market, string>;
const periods = Object.fromEntries(
BILLING_PERIODS.map((period) => [
period,
tCommon(`billing-periods.${period}`),
]),
) as Record<BillingPeriod, string>;
const sample = t('sample');
const verified = t('featured.card.verified');
const prediction = predictionCardLabels(tContent);
const brand = {
brand: tCommon('nav.brand'),
brandHome: tCommon('nav.brand-home'),
};
return {
header: {
...brand,
sections: t('header.sections'),
login: t('header.login'),
},
links: {
...t('header.links', { returnObjects: true }),
forAnalysts: t('footer.analysts'),
},
hero: {
kicker: t('hero.kicker'),
title: t('hero.title'),
lead: t('hero.lead'),
register: t('hero.register'),
how: t('hero.how'),
note: t('hero.note'),
imageAlt: t('hero.image-alt'),
imageCaption: t('hero.image-caption'),
},
trust: {
label: t('trust.label'),
items: t('trust.items', { returnObjects: true }),
},
markets: {
kicker: t('markets.kicker'),
title: t('markets.title'),
lead: t('markets.lead'),
tabs: t('markets.tabs'),
symbols: t('markets.symbols'),
sample,
marketNames,
panels: t('markets.panels', { returnObjects: true }),
prediction,
},
featured: {
kicker: t('featured.kicker'),
title: t('featured.title'),
lead: t('featured.lead'),
list: t('featured.list'),
previous: t('featured.previous'),
next: t('featured.next'),
note: t('featured.note'),
card: {
open: (name) => t('featured.card.open', { name }),
verified,
markets: t('featured.card.markets'),
marketNames,
winRate: t('featured.card.win-rate'),
predictions: t('featured.card.predictions'),
avgRoi: t('featured.card.avg-roi'),
view: t('featured.card.view'),
},
},
record: {
kicker: t('record.kicker'),
title: t('record.title'),
lead: t('record.lead'),
facts: t('record.facts', { returnObjects: true }),
sample,
caption: t('record.caption'),
captionWide: t('record.caption-wide'),
lossMarket: marketNames.equities,
stats: creatorStatsLabels(tContent),
prediction,
},
how: {
kicker: t('how.kicker'),
title: t('how.title'),
steps: t('how.steps', { returnObjects: true }),
},
plans: {
kicker: t('plans.kicker'),
title: t('plans.title'),
lead: t('plans.lead'),
facts: t('plans.facts', { returnObjects: true }),
sample,
samplePreview: t('plans.sample-preview'),
caption: t('plans.caption'),
post: postCardLabels(tContent),
prediction,
},
analysts: {
kicker: t('analysts.kicker'),
title: t('analysts.title'),
lead: t('analysts.lead'),
features: t('analysts.features', { returnObjects: true }),
apply: t('analysts.apply'),
applyNote: t('analysts.apply-note'),
sample,
caption: t('analysts.caption'),
channel: {
...t('analysts.sample', { returnObjects: true }),
verified,
marketNames,
periods,
},
},
faq: {
title: t('faq.title'),
items: t('faq.items', { returnObjects: true }),
more: t('faq.more'),
},
closing: {
title: t('closing.title'),
lead: t('closing.lead'),
register: t('closing.register'),
hasAccount: t('closing.has-account'),
login: t('closing.login'),
},
footer: {
...brand,
tagline: t('footer.tagline'),
product: t('footer.product'),
support: t('footer.support'),
terms: t('footer.terms'),
bale: t('footer.bale'),
telegram: t('footer.telegram'),
opensNewTab: t('footer.opens-new-tab'),
disclaimer: t('footer.disclaimer'),
copyright: t('footer.copyright'),
},
};
}

View File

@ -0,0 +1,6 @@
import type { LandingSectionId } from './constants';
/** A section's title id, for the section's `aria-labelledby`. */
export function titleIdOf(id: LandingSectionId): string {
return `${id}-title`;
}

View File

@ -0,0 +1,61 @@
import type { VariantProps } from 'class-variance-authority';
import type { ReactNode } from 'react';
import type { FeaturedCreatorPayload } from '../../../../../features/channel';
import type { FeaturedAnalystsLabels } from '../../organisms/featured-analysts';
import type { LandingClosingLabels } from '../../organisms/landing-closing';
import type { LandingFaqLabels } from '../../organisms/landing-faq';
import type { LandingFooterLabels } from '../../organisms/landing-footer';
import type { LandingForAnalystsLabels } from '../../organisms/landing-for-analysts';
import type { LandingHeaderLabels } from '../../organisms/landing-header';
import type { LandingHeroLabels } from '../../organisms/landing-hero';
import type { LandingMarketsLabels } from '../../organisms/landing-markets';
import type { LandingPlansLabels } from '../../organisms/landing-plans';
import type { LandingRecordLabels } from '../../organisms/landing-record';
import type { LandingStepsLabels } from '../../organisms/landing-steps';
import type { LandingTrustLabels } from '../../organisms/landing-trust';
import type { landingSectionVariants } from './components/variants';
import type { LandingSectionId } from './constants';
/** Every text on the landing, built once on the server from the app's translations. */
export type LandingLabels = {
header: LandingHeaderLabels;
/** The section links' names, in the header and the footer. */
links: {
markets: string;
featured: string;
how: string;
faq: string;
analysts: string;
/** The footer's name for the analysts' section: «برای تحلیلگران». */
forAnalysts: string;
};
hero: LandingHeroLabels;
trust: LandingTrustLabels;
markets: LandingMarketsLabels;
featured: FeaturedAnalystsLabels;
record: LandingRecordLabels;
how: LandingStepsLabels;
plans: LandingPlansLabels;
analysts: LandingForAnalystsLabels;
faq: LandingFaqLabels;
closing: LandingClosingLabels;
footer: LandingFooterLabels;
};
export type LandingTemplateProps = {
/** mobile: bull (to 1023px, with its 720px tablet step). desktop: bear. */
layout: 'mobile' | 'desktop';
/** Three or more analysts, or none: the section and its header link are hidden. */
featured: FeaturedCreatorPayload[];
/** The site's address without the scheme, for the footer: «lumina.ir». */
siteHost: string;
labels: LandingLabels;
};
export type LandingSectionProps = VariantProps<
typeof landingSectionVariants
> & {
id: LandingSectionId;
children: ReactNode;
};

View File

@ -5,7 +5,7 @@ import { useEffect } from 'react';
import { useCurrentAccount, useNeedsProfile } from '../../../../../stores/auth';
import { AuthGuard } from '../../../../guards/auth-guard';
import { ROUTES } from '../../../../navigation/navigation';
import { homeRoute } from '../../../../navigation/navigation';
import type { HomeGuardProps } from './types';
/**
@ -20,9 +20,11 @@ export function HomeGuard({ fallback, children }: HomeGuardProps) {
const router = useRouter();
const creatorHome =
account?.role === 'creator'
? needsProfile
? ROUTES.onboarding.creatorProfile
: ROUTES.channel(account.username)
? homeRoute({
role: account.role,
username: account.username,
needsProfile,
})
: null;
useEffect(() => {

View File

@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
import { getEnv } from '../../../../env';
import { ROUTES } from '../../../navigation/navigation';
import { SUPPORT_CHAT_URLS } from './constants';
import { supportChatUrls } from './support-chats';
import type { SupportEntryProps } from './types';
/**
@ -23,7 +23,8 @@ export function SupportEntry({
}: SupportEntryProps) {
const { t } = useTranslation('auth');
const [isOpen, setIsOpen] = useState(false);
const { baleHandle, telegramHandle, supportHours } = getEnv();
const { supportHours } = getEnv();
const chats = supportChatUrls();
const toggle = () => setIsOpen((open) => !open);
const dialogProps = {
'aria-haspopup': 'dialog',
@ -60,8 +61,8 @@ export function SupportEntry({
placement={placement}
open={isOpen}
onClose={() => setIsOpen(false)}
baleHref={SUPPORT_CHAT_URLS.bale(baleHandle)}
telegramHref={SUPPORT_CHAT_URLS.telegram(telegramHandle)}
baleHref={chats.bale}
telegramHref={chats.telegram}
termsHref={ROUTES.terms}
labels={{
title: t('support.title'),

View File

@ -1,2 +1,3 @@
export { supportChatUrls } from './support-chats';
export { SupportEntry } from './SupportEntry';
export type { SupportEntryProps } from './types';
export type { SupportChats, SupportEntryProps } from './types';

View File

@ -0,0 +1,12 @@
import { getEnv } from '../../../../env';
import { SUPPORT_CHAT_URLS } from './constants';
import type { SupportChats } from './types';
/** The support chats' addresses, from the handles in config. Reads env inside the call. */
export function supportChatUrls(): SupportChats {
const { baleHandle, telegramHandle } = getEnv();
return {
bale: SUPPORT_CHAT_URLS.bale(baleHandle),
telegram: SUPPORT_CHAT_URLS.telegram(telegramHandle),
};
}

View File

@ -11,3 +11,6 @@ export type SupportEntryProps = {
/** The button trigger's size: `lg` on mobile, `md` on desktop. */
size?: 'md' | 'lg';
};
/** The support chats' addresses. */
export type SupportChats = { bale: string; telegram: string };

View File

@ -0,0 +1,38 @@
import 'server-only';
import type { Metadata } from 'next';
import { ROUTES } from '../navigation/navigation';
import type { FaqJsonLdItem, LandingMetadataArgs } from './types';
/**
* The landing's metadata: its own full title (the brand is already in it, so no « · لومینا»), the
* hero's lead as the description, and `/` as the canonical address.
*/
export function landingMetadata({
title,
description,
}: LandingMetadataArgs): Metadata {
return {
title: { absolute: title },
description,
alternates: { canonical: ROUTES.landing },
openGraph: { type: 'website', title, description, url: ROUTES.landing },
};
}
/**
* The FAQ as FAQPage structured data, from the same questions the page shows, ready for a
* `<script type="application/ld+json">`: `<` is escaped so no text can close the tag.
*/
export function faqJsonLd(items: FaqJsonLdItem[]): string {
return JSON.stringify({
'@context': 'https://schema.org',
'@type': 'FAQPage',
mainEntity: items.map(({ question, answer }) => ({
'@type': 'Question',
name: question,
acceptedAnswer: { '@type': 'Answer', text: answer },
})),
}).replace(/</g, '\\u003c');
}

View File

@ -1,4 +1,10 @@
import 'server-only';
export { faqJsonLd, landingMetadata } from './landing';
export { channelMetadata, postMetadata } from './metadata';
export type { ChannelMetadataArgs, PostMetadataArgs } from './types';
export type {
ChannelMetadataArgs,
FaqJsonLdItem,
LandingMetadataArgs,
PostMetadataArgs,
} from './types';

View File

@ -15,3 +15,11 @@ export type PostMetadataArgs = {
/** When the post has no text to name it: «پست @sara_gold». */
fallbackTitle: string;
};
export type LandingMetadataArgs = {
/** The whole title, brand included: «لومینا — …». */
title: string;
description: string;
};
export type FaqJsonLdItem = { question: string; answer: string };

View File

@ -4,10 +4,15 @@ import type {
AccountTypeFormOutput,
AccountTypeFormValues,
} from '../../../../shared/validations';
import type { UserRole } from '../../entities/user';
export type UseRegisterTypePageOptions = {
/** This step without `?role=`, keeping `?redirect=`. */
typeHref: string;
/** Step 2, keeping `?redirect=`. */
phoneHref: string;
/** The type the link chose (`?role=` from the landing); the person can still change it. */
initialRole?: UserRole | null;
};
export type RegisterTypePageModel = {

View File

@ -1,6 +1,6 @@
import { valibotResolver } from '@hookform/resolvers/valibot';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import { accountTypeSchema } from '../../../../shared/validations';
@ -15,15 +15,26 @@ import type {
} from './types';
/**
* Registration step 1: the account type. Nothing is pre-selected and «ادامه» is never disabled:
* pressed with no choice, it says so. The choice travels in the flow store to step 2.
* Registration step 1: the account type. Nothing is pre-selected unless the link chose a type, and
* «ادامه» is never disabled: pressed with no choice, it says so. The choice travels in the flow
* store to step 2.
*/
export function useRegisterTypePage({
typeHref,
phoneHref,
initialRole,
}: UseRegisterTypePageOptions): RegisterTypePageModel {
const router = useRouter();
// Back from step 2: the choice is still made.
const [role] = useState(() => useAuthFlowStore.getState().role ?? '');
// The link's choice wins over an earlier one; back from step 2, the choice is still made.
const [role] = useState(
() => initialRole ?? useAuthFlowStore.getState().role ?? '',
);
// The link's choice is used once: the address drops `?role=`, so coming back to this step later
// shows what the person chose, not what the link chose.
useEffect(() => {
if (initialRole) router.replace(typeHref);
}, [initialRole, typeHref, router]);
const form = useForm<AccountTypeFormValues, unknown, AccountTypeFormOutput>({
resolver: valibotResolver(accountTypeSchema),
defaultValues: { role },

View File

@ -0,0 +1,11 @@
import 'server-only';
import { cache } from 'react';
import { channelRepository } from '../repositories/channel';
import type { FeaturedCreatorPayload } from '../repositories/channel';
/** The landing's analysts, once per render. Errors reach the caller. */
export const getFeaturedCreators = cache(
(): Promise<FeaturedCreatorPayload[]> => channelRepository.listFeatured(),
);

View File

@ -1,5 +1,6 @@
import 'server-only';
export { getChannel } from './channel';
export { getFeaturedCreators } from './featured-creators';
export { getPublicCreator } from './public-creator';
export { getPublicTiers } from './public-tiers';

View File

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

View File

@ -0,0 +1,21 @@
import type { Market } from '../../../../shared/constants';
/**
* One analyst the landing features: an admin marked them featured and their track record is
* public (past the activation threshold, not hidden by them). The API sends at most 10, in the
* admin's order. Never carries follower or subscriber counts, or prices.
*/
export type FeaturedCreatorEntity = {
username: string;
displayName?: string | null;
avatarUrl?: string | null;
verified?: boolean;
markets?: Market[];
bio?: string | null;
stats: {
/** Already a percentage: `62.86`. */
winRate: number;
totalPredictions: number;
avgRoiPercent: number;
};
};

View File

@ -32,6 +32,7 @@ export { channelKeys, channelRepository } from './repositories/channel';
export type {
ChannelArgs,
ChannelByUsernameArgs,
FeaturedCreatorPayload,
PublicCreatorPayload,
PublicTierPayload,
TierPromotionPayload,

View File

@ -0,0 +1,2 @@
/** Fewer featured analysts than this hide the landing's analysts section and its header link. */
export const FEATURED_MIN_COUNT = 3;

View File

@ -0,0 +1,29 @@
import 'server-only';
import { classifyError, handleError } from '@lumina/libs/error-handler';
import { getFeaturedCreators } from '../../caches/featured-creators';
import { FEATURED_MIN_COUNT } from './constants';
import type { LandingPagePayload, LoadLandingPageOptions } from './types';
/**
* The landing's only live data, its featured analysts; fewer than three hide their section, and so
* do 404 and 403, silently (404 while the endpoint isn't in the API yet). The landing is
* prerendered and revalidated (0026): any other failure hides the section at build time, so the
* build never depends on the API (a 5xx is still reported), and throws otherwise, so a
* revalidation keeps serving the last good page.
*/
export async function loadLandingPage({
hideOnError,
}: LoadLandingPageOptions): Promise<LandingPagePayload> {
try {
const featured = await getFeaturedCreators();
return { featured: featured.length >= FEATURED_MIN_COUNT ? featured : [] };
} catch (error) {
const { read } = classifyError(error);
if (read === 'not-found' || read === 'no-access') return { featured: [] };
if (!hideOnError) throw error;
handleError(error, { where: 'part', name: 'featured-analysts' });
return { featured: [] };
}
}

View File

@ -0,0 +1,4 @@
import 'server-only';
export { loadLandingPage } from './load-landing-page';
export type { LandingPagePayload, LoadLandingPageOptions } from './types';

View File

@ -0,0 +1,11 @@
import type { FeaturedCreatorPayload } from '../../repositories/channel';
export type LandingPagePayload = {
/** Empty when the section is hidden: too few analysts, or the read failed. */
featured: FeaturedCreatorPayload[];
};
export type LoadLandingPageOptions = {
/** true while `next build` prerenders the page, when no read may fail it. */
hideOnError: boolean;
};

View File

@ -1,9 +1,15 @@
import { channelHttp } from '../../http';
import { CHANNEL_ENDPOINTS } from './constants';
import { toPublicCreatorPayload, toPublicTiersPayload } from './mappers';
import {
toFeaturedCreatorsPayload,
toPublicCreatorPayload,
toPublicTiersPayload,
} from './mappers';
import type {
ChannelArgs,
ChannelByUsernameArgs,
FeaturedCreatorPayload,
FeaturedCreatorsResponseDto,
PublicCreatorPayload,
PublicCreatorResponseDto,
PublicTierPayload,
@ -47,4 +53,15 @@ export const channelRepository = {
);
return toPublicTiersPayload(response);
},
/** The analysts the landing features, in the admin's order; at most 10. */
async listFeatured({ signal }: { signal?: AbortSignal } = {}): Promise<
FeaturedCreatorPayload[]
> {
const response = await channelHttp.get<FeaturedCreatorsResponseDto>(
CHANNEL_ENDPOINTS.featured,
{ signal },
);
return toFeaturedCreatorsPayload(response);
},
};

View File

@ -4,6 +4,8 @@ export const CHANNEL_ENDPOINTS = {
`/traders/by-username/${encodeURIComponent(username)}`,
tiers: (creatorId: string) =>
`/subscriptions/creators/${encodeURIComponent(creatorId)}/tiers`,
/** The landing's analysts; not in the API yet, so it answers 404 and the section stays hidden. */
featured: '/creators/featured',
} as const;
/** Keyed by the creator's account id, so invalidating `creator(id)` refreshes the whole channel. */

View File

@ -3,6 +3,7 @@ export { channelKeys } from './constants';
export type {
ChannelArgs,
ChannelByUsernameArgs,
FeaturedCreatorPayload,
PublicCreatorPayload,
PublicTierPayload,
TierPromotionPayload,

View File

@ -1,6 +1,8 @@
import { toApiUrl } from '../../../../shared/utils';
import type { PublicTierEntity } from '../../entities/public-tier';
import type {
FeaturedCreatorPayload,
FeaturedCreatorsResponseDto,
PublicCreatorPayload,
PublicCreatorResponseDto,
PublicTierPayload,
@ -53,3 +55,21 @@ export function toPublicTiersPayload(
): PublicTierPayload[] {
return dto.items.map(toPublicTierPayload);
}
export function toFeaturedCreatorsPayload(
dto: FeaturedCreatorsResponseDto,
): FeaturedCreatorPayload[] {
return dto.items.map((item) => ({
username: item.username,
displayName: item.displayName || null,
avatarUrl: toApiUrl(item.avatarUrl),
verified: item.verified ?? false,
markets: item.markets ?? [],
bio: item.bio || null,
stats: {
winRate: item.stats.winRate,
totalPredictions: item.stats.totalPredictions,
avgRoiPercent: item.stats.avgRoiPercent,
},
}));
}

View File

@ -4,6 +4,7 @@ import type {
Market,
} from '../../../../shared/constants';
import type { SocialLinkPayload, TradingStyle } from '../../../profile';
import type { FeaturedCreatorEntity } from '../../entities/featured-creator';
import type { PublicCreatorEntity } from '../../entities/public-creator';
import type { PublicTierEntity } from '../../entities/public-tier';
@ -64,3 +65,17 @@ export type PublicTierPayload = {
};
export type PublicTiersResponseDto = { items: PublicTierEntity[] };
/** An analyst on the landing, as its card shows them. */
export type FeaturedCreatorPayload = {
username: string;
displayName: string | null;
avatarUrl: string | null;
verified: boolean;
markets: Market[];
bio: string | null;
/** The public track record's headline numbers; the rate and ROI are percentages. */
stats: { winRate: number; totalPredictions: number; avgRoiPercent: number };
};
export type FeaturedCreatorsResponseDto = { items: FeaturedCreatorEntity[] };

View File

@ -3,14 +3,31 @@ import 'server-only';
// Public server-only API, exposed as the `/server` subpath. index.ts never imports this file.
// Server reads carry no session: only what is the same for every visitor is read here.
export { readOnServer } from './app/error-boundaries/server';
export { channelMetadata, postMetadata } from './app/seo/server';
export type { ChannelMetadataArgs, PostMetadataArgs } from './app/seo/server';
export {
channelMetadata,
faqJsonLd,
landingMetadata,
postMetadata,
} from './app/seo/server';
export type {
ChannelMetadataArgs,
FaqJsonLdItem,
LandingMetadataArgs,
PostMetadataArgs,
} from './app/seo/server';
export type { ServerRead } from './app/error-boundaries/server';
export {
getChannel,
getFeaturedCreators,
getPublicCreator,
getPublicTiers,
} from './features/channel/caches/server';
export { loadLandingPage } from './features/channel/models/landing/server';
export type {
LandingPagePayload,
LoadLandingPageOptions,
} from './features/channel/models/landing/server';
export { getCreatorPosts, getPost } from './features/post/caches/server';
export { getPredictionStats } from './features/prediction/caches/server';
export { SERVER_RESOURCES } from './shared/locales/server-resources';
export { getRequestTime } from './shared/utils/request-time';

View File

@ -0,0 +1,259 @@
{
"meta": {
"title": "لومینا — تحلیلگران بازار با کارنامه‌ی شفاف"
},
"loading": "در حال بارگذاری صفحه‌ی اصلی لومینا…",
"header": {
"sections": "بخش‌های صفحه",
"links": {
"markets": "بازارها",
"featured": "تحلیلگران",
"how": "چطور کار می‌کند",
"faq": "سؤالات متداول",
"analysts": "تحلیلگر هستید؟"
},
"login": "ورود/ثبت‌نام"
},
"sample": "نمونه",
"hero": {
"kicker": "تحلیلگران احرازشده، پیش‌بینی‌های ثبت‌شده",
"title": "تحلیل بازار، با کارنامه‌ای که پاک نمی‌شود",
"lead": "در لومینا تحلیلگران طلا، فارکس، کریپتو و بورس پیش‌بینی‌هایشان را با قیمت ورود، هدف و افق زمانی ثبت می‌کنند و نتیجه‌ی هر پیش‌بینی در کارنامه‌شان می‌ماند. پیش از اشتراک، کارنامه را ببینید.",
"register": "ثبت‌نام رایگان",
"how": "چطور کار می‌کند",
"note": "ثبت‌نام با شماره موبایل. دنبال کردن تحلیلگران رایگان است.",
"image-alt": "کانال یک تحلیلگر در لومینا: کارنامه‌ی پیش‌بینی‌ها و یک پیش‌بینی موفق طلا که ثبت‌شده و غیرقابل ویرایش است.",
"image-caption": "تصویر نمونه از لومینا؛ نام و عددها ساختگی است."
},
"trust": {
"label": "چرا به لومینا اعتماد کنید",
"items": {
"verified": {
"title": "تحلیلگران احرازشده",
"description": "هویت هر تحلیلگر بررسی می‌شود"
},
"immutable": {
"title": "پیش‌بینی ثبت‌شده",
"description": "بدون ویرایش و حذف"
},
"gateway": {
"title": "پرداخت با درگاه بانکی",
"description": "کارت‌های عضو شتاب"
},
"support": {
"title": "پشتیبانی",
"description": "در بله و تلگرام"
}
}
},
"markets": {
"kicker": "بازارها",
"title": "بازار شما، تحلیلگر شما",
"lead": "تحلیلگران لومینا در چند بازار فعال‌اند و هر پیش‌بینی بازار و نماد مشخصی دارد.",
"tabs": "بازارها",
"symbols": "نمونه‌ی نمادها",
"panels": {
"gold": {
"description": "پیش‌بینی برای انس جهانی، طلای ۱۸ عیار و سکه؛ هر کدام با قیمت ورود، هدف، حد ضرر و افق زمانی.",
"symbols": ["XAUUSD", "طلای ۱۸ عیار", "سکه امامی"],
"caption": "نمونه‌ی یک پیش‌بینی موفق طلا؛ داده‌ها ساختگی است."
},
"forex": {
"description": "جفت‌ارزهای اصلی بازار جهانی؛ هر پیش‌بینی جهت خرید یا فروش و سطح‌های قیمتی مشخص دارد.",
"symbols": ["EURUSD", "GBPUSD", "USDJPY"],
"caption": "نمونه‌ی یک پیش‌بینی سربه‌سر فارکس؛ داده‌ها ساختگی است."
},
"crypto": {
"description": "بیت‌کوین، اتریوم و رمزارزهای پرمعامله؛ در پیش‌بینی‌های باز، فاصله تا هدف و تا حد ضرر همیشه پیداست.",
"symbols": ["BTCUSDT", "ETHUSDT", "SOLUSDT"],
"caption": "نمونه‌ی یک پیش‌بینی باز کریپتو؛ داده‌ها ساختگی است."
},
"equities": {
"description": "شاخص کل و سهم‌های بورس تهران؛ نتیجه‌ی هر پیش‌بینی، سود یا زیان، در کارنامه می‌ماند.",
"symbols": ["شاخص کل", "فولاد", "شستا"],
"caption": "نمونه‌ی یک پیش‌بینی موفق بورس؛ داده‌ها ساختگی است."
}
}
},
"featured": {
"kicker": "تحلیلگران",
"title": "تحلیلگرانی که کارنامه‌شان پیداست",
"lead": "کارنامه را ببینید، کانال را رایگان دنبال کنید و هر وقت قانع شدید، مشترک شوید.",
"list": "تحلیلگران",
"previous": "تحلیلگران قبلی",
"next": "تحلیلگران بعدی",
"note": "تحلیلگران این بخش را تیم لومینا انتخاب می‌کند و هویت همه‌شان احراز شده است. عملکرد گذشته تضمینی برای نتیجه‌های آینده نیست.",
"card": {
"open": "کانال {{name}}",
"verified": "تأییدشده",
"markets": "بازارهای تخصصی",
"win-rate": "نرخ موفقیت",
"predictions": "پیش‌بینی",
"avg-roi": "میانگین بازده",
"view": "مشاهده کانال"
}
},
"record": {
"kicker": "کارنامه",
"title": "کارنامه‌ای که می‌شود بررسی کرد",
"lead": "درصد موفقیت، میانگین بازده و روند دقت هر تحلیلگر از پیش‌بینی‌های ثبت‌شده‌اش حساب می‌شود؛ ناموفق‌ها هم.",
"facts": {
"immutable": {
"title": "غیرقابل ویرایش و حذف",
"description": "هر پیش‌بینی با زمان ثبتش منتشر می‌شود و پس از انتشار قابل ویرایش یا حذف نیست."
},
"outcome": {
"title": "نتیجه از روی بازده",
"description": "بازده از قیمت ورود تا قیمت بسته‌شدن حساب می‌شود: مثبت موفق، صفر سربه‌سر و منفی ناموفق."
},
"public": {
"title": "نتیجه برای همه پیداست",
"description": "نتیجه‌ی پیش‌بینی‌های ویژه هم برای همه دیده می‌شود؛ فقط جزئیاتشان مخصوص مشترکان است."
},
"threshold": {
"title": "کارنامه‌ی معنادار",
"description": "کارنامه پس از یک ماه فعالیت و ثبت تعداد کافی پیش‌بینی بسته‌شده نمایش داده می‌شود تا عددهایش معنادار باشند."
}
},
"caption": "نمونه‌ی کارنامه‌ی یک تحلیلگر، با داده‌های ساختگی.",
"caption-wide": "نمونه‌ی کارنامه‌ی یک تحلیلگر و یکی از پیش‌بینی‌های ناموفقش، با داده‌های ساختگی."
},
"how": {
"kicker": "چطور کار می‌کند",
"title": "از ثبت‌نام تا تحلیل‌های ویژه، در سه قدم",
"steps": {
"register": {
"title": "ثبت‌نام کنید",
"description": "با شماره موبایل و کد تأییدی که پیامک می‌شود. ثبت‌نام و دنبال کردن تحلیلگران رایگان است."
},
"judge": {
"title": "تحلیلگران را بسنجید",
"description": "کانال تحلیلگران را ببینید، رایگان دنبالشان کنید و کارنامه‌ی پیش‌بینی‌هایشان را بررسی کنید."
},
"subscribe": {
"title": "مشترک شوید",
"description": "برای پست‌ها و پیش‌بینی‌های ویژه، دوره‌ای از ماهانه تا سالانه را انتخاب کنید و با درگاه بانکی بپردازید. دسترسی بلافاصله باز می‌شود."
}
}
},
"plans": {
"kicker": "اشتراک",
"title": "رایگان دنبال کنید؛ برای تحلیل‌های ویژه مشترک شوید",
"lead": "پست‌های رایگان هر تحلیلگر برای همه باز است. پست‌ها و پیش‌بینی‌های ویژه مخصوص مشترکان کانال اوست.",
"facts": {
"periods": {
"title": "دوره‌های اشتراک",
"description": "دوره‌ها ماهانه، سه‌ماهه، شش‌ماهه و سالانه است و قیمت هر دوره را خود تحلیلگر تعیین می‌کند."
},
"access": {
"title": "دسترسی فوری",
"description": "پرداخت با درگاه بانکی انجام می‌شود و دسترسی بلافاصله پس از تأیید پرداخت باز می‌شود."
},
"reminder": {
"title": "یادآوری پیش از پایان",
"description": "سه روز پیش از پایان اشتراک با اعلان و پیامک یادآوری می‌کنیم."
},
"renewal": {
"title": "تمدید و رسید",
"description": "تمدید و فعال‌سازی دوباره از داشبورد › اشتراک‌ها؛ رسید هر پرداخت در تراکنش‌ها می‌ماند."
}
},
"sample-preview": "تحلیل هفتگی طلا: سطح‌های حمایت و مقاومت مهم و سناریوی معاملاتی هفته‌ی پیش رو.",
"caption": "نمونه‌ی پست ویژه، آن‌طور که پیش از اشتراک دیده می‌شود."
},
"analysts": {
"kicker": "برای تحلیلگران",
"title": "کانال حرفه‌ای خودتان را بسازید",
"lead": "لومینا جای تلگرام یا اینستاگرامتان را نمی‌گیرد؛ لایه‌ی حرفه‌ای کنار آن‌هاست: پروفایل احرازشده، کارنامه‌ی قابل استناد و درآمد از اشتراک.",
"features": {
"profile": {
"title": "پروفایل احرازشده",
"description": "نام کاربری، معرفی، بازارهای تخصصی و شبکه‌های اجتماعی‌تان، با نشان تأییدشده پس از احراز هویت."
},
"income": {
"title": "درآمد از اشتراک",
"description": "قیمت هر دوره را خودتان تعیین می‌کنید و درآمد به شماره شبای خودتان تسویه می‌شود."
},
"record": {
"title": "کارنامه‌ای که با شما می‌ماند",
"description": "هر پیش‌بینی ثبت‌شده به کارنامه‌تان اضافه می‌شود؛ اعتباری که با بسته شدن یک کانال در پیام‌رسان‌ها از بین نمی‌رود."
},
"dashboard": {
"title": "داشبورد کسب‌وکار",
"description": "مشترکان فعال، درآمد، تراکنش‌ها و خلاصه‌ی عملکرد پیش‌بینی‌ها در یک نگاه."
}
},
"apply": "درخواست عضویت تحلیلگر",
"apply-note": "حساب تحلیلگر پس از احراز هویت و تأیید تیم لومینا فعال می‌شود.",
"sample": {
"name": "سارا مرادی",
"bio": "تحلیل تکنیکال طلا و ارز، با پیش‌بینی‌های هفتگی.",
"prices": "قیمت طرح‌ها",
"currency": "تومان"
},
"caption": "نمونه‌ی کانال یک تحلیلگر با قیمت‌هایی که خودش تعیین کرده است."
},
"faq": {
"title": "سؤالات متداول",
"items": {
"follow-cost": {
"question": "دنبال کردن تحلیلگران هزینه دارد؟",
"answer": "نه. دنبال کردن رایگان است و پست‌های رایگان هر تحلیلگر را می‌بینید. برای پست‌ها و پیش‌بینی‌های ویژه باید در کانال او مشترک شوید."
},
"outcome": {
"question": "نتیجه‌ی پیش‌بینی‌ها چطور مشخص می‌شود؟",
"answer": "هر پیش‌بینی با دارایی، جهت، قیمت ورود، هدف و افق زمانی ثبت می‌شود. وقتی بسته می‌شود، بازده آن از قیمت ورود تا قیمت بسته‌شدن حساب می‌شود: مثبت یعنی موفق، صفر یعنی سربه‌سر و منفی یعنی ناموفق. این نتیجه نهایی است و در کارنامه می‌ماند."
},
"delete-loss": {
"question": "تحلیلگر می‌تواند پیش‌بینی ناموفق را پاک کند؟",
"answer": "نه. پیش‌بینی پس از انتشار نه ویرایش می‌شود و نه حذف، و نتیجه‌ی بسته‌شدنش هم نهایی است."
},
"hidden-record": {
"question": "چرا کارنامه‌ی بعضی تحلیلگران را نمی‌بینم؟",
"answer": "کارنامه پس از یک ماه فعالیت و ثبت تعداد کافی پیش‌بینی بسته‌شده نمایش داده می‌شود تا عددهایش معنادار باشند. تحلیلگر هم می‌تواند نمایش کارنامه‌اش را خاموش کند."
},
"payment": {
"question": "پرداخت چطور انجام می‌شود؟",
"answer": "با درگاه بانکی و کارت‌های عضو شتاب. دسترسی بلافاصله پس از تأیید پرداخت باز می‌شود و رسید آن در داشبورد › تراکنش‌ها می‌ماند."
},
"expiry": {
"question": "وقتی اشتراکم تمام شود چه می‌شود؟",
"answer": "سه روز پیش از پایان با اعلان و پیامک یادآوری می‌کنیم. اگر تمدید نکنید، دسترسی به محتوای ویژه بسته می‌شود و هر وقت بخواهید می‌توانید از داشبورد › اشتراک‌ها دوباره فعالش کنید."
},
"suspension": {
"question": "اگر کانال تحلیلگری معلق شود چه می‌شود؟",
"answer": "دسترسی به کانال موقتاً متوقف می‌شود. اگر کانال پیش از پایان اشتراک شما دوباره فعال شود، مدت توقف به اشتراکتان اضافه می‌شود؛ یا می‌توانید برای بازگشت وجه مدت استفاده‌نشده با پشتیبانی تماس بگیرید."
},
"advice": {
"question": "آیا تحلیل‌ها توصیه‌ی سرمایه‌گذاری است؟",
"answer": "نه. محتوای هر کانال نظر همان تحلیلگر است و لومینا مشاوره‌ی سرمایه‌گذاری نمی‌دهد. کارنامه‌ی گذشته تضمینی برای نتیجه‌های آینده نیست و تصمیم سرمایه‌گذاری با خود شماست."
},
"become-analyst": {
"question": "چطور تحلیلگر لومینا شوم؟",
"answer": "در ثبت‌نام «تحلیلگر» را انتخاب کنید و اطلاعات هویتی‌تان را بفرستید. تیم لومینا درخواست را بررسی می‌کند و نتیجه را با اعلان به شما خبر می‌دهد."
}
},
"more": "پاسخ سؤالتان را پیدا نکردید؟"
},
"closing": {
"title": "پیش از اشتراک، کارنامه را ببینید",
"lead": "ثبت‌نام رایگان است و فقط یک شماره موبایل می‌خواهد.",
"register": "ثبت‌نام رایگان",
"has-account": "حساب کاربری دارید؟",
"login": "ورود"
},
"footer": {
"tagline": "تحلیلگران بازار، با کارنامه‌ی شفاف.",
"product": "لومینا",
"how": "چطور کار می‌کند",
"analysts": "برای تحلیلگران",
"faq": "سؤالات متداول",
"support": "پشتیبانی",
"terms": "قوانین و مقررات",
"bale": "بله",
"telegram": "تلگرام",
"opens-new-tab": "در زبانه‌ی جدید باز می‌شود",
"disclaimer": "محتوای منتشرشده در لومینا نظر تحلیلگران است و توصیه‌ی سرمایه‌گذاری نیست. عملکرد گذشته تضمینی برای نتیجه‌های آینده نیست.",
"copyright": "© ۱۴۰۵ لومینا"
}
}

View File

@ -6,7 +6,10 @@ import faDashboard from './fa/dashboard.json';
import faErrors from './fa/errors.json';
import faHome from './fa/home.json';
/** The product is Persian only; every route loads every namespace, because any route can fail. */
/**
* The product is Persian only; every route loads every namespace here, because any route can fail.
* Namespaces only server components read live in `server-resources.ts` instead.
*/
export const DEFAULT_LOCALE = 'fa';
export const DEFAULT_NAMESPACE = 'common';

View File

@ -0,0 +1,13 @@
import 'server-only';
import faLanding from './fa/landing.json';
/**
* Namespaces that only server components read: the prerendered landing. They stay out of every
* client bundle; each app's server bootstrap adds them to its i18n instance.
*/
export const SERVER_RESOURCES = {
fa: {
landing: faLanding,
},
} as const;

View File

@ -1,9 +1,10 @@
import type { DEFAULT_NAMESPACE, resources } from './resources';
import type { SERVER_RESOURCES } from './server-resources';
// Types every `t` call against the Persian resources, so a missing key fails type-check.
declare module 'i18next' {
interface CustomTypeOptions {
defaultNS: typeof DEFAULT_NAMESPACE;
resources: (typeof resources)['fa'];
resources: (typeof resources)['fa'] & (typeof SERVER_RESOURCES)['fa'];
}
}

View File

@ -12,6 +12,7 @@ export {
postComposerSchema,
} from './content-validations';
export {
ACCOUNT_TYPES,
AVATAR_IMAGE,
ID_CARD_IMAGE,
PROFILE_LIMITS,