"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { Download, Trash2 } from "lucide-react"; import PageShell from "@/components/page-shell"; import { Button } from "@/components/ui/button"; import { ZenCard } from "@/components/ui/zen-card"; import Markdown from "react-markdown"; import { buildHistoryMarkdown, deleteHistoryEntry, downloadMarkdown, loadHistory, } from "@/lib/history/storage"; import { MODE_LABELS, type CalcHistoryEntry } from "@/lib/history/types"; export default function HistoryPageClient() { const [items, setItems] = useState([]); const [activeId, setActiveId] = useState(null); useEffect(() => { const list = loadHistory(); setItems(list); setActiveId(list[0]?.id ?? null); }, []); const active = items.find((e) => e.id === activeId) ?? null; function handleDelete(id: string) { deleteHistoryEntry(id); const next = loadHistory(); setItems(next); if (activeId === id) { setActiveId(next[0]?.id ?? null); } } return (

测算历史

本机浏览器保存,清除缓存后可能丢失

{items.length === 0 ? (

暂无测算记录

去六爻算卦
) : (
{items.map((item) => ( ))}
{active && (

问事:{active.question}

{active.summary && (

{active.summary}

)}
{active.completion}
)}
)}
); }