wealth/apps/bear/src/app/(landing)/page.tsx

68 lines
2.2 KiB
TypeScript
Raw Normal View History

// First: the static `metadata` below reads a server-only namespace, which the server bootstrap
// adds to i18n when this module loads, whichever module Next loads first (0055).
import '../../bootstrap/bootstrap.server';
import { 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 const metadata: Metadata = 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 />
</>
);
}