diff --git a/platforms/market/src/app/guards/landing-redirect/LandingRedirect.tsx b/platforms/market/src/app/guards/landing-redirect/LandingRedirect.tsx new file mode 100644 index 0000000..8c76090 --- /dev/null +++ b/platforms/market/src/app/guards/landing-redirect/LandingRedirect.tsx @@ -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; +} diff --git a/platforms/market/src/app/guards/landing-redirect/index.ts b/platforms/market/src/app/guards/landing-redirect/index.ts new file mode 100644 index 0000000..27bfca7 --- /dev/null +++ b/platforms/market/src/app/guards/landing-redirect/index.ts @@ -0,0 +1 @@ +export { LandingRedirect } from './LandingRedirect'; diff --git a/platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx b/platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx index 5eee537..2704665 100644 --- a/platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx +++ b/platforms/market/src/app/navigation/components/desktop-header/DesktopHeader.tsx @@ -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 ( )} {status !== 'guest' && isTab && title && ( diff --git a/platforms/market/src/app/navigation/components/mobile-top-bar/components/BackButton.tsx b/platforms/market/src/app/navigation/components/mobile-top-bar/components/BackButton.tsx index ad55588..e97284a 100644 --- a/platforms/market/src/app/navigation/components/mobile-top-bar/components/BackButton.tsx +++ b/platforms/market/src/app/navigation/components/mobile-top-bar/components/BackButton.tsx @@ -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 ( + + + {labels.hasAccount}{' '} + + {labels.login} + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-closing/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-closing/index.ts new file mode 100644 index 0000000..f38ab56 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-closing/index.ts @@ -0,0 +1,2 @@ +export { LandingClosing } from './LandingClosing'; +export type { LandingClosingLabels, LandingClosingProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-closing/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-closing/types.ts new file mode 100644 index 0000000..be057c3 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-closing/types.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-faq/LandingFaq.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/LandingFaq.tsx new file mode 100644 index 0000000..a7133a4 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/LandingFaq.tsx @@ -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 ( + + + + {FAQ_ITEMS.map((key, index) => ( + + + + {labels.items[key].question} + + + + + {labels.items[key].answer} + + + ))} + + + + {labels.more} + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-faq/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/constants.ts new file mode 100644 index 0000000..6edea70 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/constants.ts @@ -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]; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-faq/faq-entries.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/faq-entries.ts new file mode 100644 index 0000000..4210e64 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/faq-entries.ts @@ -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]); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-faq/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/index.ts new file mode 100644 index 0000000..f70dd65 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/index.ts @@ -0,0 +1,3 @@ +export { faqEntries } from './faq-entries'; +export { LandingFaq } from './LandingFaq'; +export type { LandingFaqLabels, LandingFaqProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-faq/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/types.ts new file mode 100644 index 0000000..3370b3d --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-faq/types.ts @@ -0,0 +1,15 @@ +import type { FaqItemKey } from './constants'; + +export type LandingFaqLabels = { + title: string; + items: Record; + /** 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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-footer/LandingFooter.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/LandingFooter.tsx new file mode 100644 index 0000000..2dc7cbc --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/LandingFooter.tsx @@ -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 ( + + + + + + {labels.brand} + + + {labels.tagline} + + + + + {labels.product} + + {sections.map((section) => ( + + {section.label} + + ))} + + + + {labels.support} + + {labels.terms} + + {labels.bale} + + + {labels.telegram} + + + + + + {labels.disclaimer} + + + {labels.copyright} + {' · '} + + {siteHost} + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-footer/components/FooterLink.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/components/FooterLink.tsx new file mode 100644 index 0000000..e50e485 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/components/FooterLink.tsx @@ -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 && } + + {children} + + {opensNewTab && ( + + {opensNewTab} + + )} + + ); + + if (href.startsWith('/')) { + return ( + + {content} + + ); + } + return ( + + {content} + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-footer/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/index.ts new file mode 100644 index 0000000..65e21c0 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/index.ts @@ -0,0 +1,2 @@ +export { LandingFooter } from './LandingFooter'; +export type { LandingFooterLabels, LandingFooterProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-footer/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/types.ts new file mode 100644 index 0000000..9b8482b --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-footer/types.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/LandingForAnalysts.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/LandingForAnalysts.tsx new file mode 100644 index 0000000..e0905d1 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/LandingForAnalysts.tsx @@ -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 ( + + + + + {ANALYST_FEATURES.map(({ key, icon }) => ( + + + + + + + {labels.features[key].title} + + + {labels.features[key].description} + + + + ))} + + + + + {labels.applyNote} + + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/components/ChannelSample.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/components/ChannelSample.tsx new file mode 100644 index 0000000..cadf8bd --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/components/ChannelSample.tsx @@ -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 ( + + + + + + + + {labels.name} + + + + + + @{SAMPLE_CHANNEL.username} + + + + + {labels.bio} + + {SAMPLE_CHANNEL.markets.map((market) => ( + {labels.marketNames[market]} + ))} + + + + {labels.prices} + + {SAMPLE_CHANNEL.prices.map(({ period, toman }) => ( + + + {labels.periods[period]} + + + + ))} + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/constants.ts new file mode 100644 index 0000000..9ee5227 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/constants.ts @@ -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 }[]; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/index.ts new file mode 100644 index 0000000..7c15de6 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/index.ts @@ -0,0 +1,5 @@ +export { LandingForAnalysts } from './LandingForAnalysts'; +export type { + LandingForAnalystsLabels, + LandingForAnalystsProps, +} from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/types.ts new file mode 100644 index 0000000..f43a5d5 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-for-analysts/types.ts @@ -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; + /** «درخواست عضویت تحلیلگر». */ + 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; + periods: Record; + }; +}; + +export type LandingForAnalystsProps = { + titleId: string; + /** Registration with the creator account type chosen. */ + applyHref: string; + labels: LandingForAnalystsLabels; +}; + +export type ChannelSampleProps = { + labels: LandingForAnalystsLabels['channel']; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-header/LandingHeader.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-header/LandingHeader.tsx new file mode 100644 index 0000000..fd6fe0d --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-header/LandingHeader.tsx @@ -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 ( + + + + {labels.brand} + + {isDesktop && ( + + {sections.map((section) => ( + + + {section.label} + + + ))} + + )} + + + {!isDesktop && ( + + )} + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-header/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-header/index.ts new file mode 100644 index 0000000..f737761 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-header/index.ts @@ -0,0 +1,6 @@ +export { LandingHeader } from './LandingHeader'; +export type { + LandingHeaderLabels, + LandingHeaderProps, + LandingSectionLink, +} from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-header/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-header/types.ts new file mode 100644 index 0000000..d1f8eb6 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-header/types.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-hero/LandingHero.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/LandingHero.tsx new file mode 100644 index 0000000..1db0314 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/LandingHero.tsx @@ -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 ( + + {/* Phone and tablet: its children join the grid, so the title can sit on the picture. */} + + + + + + {labels.kicker} + + + + {labels.title} + + + + {labels.lead} + + + + + + + + + {labels.note} + + + + + + {labels.imageAlt} + + + {labels.imageCaption} + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-hero/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/constants.ts new file mode 100644 index 0000000..1b4a5bf --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/constants.ts @@ -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; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-hero/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/index.ts new file mode 100644 index 0000000..55d64e3 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/index.ts @@ -0,0 +1,2 @@ +export { LandingHero } from './LandingHero'; +export type { LandingHeroLabels, LandingHeroProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-hero/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/types.ts new file mode 100644 index 0000000..7ff594c --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-hero/types.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-markets/LandingMarkets.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/LandingMarkets.tsx new file mode 100644 index 0000000..6c72863 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/LandingMarkets.tsx @@ -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: ( + + + + {labels.marketNames[market]} + + + {panel.description} + + + {panel.symbols.map((symbol) => ( + + {symbol} + + ))} + + + + + + + ), + }; + }); + + return ( + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-markets/components/MarketTabs.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/components/MarketTabs.tsx new file mode 100644 index 0000000..89a13c5 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/components/MarketTabs.tsx @@ -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) => { + 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 ( + + + {tabs.map((tab, index) => { + const isSelected = index === selected; + return ( + { + 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} + + ); + })} + + {tabs.map((tab, index) => ( + + ))} + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-markets/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/constants.ts new file mode 100644 index 0000000..458a6e2 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/constants.ts @@ -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 } +>; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-markets/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/index.ts new file mode 100644 index 0000000..be9e594 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/index.ts @@ -0,0 +1,2 @@ +export { LandingMarkets } from './LandingMarkets'; +export type { LandingMarketsLabels, LandingMarketsProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-markets/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/types.ts new file mode 100644 index 0000000..1287366 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-markets/types.ts @@ -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; + 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[]; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-plans/LandingPlans.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/LandingPlans.tsx new file mode 100644 index 0000000..a07fd61 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/LandingPlans.tsx @@ -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 ( + + + + + {PLAN_FACTS.map(({ key, icon }) => ( + + ))} + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-plans/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/constants.ts new file mode 100644 index 0000000..756376b --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/constants.ts @@ -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; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-plans/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/index.ts new file mode 100644 index 0000000..11c97e9 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/index.ts @@ -0,0 +1,2 @@ +export { LandingPlans } from './LandingPlans'; +export type { LandingPlansLabels, LandingPlansProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-plans/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/types.ts new file mode 100644 index 0000000..0fca144 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-plans/types.ts @@ -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; + /** «نمونه». */ + 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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-record/LandingRecord.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-record/LandingRecord.tsx new file mode 100644 index 0000000..805ed74 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-record/LandingRecord.tsx @@ -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 ( + + + + + {RECORD_FACTS.map(({ key, icon }) => ( + + ))} + + + + + {labels.caption} + + + {labels.captionWide} + + + } + > + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-record/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-record/constants.ts new file mode 100644 index 0000000..eb7d596 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-record/constants.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-record/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-record/index.ts new file mode 100644 index 0000000..970ac2e --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-record/index.ts @@ -0,0 +1,2 @@ +export { LandingRecord } from './LandingRecord'; +export type { LandingRecordLabels, LandingRecordProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-record/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-record/types.ts new file mode 100644 index 0000000..86e4347 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-record/types.ts @@ -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; + /** «نمونه». */ + 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; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-steps/LandingSteps.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/LandingSteps.tsx new file mode 100644 index 0000000..82a3938 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/LandingSteps.tsx @@ -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 ( + + + + {LANDING_STEPS.map((key, index) => ( + + + + {number(index + 1)} + + + + + {labels.steps[key].title} + + + {labels.steps[key].description} + + + + ))} + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-steps/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/constants.ts new file mode 100644 index 0000000..0b6cf60 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/constants.ts @@ -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]; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-steps/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/index.ts new file mode 100644 index 0000000..985b52e --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/index.ts @@ -0,0 +1,2 @@ +export { LandingSteps } from './LandingSteps'; +export type { LandingStepsLabels, LandingStepsProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-steps/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/types.ts new file mode 100644 index 0000000..34e40c5 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-steps/types.ts @@ -0,0 +1,12 @@ +import type { LandingStepKey } from './constants'; + +export type LandingStepsLabels = { + kicker: string; + title: string; + steps: Record; +}; + +export type LandingStepsProps = { + titleId: string; + labels: LandingStepsLabels; +}; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-trust/LandingTrust.tsx b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/LandingTrust.tsx new file mode 100644 index 0000000..3fc3d6c --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/LandingTrust.tsx @@ -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 ( + + + {TRUST_ITEMS.map(({ key, icon }) => ( + + + + + + + {labels.items[key].title} + + + {labels.items[key].description} + + + + ))} + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-trust/constants.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/constants.ts new file mode 100644 index 0000000..af6a0e8 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/constants.ts @@ -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']; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-trust/index.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/index.ts new file mode 100644 index 0000000..c46ca7b --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/index.ts @@ -0,0 +1,2 @@ +export { LandingTrust } from './LandingTrust'; +export type { LandingTrustLabels, LandingTrustProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/organisms/landing-trust/types.ts b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/types.ts new file mode 100644 index 0000000..6dd0ba1 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/organisms/landing-trust/types.ts @@ -0,0 +1,9 @@ +import type { TrustItemKey } from './constants'; + +export type LandingTrustLabels = { + /** The strip's accessible name: «چرا به لومینا اعتماد کنید». */ + label: string; + items: Record; +}; + +export type LandingTrustProps = { labels: LandingTrustLabels }; diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/LandingTemplate.tsx b/platforms/market/src/app/screens/(landing)/templates/landing-template/LandingTemplate.tsx new file mode 100644 index 0000000..4a2c077 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/LandingTemplate.tsx @@ -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: ( + + ), + }, + ...(hasFeatured + ? [ + { + id: IDS.featured, + content: ( + + ), + }, + ] + : []), + { + id: IDS.record, + content: ( + + ), + }, + { + id: IDS.how, + content: ( + + ), + }, + { + id: IDS.plans, + content: ( + + ), + }, + { + id: IDS.analysts, + content: ( + + ), + }, + { + id: IDS.faq, + content: ( + + ), + }, + ]; + const footerSections = [ + { id: IDS.how, label: labels.links.how }, + { id: IDS.analysts, label: labels.links.forAnalysts }, + { id: IDS.faq, label: labels.links.faq }, + ]; + + return ( + + + + + + + + {bands.map((band, index) => ( + + {band.content} + + ))} + + + + + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/components/LandingSection.tsx b/platforms/market/src/app/screens/(landing)/templates/landing-template/components/LandingSection.tsx new file mode 100644 index 0000000..cdd7afd --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/components/LandingSection.tsx @@ -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 ( + + + {children} + + + ); +} diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/components/variants.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/components/variants.ts new file mode 100644 index 0000000..a338a48 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/components/variants.ts @@ -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' }, +}); diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/constants.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/constants.ts new file mode 100644 index 0000000..e104ac2 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/constants.ts @@ -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'; diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/index.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/index.ts new file mode 100644 index 0000000..df34745 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/index.ts @@ -0,0 +1,4 @@ +export { LANDING_SECTION_IDS } from './constants'; +export { landingLabels } from './labels'; +export { LandingTemplate } from './LandingTemplate'; +export type { LandingLabels, LandingTemplateProps } from './types'; diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/labels.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/labels.ts new file mode 100644 index 0000000..d4e35ac --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/labels.ts @@ -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; + const periods = Object.fromEntries( + BILLING_PERIODS.map((period) => [ + period, + tCommon(`billing-periods.${period}`), + ]), + ) as Record; + 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'), + }, + }; +} diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/title-id.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/title-id.ts new file mode 100644 index 0000000..7a33ef6 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/title-id.ts @@ -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`; +} diff --git a/platforms/market/src/app/screens/(landing)/templates/landing-template/types.ts b/platforms/market/src/app/screens/(landing)/templates/landing-template/types.ts new file mode 100644 index 0000000..2d536c5 --- /dev/null +++ b/platforms/market/src/app/screens/(landing)/templates/landing-template/types.ts @@ -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; +}; diff --git a/platforms/market/src/app/screens/(main)/organisms/home-feed/HomeGuard.tsx b/platforms/market/src/app/screens/(main)/organisms/home-feed/HomeGuard.tsx index 0fc8635..8b511aa 100644 --- a/platforms/market/src/app/screens/(main)/organisms/home-feed/HomeGuard.tsx +++ b/platforms/market/src/app/screens/(main)/organisms/home-feed/HomeGuard.tsx @@ -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(() => { diff --git a/platforms/market/src/app/screens/organisms/support-entry/SupportEntry.tsx b/platforms/market/src/app/screens/organisms/support-entry/SupportEntry.tsx index abc1396..09d1fb9 100644 --- a/platforms/market/src/app/screens/organisms/support-entry/SupportEntry.tsx +++ b/platforms/market/src/app/screens/organisms/support-entry/SupportEntry.tsx @@ -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'), diff --git a/platforms/market/src/app/screens/organisms/support-entry/index.ts b/platforms/market/src/app/screens/organisms/support-entry/index.ts index 89b6d23..7ef63b4 100644 --- a/platforms/market/src/app/screens/organisms/support-entry/index.ts +++ b/platforms/market/src/app/screens/organisms/support-entry/index.ts @@ -1,2 +1,3 @@ +export { supportChatUrls } from './support-chats'; export { SupportEntry } from './SupportEntry'; -export type { SupportEntryProps } from './types'; +export type { SupportChats, SupportEntryProps } from './types'; diff --git a/platforms/market/src/app/screens/organisms/support-entry/support-chats.ts b/platforms/market/src/app/screens/organisms/support-entry/support-chats.ts new file mode 100644 index 0000000..a06c076 --- /dev/null +++ b/platforms/market/src/app/screens/organisms/support-entry/support-chats.ts @@ -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), + }; +} diff --git a/platforms/market/src/app/screens/organisms/support-entry/types.ts b/platforms/market/src/app/screens/organisms/support-entry/types.ts index 5406b96..fdf8491 100644 --- a/platforms/market/src/app/screens/organisms/support-entry/types.ts +++ b/platforms/market/src/app/screens/organisms/support-entry/types.ts @@ -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 }; diff --git a/platforms/market/src/app/seo/landing.ts b/platforms/market/src/app/seo/landing.ts new file mode 100644 index 0000000..f6cb80a --- /dev/null +++ b/platforms/market/src/app/seo/landing.ts @@ -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 + * `