feat(apps): prerendered landing at / and خانه at /feed in bull and bear
- `(landing)` route with `force-static` and `revalidate = 600`, its loading and error pages, the hero image and LandingRedirect (0026, 0027). - `force-dynamic` moves from the root layouts to each route group's layout, so every other route still renders per request. - The feed moves from `(main)/(home)` to `(main)/feed`, with bear's empty `@modal` page. - Auth frames' brand goes to the landing, onboarding's to خانه. - Server bootstrap adds the server-only translations; server env reads `NEXT_PHASE` for the build-time fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ba673f4a28
commit
45c5551e18
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function AuthLayout({ children }: { children: ReactNode }) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function FlowLayout({ children }: { children: ReactNode }) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
export { PageError as default } from '@lumina/market/app/screens/organisms/page-error';
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
import { GridBox } from '@lumina/island/atoms/grid-box';
|
||||||
|
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
|
||||||
|
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
|
||||||
|
/** The landing before it arrives: the header's height, then the hero's copy beside its picture. */
|
||||||
|
export default function Loading() {
|
||||||
|
return (
|
||||||
|
<SkeletonRegion
|
||||||
|
label={i18n.t('landing:loading')}
|
||||||
|
delayed
|
||||||
|
className="min-h-dvh bg-surface"
|
||||||
|
>
|
||||||
|
<FlexBox
|
||||||
|
alignItems="items-center"
|
||||||
|
className="h-16 border-b border-border-subtle px-8"
|
||||||
|
>
|
||||||
|
<Skeleton width="5rem" height="1.25rem" />
|
||||||
|
</FlexBox>
|
||||||
|
<GridBox
|
||||||
|
cols="grid-cols-2"
|
||||||
|
gap="gap-16"
|
||||||
|
alignItems="items-center"
|
||||||
|
className="mx-auto max-w-page px-8 py-14"
|
||||||
|
>
|
||||||
|
<FlexBox direction="flex-col" gap="gap-4">
|
||||||
|
<Skeleton height="3rem" width="90%" />
|
||||||
|
<Skeleton lines={3} height="1rem" />
|
||||||
|
<Skeleton shape="pill" width="12rem" height="3.25rem" />
|
||||||
|
</FlexBox>
|
||||||
|
<Skeleton shape="rect" width="100%" height="36rem" />
|
||||||
|
</GridBox>
|
||||||
|
</SkeletonRegion>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { Element } from '@lumina/island/primitives/element';
|
||||||
|
import { LandingRedirect } from '@lumina/market/app/guards/landing-redirect';
|
||||||
|
import { faqEntries } from '@lumina/market/app/screens/(landing)/organisms/landing-faq';
|
||||||
|
import {
|
||||||
|
landingLabels,
|
||||||
|
LandingTemplate,
|
||||||
|
} from '@lumina/market/app/screens/(landing)/templates/landing-template';
|
||||||
|
import {
|
||||||
|
faqJsonLd,
|
||||||
|
landingMetadata,
|
||||||
|
loadLandingPage,
|
||||||
|
} from '@lumina/market/server';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
import { PHASE_PRODUCTION_BUILD } from 'next/constants';
|
||||||
|
|
||||||
|
import { displayUrl } from '../../configs';
|
||||||
|
import { serverEnv } from '../../env/server';
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
|
||||||
|
// The landing is the same for every visitor and reads no session, so it is prerendered and its
|
||||||
|
// featured analysts are read again every 10 minutes (0026). Every other route renders fresh.
|
||||||
|
export const dynamic = 'force-static';
|
||||||
|
export const revalidate = 600;
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return landingMetadata({
|
||||||
|
title: i18n.t('landing:meta.title'),
|
||||||
|
description: i18n.t('landing:hero.lead'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The landing, `/`: what Lumina is, for a signed-out visitor, and the way to registration. A
|
||||||
|
* signed-in person is sent on to their home once the browser knows them (0027).
|
||||||
|
*/
|
||||||
|
export default async function LandingPage() {
|
||||||
|
// A failed read hides the analysts at build time; at a revalidation it keeps the last good page.
|
||||||
|
const { featured } = await loadLandingPage({
|
||||||
|
hideOnError: serverEnv.NEXT_PHASE === PHASE_PRODUCTION_BUILD,
|
||||||
|
});
|
||||||
|
const labels = landingLabels(
|
||||||
|
i18n.getFixedT(null, 'landing'),
|
||||||
|
i18n.getFixedT(null, 'common'),
|
||||||
|
i18n.getFixedT(null, 'content'),
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<LandingTemplate
|
||||||
|
layout="desktop"
|
||||||
|
featured={featured}
|
||||||
|
siteHost={displayUrl('')}
|
||||||
|
labels={labels}
|
||||||
|
/>
|
||||||
|
<Element
|
||||||
|
tag="script"
|
||||||
|
type="application/ld+json"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: faqJsonLd(faqEntries(labels.faq)),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<LandingRedirect />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ export function generateMetadata(): Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* خانه, `/`: the investor's feed of the creators they follow. The server sends only the frame and
|
* خانه, `/feed`: the investor's feed of the creators they follow. The server sends only the frame and
|
||||||
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
||||||
* A guest goes to login, which returns here, and a creator to their own channel. A failed feed
|
* A guest goes to login, which returns here, and a creator to their own channel. A failed feed
|
||||||
* shows in a card in the column, as the desktop boards draw a state there (S3, S2-Desktop).
|
* shows in a card in the column, as the desktop boards draw a state there (S3, S2-Desktop).
|
||||||
|
|
@ -2,6 +2,10 @@ import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
import { DesktopHeader } from '@lumina/market/app/navigation';
|
import { DesktopHeader } from '@lumina/market/app/navigation';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
type MainLayoutProps = {
|
type MainLayoutProps = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
/** The `@modal` slot: «پست جدید» over the page (C4 ۷.۳), or nothing. */
|
/** The `@modal` slot: «پست جدید» over the page (C4 ۷.۳), or nothing. */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function OnboardingLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CreatorProfileStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step';
|
import { CreatorProfileStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../../templates/auth-template';
|
||||||
|
|
@ -6,7 +7,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
|
||||||
/** Registration step 5 for a creator, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
/** Registration step 5 for a creator, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
||||||
export default function Loading() {
|
export default function Loading() {
|
||||||
return (
|
return (
|
||||||
<AuthTemplate framed={false}>
|
<AuthTemplate brandHref={ROUTES.home} framed={false}>
|
||||||
<CreatorProfileStepSkeleton
|
<CreatorProfileStepSkeleton
|
||||||
layout="desktop"
|
layout="desktop"
|
||||||
label={i18n.t('auth:loading')}
|
label={i18n.t('auth:loading')}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import {
|
import {
|
||||||
CreatorProfileStep,
|
CreatorProfileStep,
|
||||||
CreatorProfileStepSkeleton,
|
CreatorProfileStepSkeleton,
|
||||||
|
|
@ -28,7 +29,7 @@ export default function CreatorProfilePage() {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<AuthTemplate framed={false}>
|
<AuthTemplate brandHref={ROUTES.home} framed={false}>
|
||||||
<AuthGuard role="creator" fallback={skeleton}>
|
<AuthGuard role="creator" fallback={skeleton}>
|
||||||
<Suspense fallback={skeleton}>
|
<Suspense fallback={skeleton}>
|
||||||
<CreatorProfileStep
|
<CreatorProfileStep
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CreatorProfileDoneStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/done/organisms/creator-profile-done-step';
|
import { CreatorProfileDoneStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/done/organisms/creator-profile-done-step';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../../templates/auth-template';
|
||||||
|
|
@ -6,7 +7,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
|
||||||
/** The creator's end of registration, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
/** The creator's end of registration, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
||||||
export default function Loading() {
|
export default function Loading() {
|
||||||
return (
|
return (
|
||||||
<AuthTemplate width="wide">
|
<AuthTemplate brandHref={ROUTES.home} width="wide">
|
||||||
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
||||||
</AuthTemplate>
|
</AuthTemplate>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import {
|
import {
|
||||||
CreatorProfileDoneStep,
|
CreatorProfileDoneStep,
|
||||||
CreatorProfileDoneStepSkeleton,
|
CreatorProfileDoneStepSkeleton,
|
||||||
|
|
@ -25,7 +26,7 @@ export default function CreatorProfileDonePage() {
|
||||||
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<AuthTemplate width="wide">
|
<AuthTemplate brandHref={ROUTES.home} width="wide">
|
||||||
<AuthGuard role="creator" fallback={skeleton}>
|
<AuthGuard role="creator" fallback={skeleton}>
|
||||||
<Suspense fallback={skeleton}>
|
<Suspense fallback={skeleton}>
|
||||||
<CreatorProfileDoneStep size="md" supportPlacement="popover" />
|
<CreatorProfileDoneStep size="md" supportPlacement="popover" />
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { InvestorProfileStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/investor-profile/organisms/investor-profile-step';
|
import { InvestorProfileStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/investor-profile/organisms/investor-profile-step';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
@ -6,7 +7,7 @@ import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
/** Registration step 5 for an investor, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
/** Registration step 5 for an investor, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
||||||
export default function Loading() {
|
export default function Loading() {
|
||||||
return (
|
return (
|
||||||
<AuthTemplate width="wide">
|
<AuthTemplate brandHref={ROUTES.home} width="wide">
|
||||||
<InvestorProfileStepSkeleton label={i18n.t('auth:loading')} />
|
<InvestorProfileStepSkeleton label={i18n.t('auth:loading')} />
|
||||||
</AuthTemplate>
|
</AuthTemplate>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import {
|
import {
|
||||||
InvestorProfileStep,
|
InvestorProfileStep,
|
||||||
InvestorProfileStepSkeleton,
|
InvestorProfileStepSkeleton,
|
||||||
|
|
@ -21,7 +22,7 @@ export function generateMetadata(): Metadata {
|
||||||
*/
|
*/
|
||||||
export default function InvestorProfilePage() {
|
export default function InvestorProfilePage() {
|
||||||
return (
|
return (
|
||||||
<AuthTemplate width="wide">
|
<AuthTemplate brandHref={ROUTES.home} width="wide">
|
||||||
<AuthGuard
|
<AuthGuard
|
||||||
role="investor"
|
role="investor"
|
||||||
fallback={
|
fallback={
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ import { rootMetadata } from '../configs';
|
||||||
import { i18n } from '../i18n';
|
import { i18n } from '../i18n';
|
||||||
import { AppProviders } from './organisms/app-providers';
|
import { AppProviders } from './organisms/app-providers';
|
||||||
|
|
||||||
// Every request renders fresh: nothing is prerendered or cached on the server.
|
|
||||||
export const dynamic = 'force-dynamic';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return rootMetadata();
|
return rootMetadata();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import type { AuthTemplateProps } from './types';
|
||||||
export function AuthTemplate({
|
export function AuthTemplate({
|
||||||
width = 'narrow',
|
width = 'narrow',
|
||||||
framed = true,
|
framed = true,
|
||||||
|
brandHref = ROUTES.landing,
|
||||||
children,
|
children,
|
||||||
}: AuthTemplateProps) {
|
}: AuthTemplateProps) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -30,7 +31,7 @@ export function AuthTemplate({
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
tag={NextLink}
|
tag={NextLink}
|
||||||
href={ROUTES.home}
|
href={brandHref}
|
||||||
aria-label={i18n.t('auth:header.home')}
|
aria-label={i18n.t('auth:header.home')}
|
||||||
variant="heading-sm"
|
variant="heading-sm"
|
||||||
color="brand"
|
color="brand"
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,7 @@ export type AuthTemplateProps = {
|
||||||
* live preview.
|
* live preview.
|
||||||
*/
|
*/
|
||||||
framed?: boolean;
|
framed?: boolean;
|
||||||
|
/** Where the brand goes: the landing for login and registration, خانه on onboarding pages. */
|
||||||
|
brandHref?: string;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { http } from '@lumina/libs/http';
|
||||||
import { configureServerHttp } from '@lumina/libs/server';
|
import { configureServerHttp } from '@lumina/libs/server';
|
||||||
import { mapApiErrorBody } from '@lumina/market/app/http';
|
import { mapApiErrorBody } from '@lumina/market/app/http';
|
||||||
import { setEnv as setMarketEnv } from '@lumina/market/env';
|
import { setEnv as setMarketEnv } from '@lumina/market/env';
|
||||||
|
import { SERVER_RESOURCES } from '@lumina/market/server';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -14,6 +15,7 @@ import {
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import { clientEnv } from '../env';
|
import { clientEnv } from '../env';
|
||||||
import { serverEnv } from '../env/server';
|
import { serverEnv } from '../env/server';
|
||||||
|
import { i18n } from '../i18n';
|
||||||
import { ERROR_HANDLER_CONFIG } from './error-reporting';
|
import { ERROR_HANDLER_CONFIG } from './error-reporting';
|
||||||
|
|
||||||
// Fills the server module graph once, before rendering. Idempotent: safe to run again.
|
// Fills the server module graph once, before rendering. Idempotent: safe to run again.
|
||||||
|
|
@ -37,3 +39,10 @@ configureServerHttp({
|
||||||
});
|
});
|
||||||
http.configure({ mapErrorBody: mapApiErrorBody });
|
http.configure({ mapErrorBody: mapApiErrorBody });
|
||||||
configureErrorHandler(ERROR_HANDLER_CONFIG);
|
configureErrorHandler(ERROR_HANDLER_CONFIG);
|
||||||
|
// Namespaces only server components read (the landing) join the server's i18n instance here, so
|
||||||
|
// no client bundle carries them. Existing keys are kept, so running this again changes nothing.
|
||||||
|
for (const [language, bundles] of Object.entries(SERVER_RESOURCES)) {
|
||||||
|
for (const [namespace, bundle] of Object.entries(bundles)) {
|
||||||
|
i18n.addResourceBundle(language, namespace, bundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,18 @@ import 'server-only';
|
||||||
|
|
||||||
import { origin } from '@lumina/libs/env';
|
import { origin } from '@lumina/libs/env';
|
||||||
import { createServerEnv } from '@lumina/libs/env/server';
|
import { createServerEnv } from '@lumina/libs/env/server';
|
||||||
|
import * as v from 'valibot';
|
||||||
|
|
||||||
/** Server variables; only server code imports them, through `env/server`. */
|
/** Server variables; only server code imports them, through `env/server`. */
|
||||||
export const serverEnv = createServerEnv({
|
export const serverEnv = createServerEnv({
|
||||||
schema: {
|
schema: {
|
||||||
/** The gateway from inside the deployment network: server requests and the `/api` proxy. */
|
/** The gateway from inside the deployment network: server requests and the `/api` proxy. */
|
||||||
API_INTERNAL_ORIGIN: origin,
|
API_INTERNAL_ORIGIN: origin,
|
||||||
|
/**
|
||||||
|
* Set by Next.js itself, never in `.env`: `phase-production-build` while `next build`
|
||||||
|
* prerenders pages (the landing, 0026).
|
||||||
|
*/
|
||||||
|
NEXT_PHASE: v.optional(v.string()),
|
||||||
},
|
},
|
||||||
runtimeEnv: process.env,
|
runtimeEnv: process.env,
|
||||||
skipValidation: process.env.SKIP_ENV_VALIDATION === 'true',
|
skipValidation: process.env.SKIP_ENV_VALIDATION === 'true',
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function AuthLayout({ children }: { children: ReactNode }) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function FlowLayout({ children }: { children: ReactNode }) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
export { PageError as default } from '@lumina/market/app/screens/organisms/page-error';
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
|
import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton';
|
||||||
|
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
|
||||||
|
/** The landing before it arrives: the header's height, then the hero's picture and copy. */
|
||||||
|
export default function Loading() {
|
||||||
|
return (
|
||||||
|
<SkeletonRegion
|
||||||
|
label={i18n.t('landing:loading')}
|
||||||
|
delayed
|
||||||
|
className="min-h-dvh bg-surface"
|
||||||
|
>
|
||||||
|
<FlexBox
|
||||||
|
alignItems="items-center"
|
||||||
|
className="h-14 border-b border-border-subtle px-4 tablet:h-16 tablet:px-8"
|
||||||
|
>
|
||||||
|
<Skeleton width="5rem" height="1.25rem" />
|
||||||
|
</FlexBox>
|
||||||
|
<FlexBox
|
||||||
|
direction="flex-col"
|
||||||
|
gap="gap-4"
|
||||||
|
className="px-4 pt-7 tablet:px-8"
|
||||||
|
>
|
||||||
|
<Skeleton shape="rect" width="100%" height="24rem" />
|
||||||
|
<Skeleton lines={3} height="1rem" />
|
||||||
|
<Skeleton shape="pill" width="100%" height="3.25rem" />
|
||||||
|
</FlexBox>
|
||||||
|
</SkeletonRegion>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { Element } from '@lumina/island/primitives/element';
|
||||||
|
import { LandingRedirect } from '@lumina/market/app/guards/landing-redirect';
|
||||||
|
import { faqEntries } from '@lumina/market/app/screens/(landing)/organisms/landing-faq';
|
||||||
|
import {
|
||||||
|
landingLabels,
|
||||||
|
LandingTemplate,
|
||||||
|
} from '@lumina/market/app/screens/(landing)/templates/landing-template';
|
||||||
|
import {
|
||||||
|
faqJsonLd,
|
||||||
|
landingMetadata,
|
||||||
|
loadLandingPage,
|
||||||
|
} from '@lumina/market/server';
|
||||||
|
import type { Metadata } from 'next';
|
||||||
|
import { PHASE_PRODUCTION_BUILD } from 'next/constants';
|
||||||
|
|
||||||
|
import { displayUrl } from '../../configs';
|
||||||
|
import { serverEnv } from '../../env/server';
|
||||||
|
import { i18n } from '../../i18n';
|
||||||
|
|
||||||
|
// The landing is the same for every visitor and reads no session, so it is prerendered and its
|
||||||
|
// featured analysts are read again every 10 minutes (0026). Every other route renders fresh.
|
||||||
|
export const dynamic = 'force-static';
|
||||||
|
export const revalidate = 600;
|
||||||
|
|
||||||
|
export function generateMetadata(): Metadata {
|
||||||
|
return landingMetadata({
|
||||||
|
title: i18n.t('landing:meta.title'),
|
||||||
|
description: i18n.t('landing:hero.lead'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The landing, `/`: what Lumina is, for a signed-out visitor, and the way to registration. A
|
||||||
|
* signed-in person is sent on to their home once the browser knows them (0027).
|
||||||
|
*/
|
||||||
|
export default async function LandingPage() {
|
||||||
|
// A failed read hides the analysts at build time; at a revalidation it keeps the last good page.
|
||||||
|
const { featured } = await loadLandingPage({
|
||||||
|
hideOnError: serverEnv.NEXT_PHASE === PHASE_PRODUCTION_BUILD,
|
||||||
|
});
|
||||||
|
const labels = landingLabels(
|
||||||
|
i18n.getFixedT(null, 'landing'),
|
||||||
|
i18n.getFixedT(null, 'common'),
|
||||||
|
i18n.getFixedT(null, 'content'),
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<LandingTemplate
|
||||||
|
layout="mobile"
|
||||||
|
featured={featured}
|
||||||
|
siteHost={displayUrl('')}
|
||||||
|
labels={labels}
|
||||||
|
/>
|
||||||
|
<Element
|
||||||
|
tag="script"
|
||||||
|
type="application/ld+json"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: faqJsonLd(faqEntries(labels.faq)),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<LandingRedirect />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ export function generateMetadata(): Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* خانه, `/`: the investor's feed of the creators they follow. The server sends only the frame and
|
* خانه, `/feed`: the investor's feed of the creators they follow. The server sends only the frame and
|
||||||
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
* the feed's skeleton, the same for every visitor; the feed loads in the browser with the session.
|
||||||
* A guest goes to login, which returns here, and a creator to their own channel.
|
* A guest goes to login, which returns here, and a creator to their own channel.
|
||||||
*/
|
*/
|
||||||
|
|
@ -2,6 +2,10 @@ import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
import { BottomNav } from '@lumina/market/app/navigation';
|
import { BottomNav } from '@lumina/market/app/navigation';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
/** The main pages on mobile: each page brings its top bar; the bottom nav is shared. */
|
/** The main pages on mobile: each page brings its top bar; the bottom nav is shared. */
|
||||||
export default function MainLayout({ children }: { children: ReactNode }) {
|
export default function MainLayout({ children }: { children: ReactNode }) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
// Every request renders fresh: nothing in this group is prerendered or cached on the server.
|
||||||
|
// Only the landing is (0026), so this lives in each route group's layout, not the root's.
|
||||||
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
|
/** Adds nothing to the page; it holds the group's rendering mode. */
|
||||||
|
export default function OnboardingLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CreatorProfileDoneStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/done/organisms/creator-profile-done-step';
|
import { CreatorProfileDoneStepSkeleton } from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/done/organisms/creator-profile-done-step';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
||||||
|
|
@ -7,7 +8,7 @@ import { AuthTemplate } from '../../../../templates/auth-template';
|
||||||
/** The creator's end of registration, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
/** The creator's end of registration, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */
|
||||||
export default function Loading() {
|
export default function Loading() {
|
||||||
return (
|
return (
|
||||||
<AuthTemplate header={<AuthTopBar />}>
|
<AuthTemplate header={<AuthTopBar brandHref={ROUTES.home} />}>
|
||||||
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
||||||
</AuthTemplate>
|
</AuthTemplate>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
||||||
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import {
|
import {
|
||||||
CreatorProfileDoneStep,
|
CreatorProfileDoneStep,
|
||||||
CreatorProfileDoneStepSkeleton,
|
CreatorProfileDoneStepSkeleton,
|
||||||
|
|
@ -27,7 +28,7 @@ export default function CreatorProfileDonePage() {
|
||||||
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
<CreatorProfileDoneStepSkeleton label={i18n.t('auth:loading')} />
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<AuthTemplate header={<AuthTopBar />}>
|
<AuthTemplate header={<AuthTopBar brandHref={ROUTES.home} />}>
|
||||||
<AuthGuard role="creator" fallback={skeleton}>
|
<AuthGuard role="creator" fallback={skeleton}>
|
||||||
<Suspense fallback={skeleton}>
|
<Suspense fallback={skeleton}>
|
||||||
<CreatorProfileDoneStep size="lg" supportPlacement="bottom" />
|
<CreatorProfileDoneStep size="lg" supportPlacement="bottom" />
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ import { rootMetadata } from '../configs';
|
||||||
import { i18n } from '../i18n';
|
import { i18n } from '../i18n';
|
||||||
import { AppProviders } from './organisms/app-providers';
|
import { AppProviders } from './organisms/app-providers';
|
||||||
|
|
||||||
// Every request renders fresh: nothing is prerendered or cached on the server.
|
|
||||||
export const dynamic = 'force-dynamic';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return rootMetadata();
|
return rootMetadata();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ import type { AuthTopBarProps } from './types';
|
||||||
* support on a pushed step; only the name on a step with no way back (registration step 4).
|
* support on a pushed step; only the name on a step with no way back (registration step 4).
|
||||||
* Back keeps what was typed: the number lives in the flow store.
|
* Back keeps what was typed: the number lives in the flow store.
|
||||||
*/
|
*/
|
||||||
export function AuthTopBar({ title, back }: AuthTopBarProps) {
|
export function AuthTopBar({
|
||||||
|
title,
|
||||||
|
back,
|
||||||
|
brandHref = ROUTES.landing,
|
||||||
|
}: AuthTopBarProps) {
|
||||||
return (
|
return (
|
||||||
<FlexBox
|
<FlexBox
|
||||||
tag="header"
|
tag="header"
|
||||||
|
|
@ -34,7 +38,7 @@ export function AuthTopBar({ title, back }: AuthTopBarProps) {
|
||||||
<FlexBox className="flex-1 px-2">
|
<FlexBox className="flex-1 px-2">
|
||||||
<Typography
|
<Typography
|
||||||
tag={NextLink}
|
tag={NextLink}
|
||||||
href={ROUTES.home}
|
href={brandHref}
|
||||||
aria-label={i18n.t('auth:header.home')}
|
aria-label={i18n.t('auth:header.home')}
|
||||||
variant="heading-sm"
|
variant="heading-sm"
|
||||||
color="brand"
|
color="brand"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ export type AuthTopBarProps = {
|
||||||
title?: string;
|
title?: string;
|
||||||
/** The previous step's path, behind the back button; `?redirect=` is kept from the address. */
|
/** The previous step's path, behind the back button; `?redirect=` is kept from the address. */
|
||||||
back?: string;
|
back?: string;
|
||||||
|
/** Where the brand goes: the landing for login and registration, خانه on onboarding pages. */
|
||||||
|
brandHref?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BackButtonProps = {
|
export type BackButtonProps = {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { http } from '@lumina/libs/http';
|
||||||
import { configureServerHttp } from '@lumina/libs/server';
|
import { configureServerHttp } from '@lumina/libs/server';
|
||||||
import { mapApiErrorBody } from '@lumina/market/app/http';
|
import { mapApiErrorBody } from '@lumina/market/app/http';
|
||||||
import { setEnv as setMarketEnv } from '@lumina/market/env';
|
import { setEnv as setMarketEnv } from '@lumina/market/env';
|
||||||
|
import { SERVER_RESOURCES } from '@lumina/market/server';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -14,6 +15,7 @@ import {
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import { clientEnv } from '../env';
|
import { clientEnv } from '../env';
|
||||||
import { serverEnv } from '../env/server';
|
import { serverEnv } from '../env/server';
|
||||||
|
import { i18n } from '../i18n';
|
||||||
import { ERROR_HANDLER_CONFIG } from './error-reporting';
|
import { ERROR_HANDLER_CONFIG } from './error-reporting';
|
||||||
|
|
||||||
// Fills the server module graph once, before rendering. Idempotent: safe to run again.
|
// Fills the server module graph once, before rendering. Idempotent: safe to run again.
|
||||||
|
|
@ -37,3 +39,10 @@ configureServerHttp({
|
||||||
});
|
});
|
||||||
http.configure({ mapErrorBody: mapApiErrorBody });
|
http.configure({ mapErrorBody: mapApiErrorBody });
|
||||||
configureErrorHandler(ERROR_HANDLER_CONFIG);
|
configureErrorHandler(ERROR_HANDLER_CONFIG);
|
||||||
|
// Namespaces only server components read (the landing) join the server's i18n instance here, so
|
||||||
|
// no client bundle carries them. Existing keys are kept, so running this again changes nothing.
|
||||||
|
for (const [language, bundles] of Object.entries(SERVER_RESOURCES)) {
|
||||||
|
for (const [namespace, bundle] of Object.entries(bundles)) {
|
||||||
|
i18n.addResourceBundle(language, namespace, bundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,18 @@ import 'server-only';
|
||||||
|
|
||||||
import { origin } from '@lumina/libs/env';
|
import { origin } from '@lumina/libs/env';
|
||||||
import { createServerEnv } from '@lumina/libs/env/server';
|
import { createServerEnv } from '@lumina/libs/env/server';
|
||||||
|
import * as v from 'valibot';
|
||||||
|
|
||||||
/** Server variables; only server code imports them, through `env/server`. */
|
/** Server variables; only server code imports them, through `env/server`. */
|
||||||
export const serverEnv = createServerEnv({
|
export const serverEnv = createServerEnv({
|
||||||
schema: {
|
schema: {
|
||||||
/** The gateway from inside the deployment network: server requests and the `/api` proxy. */
|
/** The gateway from inside the deployment network: server requests and the `/api` proxy. */
|
||||||
API_INTERNAL_ORIGIN: origin,
|
API_INTERNAL_ORIGIN: origin,
|
||||||
|
/**
|
||||||
|
* Set by Next.js itself, never in `.env`: `phase-production-build` while `next build`
|
||||||
|
* prerenders pages (the landing, 0026).
|
||||||
|
*/
|
||||||
|
NEXT_PHASE: v.optional(v.string()),
|
||||||
},
|
},
|
||||||
runtimeEnv: process.env,
|
runtimeEnv: process.env,
|
||||||
skipValidation: process.env.SKIP_ENV_VALIDATION === 'true',
|
skipValidation: process.env.SKIP_ENV_VALIDATION === 'true',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue