'use client' import { useState, useEffect, useMemo } from 'react' import { useLocale } from 'next-intl' import type { TrumpPost } from '@/types' import { getPosts } from '@/lib/api' import PostRow from '@/components/dashboard/PostCards' import PageHint from '@/components/ui/PageHint' import Pagination from '@/components/ui/Pagination' const ARCHIVE_PAGE_SIZE = 30 const LIVE_SOURCES = new Set([ 'truth', 'btc_bottom_reversal', 'funding_reversal', 'kol_divergence', ]) /** * 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 ArchivePage() { 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([]) const [loading, setLoading] = useState(true) const [loadErr, setLoadErr] = useState('') const [src, setSrc] = useState('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]) // 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 = {} 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) return (

Archive

Historical fires from old scanner experiments (rsi_reversal, sma_reclaim, breakout, test/phase1). Kept only for inspection — the bot doesn't act on these any more.
{[['all', archivePosts.length] as [string, number], ...sources].map(([s, n]) => ( ))}
{loading &&
{isZh ? '加载中…' : 'Loading…'}
} {!loading && loadErr && (
⚠️ {isZh ? `无法加载归档:${loadErr}` : `Couldn’t load archive — ${loadErr}`}
)} {!loading && !loadErr && filtered.length === 0 && (
{isZh ? '没有可显示的历史信号。' : 'No archived signals.'}
)} {!loading && archivePageItems.length > 0 && ( <>
{archivePageItems.map(p => )}
)}
) }