import { useMemo, useState } from 'react'
import { Copy, Check, Download } from 'lucide-react'
import { STATUS_META } from './status'
import { OUTLOOK_CAVEAT, OUTLOOK_CONCLUSION, OUTLOOK_DISCLAIMER, OUTLOOK_POINTS, OUTLOOK_QUESTIONS, outlookText } from '../data/outlook'
import { CHECK_DATE, buildText, predText, predTopics, stats, theoryGroups, theoryText } from '../lib/kkText'
import type { Prediction, Theory } from '../data/types'
const BASE = import.meta.env.BASE_URL
async function copyText(s: string) {
try {
await navigator.clipboard.writeText(s)
return true
} catch {
const ta = document.createElement('textarea')
ta.value = s
ta.style.position = 'fixed'
ta.style.opacity = '0'
document.body.appendChild(ta)
ta.select()
const ok = document.execCommand('copy')
ta.remove()
return ok
}
}
function CopyBtn({ text, label = '复制', strong }: { text: string; label?: string; strong?: boolean }) {
const [done, setDone] = useState(false)
return (
)
}
function Row({ k, children }: { k: string; children: React.ReactNode }) {
return (
{k}:
{children}
)
}
function TheoryBlock({ t }: { t: Theory }) {
return (
{t.id}
{t.title}
{t.summary}
{t.quote}
({t.ref})
{t.hindsight && {t.hindsight}
}
)
}
function PredBlock({ p }: { p: Prediction }) {
const m = STATUS_META[p.status]
return (
{p.id}
{p.title}
{m.label}
{p.quote}
{p.claim}
{p.ref};发帖 {p.posted};预测期限 {p.horizon}
{p.verdict}
{p.evidence.length > 0 && (
依据:
{p.evidence.map((e, i) => (
-
{e.text}
({e.source})
))}
)}
)
}
export default function TextVersion() {
const [part, setPart] = useState<'all' | 'theory' | 'pred' | 'ai'>('all')
const s = stats()
const full = useMemo(() => buildText(false), [])
const theoryAll = useMemo(() => theoryGroups.flatMap((g) => g.items.map((t) => theoryText(t, false))).join('\n\n'), [])
const predAll = useMemo(() => predTopics.flatMap((g) => g.items.map((p) => predText(p, false))).join('\n\n'), [])
const aiAll = useMemo(() => outlookText(false), [])
const chars = [...full].length
return (
📝 文字版 · kkndme 的理论与预测
把 {theoryGroups.reduce((n, g) => n + g.items.length, 0)} 条理论和 {s.n} 条预测全部写成文字:每条理论有观点、原话、15 年后回头看;每条预测有原话、意思、出处、核对结论和依据;最后附 AI 按他的理论框架对未来房价的推演。核对截至 {CHECK_DATE},全文约 {(chars / 10000).toFixed(1)} 万字,可以整份复制、下载,也可以单条复制。
总账:
{s.n} 条预测中,已到期 {s.due} 条——说中 {s.correct} 条、没说中{' '}
{s.wrong} 条、存疑 {s.disputed} 条;还没到时间 {s.pending} 条。命中率:只算能分对错的是 {s.hit}%,存疑算半分约 {s.half}%,存疑一律当错(最严格)约 {s.strict}%。
{(
[
['all', '全部'],
['theory', `理论框架 ${theoryGroups.reduce((n, g) => n + g.items.length, 0)}`],
['pred', `预测与核对 ${s.n}`],
['ai', 'AI 推演'],
] as const
).map(([k, label]) => (
))}
{([] as [string, string, string][])
.concat(part === 'all' || part === 'theory' ? theoryGroups.map((g): [string, string, string] => ['th', g.name, g.items[0].id]) : [])
.concat(part === 'all' || part === 'pred' ? predTopics.map((g): [string, string, string] => ['pd', g.name, g.items[0].id]) : [])
.map(([kind, name, id]) => (
))}
{(part === 'all' || part === 'theory') && (
第一部分 · 理论框架
{theoryGroups.map((g, gi) => (
{gi + 1}. {g.name}
{g.items.length} 条
{g.items.map((t) => (
))}
))}
)}
{(part === 'all' || part === 'pred') && (
第二部分 · 预测与核对
{predTopics.map((g, gi) => {
const ok = g.items.filter((p) => p.status === 'correct').length
const no = g.items.filter((p) => p.status === 'wrong').length
return (
{gi + 1}. {g.name}
{g.items.length} 条 · 说中 {ok} · 没说中 {no}
{g.items.map((p) => (
))}
)
})}
)}
{(part === 'all' || part === 'ai') && }
说明:前两部分仅做历史言论的事实核对;第三部分为 AI 推演。全部内容均不构成任何买房或投资建议。
)
}
const TONE = { up: '#34d399', down: '#f87171', flat: '#fbbf24' } as const
function AiOutlook() {
return (
第三部分 · AI 推演:按理论框架看未来房价
不构成投资建议
{OUTLOOK_DISCLAIMER}
理论框架回答的三个根本问题
{OUTLOOK_QUESTIONS.map((x, i) => (
问题 {i + 1}
{x.q}
{x.basis}({x.refs.join('、')})
))}
{OUTLOOK_POINTS.map((pt) => (
{pt.no}
{pt.title}
{pt.short}
依据:{pt.basis}({pt.refs.join('、')})
{pt.detail}
))}
要打折扣的地方:{OUTLOOK_CAVEAT.title}
{OUTLOOK_CAVEAT.stats.map((x) => (
))}
{OUTLOOK_CAVEAT.text}
结论:{OUTLOOK_CONCLUSION}
)
}