Files
trumpsignal-monorepo/apps/web/pages/[locale]/macro.tsx
T

98 lines
3.5 KiB
TypeScript

import { getFundingSnapshot, getPosts } from '@/lib/api'
import type { Metadata } from 'next'
import MacroVibesPageClient from '@/screens/macro/MacroVibesPageClient'
import Breadcrumbs from '@/components/seo/Breadcrumbs'
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://trumpsignal.com'
interface MacroVibesPageProps {
params: Promise<{ locale: string }>
}
async function generateMetadata({ params }: MacroVibesPageProps): Promise<Metadata> {
const locale = 'en'
const isZh = false // i18n shelved — Chinese branches kept as dead code for future revival; see messages/zh.json
return {
title: isZh
? '宏观氛围 — 加密市场宏观读数'
: 'Macro Vibes — read crypto macro before price prints',
description: isZh
? 'Trump Alpha 的宏观氛围面板:AHR999、Fear & Greed、BTC 主导率、ETH/BTC、稳定币供应、ETF 资金流、永续 OI、Altcoin Season Index 八大公开宏观指标合一,外加 BTC 周期底部 + 资金费率反转两条触发器。'
: 'Macro vibes for crypto. Eight public macro signals in one view — AHR999, Fear & Greed, BTC dominance, ETH/BTC, stablecoin supply, ETF flows, perp OI, Altcoin Season Index — plus BTC bottom and funding-rate triggers.',
keywords: isZh
? [
'宏观氛围',
'加密宏观',
'AHR999',
'Fear and Greed',
'BTC 主导率',
'ETH/BTC',
'ETF 资金流',
'稳定币供应',
'资金费率反转',
'Altcoin Season Index',
]
: [
'crypto macro',
'macro vibes',
'AHR999',
'Fear and Greed Index',
'BTC dominance',
'ETH/BTC ratio',
'stablecoin supply',
'Bitcoin ETF flow',
'funding rate reversal',
'Altcoin Season Index',
],
openGraph: {
title: isZh ? '宏观氛围 | Trump Alpha' : 'Macro Vibes | Trump Alpha',
description: isZh
? '加密宏观一屏看完:八大宏观指标 + BTC 周期底部 + 资金费率反转触发器。'
: 'Macro vibes for crypto. Read what is about to happen before price prints it.',
},
alternates: {
canonical: `${siteUrl}/en/macro`,
languages: {
en: `${siteUrl}/en/macro`,
'x-default': `${siteUrl}/en/macro`,
},
},
}
}
export default function MacroVibesPage({
posts,
fundingSnapshot,
}: Awaited<ReturnType<typeof loadData>>) {
return (
<>
<Breadcrumbs items={[{ name: 'Macro Vibes', path: '/en/macro' }]} />
<MacroVibesPageClient initialPosts={posts} initialFundingSnapshot={fundingSnapshot} />
</>
)
}
async function loadData() {
const [posts, fundingSnapshot] = await Promise.all([
// The default tab is the bottom-reversal view. Fetch only the source this
// page actually renders on first paint instead of hydrating with the
// latest global post firehose and filtering it client-side.
getPosts(200, 1, 'btc_bottom_reversal').catch(() => null),
getFundingSnapshot().catch(() => null),
])
return { posts, fundingSnapshot }
}
export const getServerSideProps: import('next').GetServerSideProps = async (context) => {
if (context.params?.locale !== 'en') return { notFound: true }
context.res.setHeader('Cache-Control', 'public, s-maxage=30, stale-while-revalidate=60')
return {
props: {
...(await loadData()),
seo: await generateMetadata({ params: Promise.resolve({ locale: 'en' }) }),
},
}
}