KOL count: 29 → 25 across marketing/SEO copy
Backend KOL_FEEDS trimmed from 29 to 25 (dead feeds removed).
Sync all hardcoded count mentions:
- layout.tsx JSON-LD, page.tsx (metric + comparison + copy)
- kol/page.tsx, KolPageClient.tsx ("and 26 more" → "and 22 more")
- glossary/page.tsx, opengraph-image.tsx
- public/llms.txt, llms-full.txt
- drop removed KOLs (Dragonfly Capital, Nic Carter) from named lists
Bundles other in-flight frontend work already in the working tree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,68 +1,98 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useLocale } from 'next-intl'
|
||||
import { useState, useEffect } from 'react'
|
||||
import type { TrumpPost } from '@/types'
|
||||
import { getPosts } from '@/lib/api'
|
||||
import { getPosts, getPostsPage, type PostListResponse } from '@/lib/api'
|
||||
import { hasCached, swrFetch } from '@/lib/cache'
|
||||
import PostRow from '@/components/dashboard/PostCards'
|
||||
import PageHint from '@/components/ui/PageHint'
|
||||
import Pagination from '@/components/ui/Pagination'
|
||||
import { buildArchiveFallbackResponse } from '@/lib/postPage'
|
||||
|
||||
const ARCHIVE_PAGE_SIZE = 30
|
||||
|
||||
const LIVE_SOURCES = new Set([
|
||||
'truth',
|
||||
'btc_bottom_reversal',
|
||||
'funding_reversal',
|
||||
'kol_divergence',
|
||||
])
|
||||
interface ArchivePageClientProps {
|
||||
initialData?: PostListResponse | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive — legacy / test signals (rsi_reversal, sma_reclaim, breakout,
|
||||
* test, phase1…). NOT a live system. Kept only so old data is inspectable.
|
||||
*/
|
||||
export default function ArchivePageClient() {
|
||||
const locale = useLocale()
|
||||
const isZh = false // i18n shelved — Chinese branches kept as dead code for future revival; see messages/zh.json
|
||||
const [posts, setPosts] = useState<TrumpPost[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
export default function ArchivePageClient({ initialData = null }: ArchivePageClientProps) {
|
||||
const [posts, setPosts] = useState<TrumpPost[]>(initialData?.items ?? [])
|
||||
const [totalPosts, setTotalPosts] = useState(initialData?.total ?? 0)
|
||||
const [sourceCounts, setSourceCounts] = useState(initialData?.source_counts ?? [])
|
||||
const [loading, setLoading] = useState(initialData === null)
|
||||
const [loadErr, setLoadErr] = useState('')
|
||||
const [src, setSrc] = useState<string>('all')
|
||||
const [archivePage, setArchivePage] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
getPosts(500, 1)
|
||||
.then(p => { setPosts(p); setLoadErr('') })
|
||||
.catch(e => setLoadErr(e instanceof Error ? e.message : (isZh ? '历史归档加载失败' : 'Failed to load archive')))
|
||||
.finally(() => setLoading(false))
|
||||
}, [isZh])
|
||||
const key = `archive-page-${archivePage}-src-${src}`
|
||||
setLoadErr('')
|
||||
setLoading(posts.length === 0 && !hasCached(key))
|
||||
|
||||
// Archive = legacy / test data only. Exclude every live signal source so
|
||||
// active modules don't leak in here as users explore old experiments. Keep
|
||||
// this set in sync with sources emitted by app/services/scanners/*.
|
||||
const archivePosts = useMemo(
|
||||
() => posts.filter(p => !LIVE_SOURCES.has(p.source || '')),
|
||||
[posts],
|
||||
)
|
||||
const sources = useMemo(() => {
|
||||
const m: Record<string, number> = {}
|
||||
for (const p of archivePosts) m[p.source || '?'] = (m[p.source || '?'] || 0) + 1
|
||||
return Object.entries(m).sort((a, b) => b[1] - a[1])
|
||||
}, [archivePosts])
|
||||
const filtered = useMemo(
|
||||
() => src === 'all' ? archivePosts : archivePosts.filter(p => p.source === src),
|
||||
[archivePosts, src],
|
||||
)
|
||||
const archiveTotalPages = Math.max(1, Math.ceil(filtered.length / ARCHIVE_PAGE_SIZE))
|
||||
const archiveSafePage = Math.min(archivePage, archiveTotalPages)
|
||||
const archivePageItems = filtered.slice((archiveSafePage - 1) * ARCHIVE_PAGE_SIZE, archiveSafePage * ARCHIVE_PAGE_SIZE)
|
||||
swrFetch(
|
||||
key,
|
||||
3 * 60_000,
|
||||
() => getPostsPage(
|
||||
ARCHIVE_PAGE_SIZE,
|
||||
archivePage,
|
||||
undefined,
|
||||
{
|
||||
archiveOnly: true,
|
||||
sourceIn: src === 'all' ? undefined : [src],
|
||||
},
|
||||
),
|
||||
fresh => {
|
||||
setPosts(fresh.items)
|
||||
setTotalPosts(fresh.total)
|
||||
setSourceCounts(fresh.source_counts)
|
||||
},
|
||||
)
|
||||
.then(r => {
|
||||
setPosts(r.items)
|
||||
setTotalPosts(r.total)
|
||||
setSourceCounts(r.source_counts)
|
||||
})
|
||||
.catch(async e => {
|
||||
const detail = e instanceof Error ? e.message : 'Failed to load archive'
|
||||
if (!detail.includes('404')) {
|
||||
setLoadErr(detail)
|
||||
return
|
||||
}
|
||||
try {
|
||||
const legacyPosts = await swrFetch(
|
||||
'archive-legacy-500',
|
||||
3 * 60_000,
|
||||
() => getPosts(500, 1),
|
||||
)
|
||||
const fallback = buildArchiveFallbackResponse(legacyPosts, archivePage, ARCHIVE_PAGE_SIZE, src)
|
||||
setPosts(fallback.items)
|
||||
setTotalPosts(fallback.total)
|
||||
setSourceCounts(fallback.source_counts)
|
||||
setLoadErr('')
|
||||
} catch (legacyErr) {
|
||||
setLoadErr(legacyErr instanceof Error ? legacyErr.message : detail)
|
||||
}
|
||||
})
|
||||
.finally(() => setLoading(false))
|
||||
}, [archivePage, posts.length, src])
|
||||
|
||||
const archiveTotalPages = Math.max(1, Math.ceil(totalPosts / ARCHIVE_PAGE_SIZE))
|
||||
const archiveSafePage = Math.min(archivePage, archiveTotalPages)
|
||||
const allSourcesCount = sourceCounts.reduce((sum, item) => sum + item.count, 0)
|
||||
const selectedCount = src === 'all'
|
||||
? totalPosts
|
||||
: sourceCounts.find(s => s.source === src)?.count ?? totalPosts
|
||||
const sourceTabs: [string, number][] = [
|
||||
['all', allSourcesCount],
|
||||
...sourceCounts.map(item => [item.source, item.count] as [string, number]),
|
||||
]
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<div className="page-head">
|
||||
<div>
|
||||
<h1 className="page-title">Archive</h1>
|
||||
<PageHint count={`${archivePosts.length} legacy posts`}>
|
||||
<PageHint count={`${selectedCount} legacy posts`}>
|
||||
Signals from retired scanner experiments
|
||||
(rsi_reversal, sma_reclaim, breakout, test/phase1). Read-only —
|
||||
the bot no longer acts on any of these.
|
||||
@@ -71,7 +101,7 @@ export default function ArchivePageClient() {
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 6, flexWrap: 'wrap', marginBottom: 12 }}>
|
||||
{[['all', archivePosts.length] as [string, number], ...sources].map(([s, n]) => (
|
||||
{sourceTabs.map(([s, n]) => (
|
||||
<button
|
||||
key={s}
|
||||
onClick={() => { setSrc(s); setArchivePage(1) }}
|
||||
@@ -87,30 +117,30 @@ export default function ArchivePageClient() {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{loading && <div style={{ textAlign: 'center', padding: 60, color: 'var(--ink-3)' }}>{isZh ? '加载中…' : 'Loading…'}</div>}
|
||||
{loading && <div style={{ textAlign: 'center', padding: 60, color: 'var(--ink-3)' }}>Loading…</div>}
|
||||
{!loading && loadErr && (
|
||||
<div className="card" style={{ padding: 24, textAlign: 'center', color: 'var(--down)' }}>
|
||||
⚠️ {isZh ? `无法加载归档:${loadErr}` : `Couldn't load archive — ${loadErr}`}
|
||||
⚠️ {`Couldn't load archive — ${loadErr}`}
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<button className="btn ghost" style={{ fontSize: 12, padding: '6px 14px' }}
|
||||
onClick={() => location.reload()}>{isZh ? '重试' : 'Retry'}</button>
|
||||
onClick={() => location.reload()}>Retry</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!loading && !loadErr && filtered.length === 0 && (
|
||||
{!loading && !loadErr && totalPosts === 0 && (
|
||||
<div className="card" style={{ padding: 48, textAlign: 'center', color: 'var(--ink-3)' }}>
|
||||
{isZh ? '没有可显示的历史信号。' : 'No archived signals.'}
|
||||
No archived signals.
|
||||
</div>
|
||||
)}
|
||||
{!loading && archivePageItems.length > 0 && (
|
||||
{!loading && posts.length > 0 && (
|
||||
<>
|
||||
<div className="post-stream">
|
||||
{archivePageItems.map(p => <PostRow key={p.id} post={p} />)}
|
||||
{posts.map(p => <PostRow key={p.id} post={p} />)}
|
||||
</div>
|
||||
<Pagination
|
||||
page={archiveSafePage}
|
||||
total={archiveTotalPages}
|
||||
count={filtered.length}
|
||||
count={totalPosts}
|
||||
pageSize={ARCHIVE_PAGE_SIZE}
|
||||
onChange={setArchivePage}
|
||||
/>
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
// Archive is legacy/test data only — not part of the live signal stack.
|
||||
// noindex keeps it out of search results (duplicate/thin content risk)
|
||||
// while keeping it accessible to logged-in users for inspection.
|
||||
export const revalidate = 60 // archive data rarely changes — ISR at 60s keeps server load low
|
||||
import type { Metadata } from 'next'
|
||||
import { type PostListResponse } from '@/lib/api'
|
||||
import { getPosts } from '@/lib/api'
|
||||
import { buildArchiveFallbackResponse, getInitialPostPage } from '@/lib/postPage'
|
||||
import ArchivePageClient from './ArchivePageClient'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
robots: { index: false, follow: false },
|
||||
}
|
||||
|
||||
export default function ArchivePage() {
|
||||
return <ArchivePageClient />
|
||||
export default async function ArchivePage() {
|
||||
const initialData: PostListResponse | null = await getInitialPostPage(30, 1, {
|
||||
filters: { archiveOnly: true },
|
||||
legacyFallback: async () => {
|
||||
const legacyItems = await getPosts(500, 1).catch(() => null)
|
||||
return legacyItems ? buildArchiveFallbackResponse(legacyItems, 1, 30) : null
|
||||
},
|
||||
})
|
||||
|
||||
return <ArchivePageClient initialData={initialData} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user